|
SilverStream Application Server 3.5 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.sssw.shr.page.AgpTag | +--com.sssw.shr.page.AgpControlBase | +--com.sssw.shr.page.AgpTextField
Single-line Text Field HTML form control. This control lets the user enter a single line of text.
Fields inherited from class com.sssw.shr.page.AgpTag |
UNIT_PERCENT,
UNIT_PIXEL |
Constructor Summary | |
AgpTextField()
|
Method Summary | |
String |
format(Object ob,
String pattern,
int style1,
int style2)
Callback to format the object according to the specified pattern or style. |
BigDecimal |
getBigDecimalValue()
Get the field value. |
char |
getDatatype()
Gets the data type for a text field. |
Date |
getDateValue()
Get the field value. |
String |
getDisplayPattern()
Returns a String that identifies the pattern that the control uses to display the data. |
int |
getDisplayStyle()
Obtains the control's display style. |
Double |
getDoubleValue()
Get the field value. |
boolean |
getEmptyStringIsNull()
Returns whether the value of an empty text control is null . |
Integer |
getIntegerValue()
Get the field value. |
int |
getMaxLength()
Returns the maximum number of characters that a user can enter in this field, as determined by its "Max Length" property. |
Object |
getObjectValue()
Get the field value as an Object. |
int |
getSize()
Returns the width of the control as a number of characters. |
boolean |
getSubmitOnChange()
Returns the "Submit On Change" property of this control. |
String |
getText()
Returns the text of the control. |
Timestamp |
getTimestampValue()
Get the field value. |
Time |
getTimeValue()
Get the field value. |
String |
getType()
Returns a string indicating the Type property of this control. |
String |
getValue()
Deprecated. to getText(). Use getObjectValue() to get the parsed value (e.g. a Double object if the field's datatype is TYPE_DOUBLE). |
Object |
parse(int datatype,
String parseStr,
String pattern,
int style1,
int style2)
Callback to parse the string according to the specified pattern or style. |
void |
setBigDecimalValue(BigDecimal value)
Set the field value. |
void |
setDatatype(char datatype)
Sets the data type for a text field. |
void |
setDateValue(Date value)
Set the field value. |
void |
setDisplayPattern(String pattern)
Assigns the control's display format. |
void |
setDisplayStyle(int style)
Assigns the control's display style. |
void |
setDoubleValue(Double value)
Set the field value. |
void |
setEmptyStringIsNull(boolean b)
Specifies whether the value of an empty text control is null . |
void |
setIntegerValue(Integer value)
Set the field value. |
void |
setMaxLength(int maxlength)
Sets the Max Length property of the control. |
void |
setObjectValue(Object value)
Set the field value as an Object. |
void |
setSize(int size)
Sets the Size property of the control. |
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 |
setTimestampValue(Timestamp value)
Set the field value. |
void |
setTimeValue(Time value)
Set the field value. |
void |
setType(String type)
Sets the Type property of the control. |
void |
setValue(String value)
Deprecated. to setText(). Use setObjectValue() to set the parsed value (e.g. a Double object if the field's datatype is TYPE_DOUBLE). |
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 |
public AgpTextField()
Method Detail |
public int getMaxLength()
getMaxLength()
returns 0.int maxlen = Field1.getMaxLength();
AgpTextField.setMaxLength(int maxlength)
public void setMaxLength(int maxlength)
maxlength
- the maximum number
of characters allowed for user entry.AgpTextField.getMaxLength()
public int getSize()
setSize()
method.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.
// if there isn't enough room for a particular string // try to make this text field bigger int len = myString.length(); if (Field1.getSize() < len) { Field1.setSize(len); }
AgpTextField.setSize(int size)
public void setSize(int size)
size
- the number of characters in the control's width.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.
// if there isn't enough room for a particular string // try to make this text field bigger int len = myString.length(); if (Field1.getSize() < len) { Field1.setSize(len); }
AgpTextField.getSize()
public String getType()
"TEXT"
, "PASSWORD"
, or "HIDDEN"
.
A "Text" field is the standard text input field.
A "Password" field accepts user input, but displays it as asterisks. A "Hidden" field does not
appear to the user; it can be useful for maintaining application-internal information on the page.
This property can be set at design time using the Type field of the Property Inspector, or at
run time using the setType
method.
String fieldType = Field1.getType();
AgpTextField.setType(String type)
public void setType(String type)
This property can be set at design time using the Type field of the Property Inspector, or at
run time using the setType
method.
type
- One of three strings: "TEXT"
, "PASSWORD"
, or "HIDDEN"
if (cloakMe) Field1.setType("PASSWORD"); else Field1.setType("TEXT");
AgpTextField.getType()
public String getText()
null
. If the
control's value is null
, getText()
returns the empty string.// Insert the string "NEW: " at the beginning of the field. String fieldText = Field1.getText(); Field1.setText("NEW: "+fieldText);
AgpTextField.setEmptyStringIsNull(boolean b)
,
AgpTextField.setText(String text)
public void setText(String text)
text
- the new text string.// Insert the string "NEW: " at the beginning of the field. String fieldText = Field1.getText(); Field1.setText("NEW: "+fieldText);
AgpTextField.getEmptyStringIsNull()
,
AgpTextField.getText()
,
AgpTextField.setEmptyStringIsNull(boolean b)
public String getValue()
null
.
If the control is bound to a database field, this is the value that will be stored.// if this field has a null value, display a warning label if (Field1.getValue() == null) { lblWarning.setText("The first field must be filled in: "); lblWarning.setEnableHTMLGeneration(true); } else { // hide the label lblWarning.setEnableHTMLGeneration(false); }
AgpTextField.getEmptyStringIsNull()
,
AgpTextField.setEmptyStringIsNull(boolean b)
,
AgpTextField.setValue(String value)
public void setValue(String value)
value
- a string that should appear in the text field, or null
.// Clear out the first text field, and initialize the second one Field1.setValue(null); Field2.setValue("Untitled");
AgpTextField.getValue()
public boolean getSubmitOnChange()
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.// Display or hide a "Submit" button on the page, depending on whether the control // named Field1 is going to handle its own submits if (Field1.getSubmitOnChange()) { // Field1 will submit, don't show the button btnSubmit.setEnableHTMLGeneration(false); } else { // Field1 will not submit, so we need the button btnSubmit.setEnableHTMLGeneration(true); }
AgpTextField.setSubmitOnChange(boolean submit_on_change)
public void setSubmitOnChange(boolean submit_on_change)
submit_on_change
- true
to
send a Submit request to the server when the value
changes, otherwise false
.This functionality depends on JavaScript. It will not work in all browsers.
// 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); }
AgpTextField.getSubmitOnChange()
public boolean getEmptyStringIsNull()
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.
boolean emptyIsNull = Field1.getEmptyStringIsNull();
AgpTextField.getText()
,
AgpTextField.setEmptyStringIsNull(boolean b)
public void setEmptyStringIsNull(boolean b)
null
.
The default setting is false
.
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.
b
- true
if the value of an empty text control should be
null
instead of the empty string; otherwise false
.
Note that getText()
on an empty text field will always return the empty string.
// Indicate that this text field should return a null value if // the user deletes its contents Field1.setEmptyStringIsNull(true);
AgpTextField.getEmptyStringIsNull()
,
AgpTextField.getText()
public char getDatatype()
AgpTextField.setDatatype(char datatype)
public void setDatatype(char datatype)
Note that patterns and styles are not currently supported for BigDecimals. For information on display patterns and styles, see Formatting Patterns and Styles in the online General Reference.
public String getDisplayPattern()
Use the AgpTextField.setDisplayPattern(String pattern)
method to assign this value at runtime.
Note that a display pattern overrides a display style. If the display pattern is null, then the display style is used.
String pattern; pattern = ControlName1.getDisplayPattern();
AgpTextField.getDisplayStyle()
,
AgpTextField.setDisplayStyle(int style)
public void setDisplayPattern(String pattern)
pattern
- specifies the patternDecimalFormat
.
For Time, Date and Timestamp field, see also SimpleDateFormat
.
Note that a display pattern overrides a display style. If the display pattern is null, then the display style is used.
Use the AgpTextField.getDisplayPattern()
method to determine the current value.
ControlName1.setDisplayPattern("$#,##0.00;($#,##0.00)");
AgpTextField.setDisplayStyle(int style)
public int getDisplayStyle()
Note that a display pattern overrides a display style. If the display pattern is null, then the display style is used.
Use the AgpTextField.setDisplayStyle(int style)
method to assign this value at runtime.
int style; style = ControlName1.getDisplayStyle();
AgpTextField.getDisplayPattern()
public void setDisplayStyle(int style)
style
- specifies a Style constant.
About the numeric style PERCENTSTYLE:
"63%" represents a value of .63, not 63.
So this style makes little sense for integer fields (it could only display 100%, 200%, etc).
A display pattern overrides a display style. If the display pattern is null, then the display style is used.
Use the getDisplayStyle() method to retrieve this value at runtime.
ControlName1.setDisplayStyle(AgFormat.CURRENCYSTYLE);
AgpTextField.getDisplayStyle()
,
AgpTextField.setDisplayPattern(String)
public Object getObjectValue()
public void setObjectValue(Object value)
public Integer getIntegerValue() throws AgoApiException
public void setIntegerValue(Integer value)
public Double getDoubleValue() throws AgoApiException
public void setDoubleValue(Double value)
public BigDecimal getBigDecimalValue() throws AgoApiException
public void setBigDecimalValue(BigDecimal value)
public Date getDateValue()
public void setDateValue(Date value)
public Time getTimeValue()
public void setTimeValue(Time value)
public Timestamp getTimestampValue()
public void setTimestampValue(Timestamp value)
public String format(Object ob, String pattern, int style1, int style2)
This method is not useful for developers using standard SilverStream classes. It is provided as a mechanism for developers who wish to create their own classes that extend the SilverStream classes and support some additional formatting/parsing rules.
public Object parse(int datatype, String parseStr, String pattern, int style1, int style2) throws IllegalArgumentException
This method is not useful for developers using standard SilverStream classes. It is provided as a mechanism for developers who wish to create their own classes that extend the SilverStream classes and support some additional formatting/parsing rules.
|
SilverStream Application Server 3.5 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |