|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--objectivehtml.oms.OMSObject | +--objectivehtml.htmlwidget.HtmlElement | +--objectivehtml.htmlwidget.HtmlOptionItem
This class holds the data for an option item element in a select box. i.e.
<option ...>
The object can only exist within the context of a HtmlListBox object. Each option item has 2 components, the value and option text components. The value is what is used internally by the form to identify the option item, where as the option text is what is displayed to the client. The value of each option item must be unique for the object to correctly identify the selected values of the list box.
If auto-escape is turned on (default) then the value and option text are escaped before being written out (using HtmlUtils.htmlSpecialChars(String)).
The object can be either selected or unselected. This is used by the parent HtmlListBox object to determine which option items are chosen.
HtmlUtils.htmlSpecialChars(String)
Fields inherited from class objectivehtml.htmlwidget.HtmlElement |
m_hmAttributes, m_sEndTag, m_sQuoteType, m_sStartTag |
Constructor Summary | |
protected |
HtmlOptionItem(HtmlListBox objParent)
Constructs an instance of HtmlOptionItem. |
Method Summary | |
protected java.lang.String |
genStartTag(int nOutputType)
Generates the start tag with all the attribute values that have been set for this object. |
HtmlListBox |
getHtmlListBox()
Returns a reference to the HtmlListBox object that this option is contained within. |
java.lang.String |
getOptionText()
Returns the option text of this option item. |
java.lang.String |
getValue()
Returns the value of this option item. |
boolean |
isAutoEscape()
Returns whether the auto-escape feature is on or not. |
boolean |
isSelected()
Returns whether the option item is selected/unselected. |
void |
printHtml(javax.servlet.jsp.JspWriter objWriter,
int nOutputType)
Prints the html that represents this object to the output stream. |
void |
printHtml(java.io.PrintWriter objWriter,
int nOutputType)
Prints the html that represents this object to the output stream. |
void |
setAutoEscape(boolean bAutoEscape)
Sets the auto-escape feature to be either on (default) or off. |
void |
setBooleanAttribute(java.lang.String sAttribute,
boolean bIsOn)
Sets a html boolean-attribute for this object. |
void |
setOptionText(java.lang.String sOptionText)
Sets the option text of this option item. |
void |
setSelected(boolean bSelected)
Sets the option item to selected/unselected. |
void |
setValue(java.lang.String sValue)
Sets the value for this option item. |
Methods inherited from class objectivehtml.htmlwidget.HtmlElement |
genEndTag, genStartTag, getAttribute, getAttributes, getBooleanAttribute, getQuoteType, printHtml, printHtml, printHtml, printHtml, printHtml, printHtml, setAttribute, setQuoteType, toString, toString |
Methods inherited from class objectivehtml.oms.OMSObject |
compareClasses, connect, disconnect, emit, isAlive, setAlive, signal, slot, slot |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
protected HtmlOptionItem(HtmlListBox objParent) throws InvalidParentElementException
objParent
- the parent of this elementInvalidParentElementException
- if the specified parent element is not validMethod Detail |
public HtmlListBox getHtmlListBox()
public void setAutoEscape(boolean bAutoEscape)
bAutoEscape
- true if you want auto-escape on (default), false otherwiseHtmlUtils.htmlSpecialChars(String)
,
isAutoEscape()
public boolean isAutoEscape()
setAutoEscape(boolean)
public java.lang.String getValue()
setValue(String)
,
HtmlElement.getAttribute(String)
public void setValue(java.lang.String sValue)
Sets the value for this option item.
The html attribute it sets is "value".
If null is specified the attribute is cleared.
sValue
- the value for this elementHtmlElement.setAttribute(String, String)
,
getValue()
public java.lang.String getOptionText()
setOptionText(String)
public void setOptionText(java.lang.String sOptionText)
sOptionText
- the option text for this itemgetOptionText()
public void setSelected(boolean bSelected)
Sets the option item to selected/unselected.
The html attribute it sets is "selected".
If null is specified the attribute is cleared.
bSelected
- true for selected, false otherwisesetBooleanAttribute(String, boolean)
,
isSelected()
public boolean isSelected()
setSelected(boolean)
,
HtmlElement.getBooleanAttribute(String)
protected java.lang.String genStartTag(int nOutputType)
Generates the start tag with all the attribute values that have been set for this object.
This method is used internally by the printHtml methods to generate the output strings.
genStartTag
in class HtmlElement
nOutputType
- the output typepublic void printHtml(java.io.PrintWriter objWriter, int nOutputType) throws java.io.IOException
printHtml
in class HtmlElement
objWriter
- the output stream for a Servlet objectnOutputType
- the output typejava.io.IOException
- if it cannot write the outputpublic void printHtml(javax.servlet.jsp.JspWriter objWriter, int nOutputType) throws java.io.IOException
printHtml
in class HtmlElement
objWriter
- the output stream for a Jsp pagenOutputType
- the output typejava.io.IOException
- if it cannot write the outputpublic void setBooleanAttribute(java.lang.String sAttribute, boolean bIsOn) throws InvalidAttributeException
Sets a html boolean-attribute for this object. The name of the attribute is case-insensitive.
setBooleanAttribute
in class HtmlElement
sName
- the name of the attributebIsOn
- true if attribute should be set, if false
is specified then the attribute is clearedInvalidAttributeException
- if the name is not valid
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |