SilverStream
Application Server 3.5

com.sssw.shr.page
Class AgpTextArea

java.lang.Object
 |
 +--com.sssw.shr.page.AgpTag
       |
       +--com.sssw.shr.page.AgpControlBase
             |
             +--com.sssw.shr.page.AgpTextArea
All Implemented Interfaces:
AgiJavaScriptEnhanced, AgiPageControl, Cloneable, Externalizable, Serializable

public class AgpTextArea
extends AgpControlBase

TextArea HTML form control. This control lets the user enter multiple lines of text.

Properties:
Column Count, Data Column, Enable HTML Generation, Name, Row Count, Submit On Change, Validation Rules, Value
Events:
validationFailed, validationTest, valueChanged
See Also:
Serialized Form

Fields inherited from class com.sssw.shr.page.AgpTag
UNIT_PERCENT, UNIT_PIXEL
 
Constructor Summary
AgpTextArea()
           
 
Method Summary
 int getColumnCount()
          Returns the width of the control as a number of characters.
 boolean getEmptyStringIsNull()
          Returns whether the value of an empty text control is null.
 int getRowCount()
          Returns the height of this control, expressed as a number of rows of text.
 boolean getSubmitOnChange()
          Returns the "Submit On Change" property of this control.
 String getText()
          Returns the text of the control.
 String getValue()
          Returns the value of the control, as a string.
 void setColumnCount(int columncount)
          Sets the width of this control, expressed as a number of character widths.
 void setEmptyStringIsNull(boolean b)
          Specifies whether the value of an empty text control is null.
 void setRowCount(int rowcount)
          Sets the height of this control, expressed as a number of rows of text.
 void setSubmitOnChange(boolean submit_on_change)
          Sets the Submit On Change property of this control.
 void setText(String text)
          Sets the text of the control.
 void setValue(String value)
          Sets the value of the control.
 
Methods inherited from class com.sssw.shr.page.AgpControlBase
getName
 
Methods inherited from class com.sssw.shr.page.AgpTag
getBoolProperty, getEnableHTMLGeneration, getIntArrayProperty, getIntProperty, getIntPropertyUnit, getProperty, getStringArrayProperty, invalidateHTML, removeProperty, setEnableHTMLGeneration, setIntProperty, setProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods implemented from interface com.sssw.shr.page.AgiJavaScriptEnhanced
generateFunction, generateRepaintScript, generateScriptInitializers, getFunctionNameForMethod, getFunctionNames, getMethodNames, getScriptObjectName, isHTMLRepaintPending, isJavaScriptRepaintPending
 
Methods implemented from interface com.sssw.shr.page.AgiPageControl
generateHTML, getPrefix, notifyPageLoaded, notifyPageRequestBegin, notifyPageRequestEnd, notifyPostValue, notifyPostValues
 
Methods implemented from interface java.io.Externalizable
readExternal, writeExternal
 

Constructor Detail

AgpTextArea

public AgpTextArea()
Method Detail

getRowCount

public int getRowCount()
Returns the height of this control, expressed as a number of rows of text. The height can be set at design time using the "Row count" field of the Property Inspector, or at run time using the setRowCount method.
Usage:

The height of the control shown in the Page Designer is an approximation. The control as displayed to the user in the browser may vary slightly from its design-time appearance.

Example:
 		// if this text area is not already at least ten rows high, make it so
 		if (TextArea1.getRowCount() < 10)
 			TextArea1.setRowCount(10);
 
 
See Also:
Row Count property, AgpTextArea.setRowCount(int rowcount)

setRowCount

public void setRowCount(int rowcount)
Sets the height of this control, expressed as a number of rows of text.
Parameters:
rowCount - the number of rows in the control's height.
Usage:

The height of the control shown in the Page Designer is an approximation. The control as displayed to the user in the browser may vary slightly from its design-time appearance.

Example:
 		// if this text area is not already at least ten rows high, make it so
 		if (TextArea1.getRowCount() < 10)
 			TextArea1.setRowCount(10);
 
 
See Also:
Row Count property, AgpTextArea.getRowCount()

getColumnCount

public int getColumnCount()
Returns the width of the control as a number of characters. This width can be set at design time using the "Column count" field of the Property Inspector or at run time with the setColumnCount() method.
Usage:

The width of the control shown in the Page Designer is an approximation. The control as displayed to the user in the browser may vary slightly from its design-time appearance.

Example:
 
See Also:
Column Count property, AgpTextArea.setColumnCount(int columncount)

setColumnCount

public void setColumnCount(int columncount)
Sets the width of this control, expressed as a number of character widths.
Parameters:
columncount - the number of characters in the control's width.
Usage:

The width of the control shown in the Page Designer is an approximation. The control as displayed to the user in the browser may vary slightly from its design-time appearance.

Example:
 		// if there isn't enough room for a particular string
 		// try to make this text field bigger
 		int len = headerString.length();
 		if (Field1.getSize() < len)
 		{
 			Field1.setSize(len);
 		}
 
 
See Also:
Column Count property, AgpTextArea.getColumnCount()

getText

