|
SilverStream Application Server 3.5 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Container | +--javax.swing.JComponent | +--javax.swing.text.JTextComponent | +--javax.swing.JTextField | +--com.sssw.rt.jform.AgcJTextField | +--com.sssw.rt.jform.AgcJValueField
Base class of several input fields that have non-text data types.
The subclasses for specific data types include:
Inner classes inherited from class javax.swing.JTextField |
JTextField.AccessibleJTextField |
Inner classes inherited from class javax.swing.text.JTextComponent |
JTextComponent.AccessibleJTextComponent,
JTextComponent.KeyBinding |
Inner classes inherited from class javax.swing.JComponent |
JComponent.AccessibleJComponent |
Fields inherited from class com.sssw.rt.jform.AgcJTextField |
NO_LIMIT |
Fields inherited from class javax.swing.JTextField |
notifyAction |
Fields inherited from class javax.swing.text.JTextComponent |
DEFAULT_KEYMAP,
FOCUS_ACCELERATOR_KEY |
Fields inherited from class javax.swing.JComponent |
accessibleContext,
listenerList,
TOOL_TIP_TEXT_KEY,
ui,
UNDEFINED_CONDITION,
WHEN_ANCESTOR_OF_FOCUSED_COMPONENT,
WHEN_FOCUSED,
WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT,
CENTER_ALIGNMENT,
LEFT_ALIGNMENT,
RIGHT_ALIGNMENT,
TOP_ALIGNMENT |
Constructor Summary | |
AgcJValueField(char datatype)
Creates an AgcJValueField control. |
Method Summary | |
String |
format(Object ob,
String pattern,
int style1,
int style2)
Formats the object according to the specified pattern or style. |
String |
getDisplayPattern()
Gets the pattern that the control uses to parse the user's input and display the data. |
int |
getDisplayStyle()
Gets the number of the display style assigned to the control. |
Object |
parse(int datatype,
String parseStr,
String pattern,
int style1,
int style2)
Parses the string according to the specified pattern or style. |
void |
setDisplayPattern(String pattern)
Sets the pattern that the control uses to parse the user's input and display the data. |
void |
setDisplayStyle(int style)
Sets the style used to parse the user's input and format the displayed data. |
Methods inherited from class com.sssw.rt.jform.AgcJTextField |
getEmptyStringIsNull,
getMaxLength,
getMinLength,
setEmptyStringIsNull,
setMaxLength,
setMinLength |
Methods inherited from class java.awt.Container |
add,
add,
add,
add,
add,
addContainerListener,
addImpl,
countComponents,
deliverEvent,
doLayout,
findComponentAt,
findComponentAt,
getComponent,
getComponentAt,
getComponentAt,
getComponentCount,
getComponents,
getLayout,
insets,
invalidate,
isAncestorOf,
layout,
list,
list,
locate,
minimumSize,
paintComponents,
preferredSize,
printComponents,
processContainerEvent,
processEvent,
remove,
remove,
removeAll,
removeContainerListener,
setCursor,
setLayout,
validate,
validateTree |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Methods implemented from interface com.sssw.rt.form.AgiHelpInfo |
getHelpInfo,
setHelpInfo |
Constructor Detail |
public AgcJValueField(char datatype)
datatype
- a constant defined in DatatypeCodes
specifying the data type of the value in the input fieldMethod Detail |
public String getDisplayPattern()
A display pattern overrides a display style. If the display pattern is null, then the display style is used.
You can also set the Display Format property in the Property Inspector.
String pattern; pattern = ControlName1.getDisplayPattern();
AgcJValueField.setDisplayPattern(String)
,
AgcJValueField.getDisplayStyle()
,
AgcJValueField.setDisplayStyle(int)
public void setDisplayPattern(String pattern)
pattern
- a String specifying a format for the numeric dataDecimalFormat
.
For Time, Date and Timestamp field, see also SimpleDateFormat
.
If the control has both a display pattern and a display style, the display pattern is used. When you change the display pattern, it doesn't take effect until the value in the control changes.
String pattern = "dd-MMM-yyyy"; ControlName1.setDisplayPattern(pattern);
AgcJValueField.getDisplayPattern()
,
AgcJValueField.getDisplayStyle()
,
AgcJValueField.setDisplayStyle(int)
public int getDisplayStyle()
AgcJValueField.getDisplayPattern()
,
AgcJValueField.setDisplayPattern(String)
,
AgcJValueField.setDisplayStyle(int)
public void setDisplayStyle(int style)
style
- an int specifying a named display style.
Set it to null to use the default pattern.If the control has both a display pattern and a display style, the display style is ignored and the display pattern is used.
AgcJValueField.getDisplayPattern()
,
AgcJValueField.setDisplayPattern(String)
,
AgcJValueField.getDisplayStyle()
public String format(Object ob, String pattern, int style1, int style2)
AgFormat.format()
expects them.ob
- an Object whose value you want to represent as a String with appropriate formattingpattern
- specifies the pattern for the output String.
If pattern is null, format()
uses the style parameters
to determine the format of the output String.style1
- specifies a style for the output String.
If the Object's type is Timestamp, specifies a style for
the time portion of the output String.style2
- If the Object's type is Timestamp, specifies a style
for the date portion of the output String. For other object types, specify null.format()
and parse()
to implement additional formatting and parsing rules.
SilverStream calls the format()
method
to convert the value associated with the input field to a String so it can be displayed.
The default implementation calls
AgFormat.format(ob, pattern, style1, style2)
and can format numeric, date, and time data.
When you extend AgcValueField to implement another data type,
you can override format()
and parse()
to handle the data.
When you are using SilverStream formatting, you can find information on characters for formatting patterns and named constants for styles in Formatting Patterns and Styles in the online General Reference.
8 @see #parse(int, String, String, int, int)
public Object parse(int datatype, String parseStr, String pattern, int style1, int style2) throws IllegalArgumentException
AgParse.parse()
expects them.datatype
- a constant defined in the com.sssw.rt.form.DatatypeCodes class, which identifies
the data type of the resulting object.
The value of parseStr
must be compatible with the specified data type.
Otherwise, an IllegalArgumentException is thrown.parseStr
- a String whose text can be converted to the specified data typepattern
- specifies the first pattern to use when trying to parse the string.
The pattern is often null. If it is null, then a list of
common patterns and styles is used to try to parse the string.
If it is not null, then the specified pattern is tried first.
If that pattern fails, then the list of common patterns
and styles is used.style1
- specifies the first style to use when trying to parse the string.
If style
is not null, it is used before the pattern
.
If the Object's type is Timestamp, specifies a style for parsing
the time portion of the input String.style2
- If the Object is a Timestamp, specifies a style
for parsing the date portion of the input String. For other object types, specify null.datatype
and whose value is the result of
applying the specified pattern or style to the value in parseStr
format()
and parse()
to implement additional formatting and parsing rules. SilverStream calls
the parse()
method
when the user enters text in the input field and SilverStream needs to convert it
to an object of the appropriate data type.
If you are extending one of the classes derived from AgcValueField, the data type is one of the constants defined in com.sssw.rt.util.DatatypeCodes. For example, for AgcIntegerField, the data type is DatatypeCodes.TYPE_LONG.
If you extend AgcValueField directly and define your own formatting and parsing, then the data type you specify doesn't matter with this caveat: do not use the data type TYPE_STRING. This type gets special handling that bypasses extra formatting and parsing, which you do not want in your extended control.
The default implementation calls
AgParse.parse(datatype, parseStr, pattern, style1, style2)
and can parse string that represent numbers, dates, or times.
When you extend AgcValueField to implement another data type,
you can override format()
and parse()
to handle the data.
When you are using SilverStream formatting, you can find information on characters for formatting patterns and named constants for styles in Formatting Patterns and Styles in the online General Reference.
AgParse
,
AgcJValueField.format(Object, String, int, int)
|
SilverStream Application Server 3.5 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |