public class Option extends MappedAttributesObject
AbstractField
.Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
OPTION
The pattern used to create the html for a select option.
|
private static long |
serialVersionUID
The class' serialization version id.
|
ivHashCode, ivHashFlds, ivObjAttrs
Constructor and Description |
---|
Option(java.lang.String text)
Constructs a new instance of
Option using the supplied
parameters. |
Option(java.lang.String text,
java.lang.String value)
Constructs a new instance of
Option using the supplied
parameters. |
Option(java.lang.String text,
java.lang.String value,
boolean selected)
Constructs a new instance of
Option using the supplied
parameters. |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj)
Compares the given object to this object and determines if the two are
equal.
|
private java.lang.String |
formatAttr(java.lang.String attr)
Returns a formatted html string for the requested attribute value.
|
boolean |
getSelected()
Returns the option's selected state attribute.
|
java.lang.String |
getText()
Returns the option's text attribute.
|
java.lang.String |
getValue()
Returns the option's value attribute.
|
void |
setSelected(boolean selected)
Sets the option's selected state attribute.
|
void |
setText(java.lang.String text)
Sets the option's text attribute.
|
void |
setTextHS(java.lang.String text)
Sets the option's text attribute.
|
void |
setValue(java.lang.String value)
Sets the option's value attribute.
|
java.lang.String |
toHTML()
Returns a formatted html string for the option's current attribute
values.
|
cloneMapAttributes, formatValue, formatValue, getHashFields, getMapArrayList, getMapAttributes, getMapBigDecimal, getMapBoolean, getMapDate, getMapDouble, getMapInteger, getMapLong, getMapMapped, getMapObject, getMapShort, getMapString, getMapString, getMapStringBuffer, getMapStringBuilder, getMapTime, getMapTimestamp, getMapVector, hashCode, setHashFields, setMap, setMap, setMap, setMap, setMap, setMap, setMap, setMap, setMap, setMap, setMap, setMap, setMap, setMap, setMap, setMapAttributes, setMapObject, setMapTime, setMapTimestamp, toStringArray
private static final long serialVersionUID
private static final java.lang.String OPTION
public Option(java.lang.String text)
Option
using the supplied
parameters. Defaults the option value to the given text and the selected
state to "unselected".text
- (String) The text to display for the option. The supplied
value is auto-encoded for html safe characters. To construct an
option with text that is already html safe, set this value to an
empty string and then use the setTextHS() method to set the html
safe text value.public Option(java.lang.String text, java.lang.String value)
Option
using the supplied
parameters. Defaults the option selected state to "unselected".text
- (String) The text to display for the option. The supplied
value is auto-encoded for html safe characters. To construct an
option with text that is already html safe, set this value to an
empty string and then use the setTextHS() method to set the html
safe text value.value
- (String) The value returned for a selected option.public Option(java.lang.String text, java.lang.String value, boolean selected)
Option
using the supplied
parameters.text
- (String) The text to display for the option. The supplied
value is auto-encoded for html safe characters. To construct an
option with text that is already html safe, set this value to an
empty string and then use the setTextHS() method to set the html
safe text value.value
- (String) The value returned for a selected option.selected
- (boolean) true
to set the initial state
of the option to "selected", otherwise false
.public boolean equals(java.lang.Object obj)
equals
in class MappedAttributesObject
obj
- (Object) The object to compare with this object.true
if the specified object is equal to
this object, otherwise false
.public boolean getSelected()
public void setSelected(boolean selected)
selected
- (boolean) The option's selected state.public java.lang.String getText()
public void setText(java.lang.String text)
text
- (String) The option's text. The supplied value is encoded
for html safe characters.public void setTextHS(java.lang.String text)
text
- (String) The option's text. The supplied value is assumed
to contain html safe characters. No additional encoding is done.public java.lang.String getValue()
public void setValue(java.lang.String value)
value
- (String) The option's value.private java.lang.String formatAttr(java.lang.String attr)
public java.lang.String toHTML()