public String getText()
Returns the text of the control. This method never returns null. If the control's value is null, getText() returns the empty string. Because this is a multi-line edit control, the returned text may contain newline characters.
Example:
 		// Put brackets at the beginning and end of the text in the control
 		// if there is any text in it, and it hasn't already been bracketed
 		String oldText = TextArea1.getText().trim();
 		if ((oldText.length() > 0) && !(oldText.startsWith("[") && oldText.endsWith("]")))
 		{
 			TextArea1.setText("["+oldText+"]");
 		}
 
See Also:
AgpTextArea.setEmptyStringIsNull(boolean b), AgpTextArea.setText(String text)

setText

public void setText(String text)
Sets the text of the control.
Parameters:
text - the new string.
Example:
 		// Put brackets at the beginning and end of the text in the control
 		// if there is any text in it, and it hasn't already been bracketed
 		String oldText = TextArea1.getText().trim();
 		if ((oldText.length() > 0) && !(oldText.startsWith("[") && oldText.endsWith("]")))
 		{
 			TextArea1.setText("["+oldText+"]");
 		}
 
See Also:
AgpTextArea.getText()

getValue

public String getValue()
Returns the value of the control, as a string. The value may be null. If the control is bound to a database field, this is the value that will be stored.
Example:
 		// if this field has a null value, display a warning label
 		if (TextArea1.getValue() == null)
 		{
 			lblWarning.setText("You must enter an explanation in the text area.");
 			lblWarning.setEnableHTMLGeneration(true);
 		}
 		else
 		{
 			// hide the label
 			lblWarning.setEnableHTMLGeneration(false);
 		}
 
 
See Also:
Value property, AgpTextArea.setValue(String value)

setValue

public void setValue(String value)
Sets the value of the control. If the control is bound to a database field, this is the value that will be stored.
Parameters:
value - a string that should appear in the text area, or null.
Example:
 		// if the text area has a value, reset it to a default, but leave it alone if it's null
 		if (TextArea1.getValue() != null)
 		{
 			TextArea1.setValue("Please enter a new description here.");
 		}
 
 
See Also:
Value property, AgpTextArea.getValue()

getSubmitOnChange

public boolean getSubmitOnChange()
Returns the "Submit On Change" property of this control. This property can be set at design time using the "Submit on Change" field of the Property Inspector, or at run time using the setSubmitOnChange method. If this property is true, then the control will send a Submit request to the server when the end user has entered text.
Example:
 		// Display or hide a "Submit" button on the page, depending on whether the control
 		// named TextArea1 is going to handle its own submits
 		if (TextArea1.getSubmitOnChange())
 		{
 			// Field1 will submit, don't show the button
 			btnSubmit.setEnableHTMLGeneration(false);
 		}
 		else
 		{
 			// Field1 will not submit, so we need the button
 			TextArea1.setEnableHTMLGeneration(true);
 		}
 
 
See Also:
Submit On Change property, AgpTextArea.setSubmitOnChange(boolean submit_on_change)

setSubmitOnChange

public void setSubmitOnChange(boolean submit_on_change)
Sets the Submit On Change property of this control.
Parameters:
submit_on_change - true to send a Submit request to the server when the value changes, otherwise false.
Usage:

This functionality depends on JavaScript. It will not work in all browsers.

Example:
 		// depending on an application flag, set this text field to automatically
 		// submit a request to the server when the user enters text.
 		if (g_JavaScriptOK)
 		{
 			Field1.setSubmitOnChange(true);
 		}
 
See Also:
Submit On Change property, AgpTextArea.getSubmitOnChange()

getEmptyStringIsNull

public boolean getEmptyStringIsNull()
Returns whether the value of an empty text control is null.

A text field containing no characters can be interpreted in two ways: either its value is null or it is the empty string, "". The null value is generally more appropriate when the field is bound to a database column that can contain a null value, so as to avoid storing a value of "" in the database. Some applications will require that the text field contain a valid String object at all times, so they will use the empty string value for an empty field.

The default value of this property is false. If true, then the value of an empty text control is null instead of the empty string. This property can be set programmatically using the setEmptyStringIsNull method.

Example:
 		boolean emptyIsNull = Field1.getEmptyStringIsNull();
 
See Also:
AgpTextArea.getText(), AgpTextArea.setEmptyStringIsNull(boolean b)

setEmptyStringIsNull

public void setEmptyStringIsNull(boolean b)
Specifies whether the value of an empty text control is null. The default setting is false.

A text area containing no characters can be interpreted in two ways: either its value is null or it is the empty string, "". The null value is generally more appropriate when the text area is bound to a database column that can contain a null value, so as to avoid storing a value of "" in the database. Some applications will require that the text area contain a valid String object at all times, so they will use the empty string value for an empty text area.

Parameters:
b - true if the value of an empty text control should be null instead of the empty string; otherwise false.
Usage:

Note that getText() on an empty text area will always return the empty string.

Example:
 		// Indicate that this text area should return a null value if
 		// the user deletes its contents
 		TextArea1.setEmptyStringIsNull(true);
 
See Also:
AgpTextArea.getEmptyStringIsNull(), AgpTextArea.getText()

SilverStream
Application Server 3.5