objectivehtml.htmlwidget
Class HtmlTextBox

java.lang.Object
  |
  +--objectivehtml.oms.OMSObject
        |
        +--objectivehtml.htmlwidget.HtmlElement
              |
              +--objectivehtml.htmlwidget.HtmlWidget
                    |
                    +--objectivehtml.htmlwidget.HtmlControlWidget
                          |
                          +--objectivehtml.htmlwidget.HtmlInput
                                |
                                +--objectivehtml.htmlwidget.HtmlTextBox

public class HtmlTextBox
extends HtmlInput

This class represents a html text box. i.e.

<input type="text|password" ...>

This widget allows users to enter textual data. Its similar to the HtmlTextArea but differs in that it only offers one line of data entry. You can specify the size of the object by setting the "size" attribute. You can specify the maximum number of characters that can be entered by setting the "maxlength" attribute.

The widget offers a normal text mode (default) and a password mode. In password mode all characters typed into the data area are shadowed with an asterix character '*'.

Both the HtmlTextArea and this class support the read-only mode. This can be used to display text that is not be modifiable.

The widget emits these signals:

See Also:
HtmlTextArea

Fields inherited from class objectivehtml.htmlwidget.HtmlControlWidget
m_bAutoEscape, m_bAutoUpdate
 
Fields inherited from class objectivehtml.htmlwidget.HtmlWidget
m_bDestroyed, m_bVisible, m_objHtmlForm, m_objParentWidget
 
Fields inherited from class objectivehtml.htmlwidget.HtmlElement
m_hmAttributes, m_sEndTag, m_sQuoteType, m_sStartTag
 
Constructor Summary
HtmlTextBox(HtmlContainerWidget objParent, java.lang.String sName)
          Constructs a new instance of HtmlTextBox with the specified parent and control name.
 
Method Summary
 java.lang.String getMaxLength()
          Returns the maximum length of the text box.
 java.lang.String getSize()
          Returns the size of the text box.
 boolean isPassword()
          Returns whether the text box is in password mode.
 boolean isReadOnly()
          Returns true if the text box is in read-only mode, false otherwise
 void setMaxLength(java.lang.String sMaxLength)
          Sets the maximum length of the text box.
 void setPassword(boolean bPassword)
          Sets the text box to be in password-mode or text-mode.
 void setReadOnly(boolean bReadOnly)
          Sets the text box to be either read-only or read-write mode.
 void setSize(java.lang.String sSize)
          Sets the size of the text box.
 void updateData(javax.servlet.http.HttpServletRequest objRequest)
          Updates this object with the data submitted from the client.
 
Methods inherited from class objectivehtml.htmlwidget.HtmlInput
genStartTag, getText, getType, getValue, setAttribute, setBooleanAttribute, setText, setType, setValue, valueChanged
 
Methods inherited from class objectivehtml.htmlwidget.HtmlControlWidget
dataSubmitted, dataSubmitted, destroy, getName, getOnBlur, getOnChange, getOnFocus, getOnSelect, getSubmittedData, getSubmittedDataSet, getTabIndex, getUpdateOrder, isAutoEscape, isAutoUpdate, isDisabled, printHtml, printHtml, setAutoEscape, setAutoUpdate, setDisabled, setOnBlur, setOnChange, setOnFocus, setOnSelect, setTabIndex, setUpdateOrder, setVisible
 
Methods inherited from class objectivehtml.htmlwidget.HtmlWidget
changeParent, changeParent, getClassAttribute, getHtmlForm, getID, getOnClick, getOnDblClick, getOnKeyDown, getOnKeyPress, getOnKeyUp, getOnMouseDown, getOnMouseMove, getOnMouseOut, getOnMouseOver, getOnMouseUp, getParent, getStyle, isDestroyed, isVisible, setClassAttribute, setID, setOnClick, setOnDblClick, setOnKeyDown, setOnKeyPress, setOnKeyUp, setOnMouseDown, setOnMouseMove, setOnMouseOut, setOnMouseOver, setOnMouseUp, setStyle
 
Methods inherited from class objectivehtml.htmlwidget.HtmlElement
genEndTag, genStartTag, getAttribute, getAttributes, getBooleanAttribute, getQuoteType, printHtml, printHtml, printHtml, printHtml, printHtml, printHtml, 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

HtmlTextBox

public HtmlTextBox(HtmlContainerWidget objParent,
                   java.lang.String sName)
            throws InvalidControlNameException,
                   InvalidParentWidgetException,
                   InvalidChildWidgetException
Constructs a new instance of HtmlTextBox with the specified parent and control name.
Parameters:
objParent - the parent of this widget
sName - the unique control name for the object
Throws:
InvalidControlNameException - if the control name is not valid
InvalidParentWidgetException - if the specified parent widget is not valid
InvalidChildWidgetException - if the parent widget does not accept this widget as a child
Method Detail

setPassword

public void setPassword(boolean bPassword)
Sets the text box to be in password-mode or text-mode. In password-mode all characters are shadowed with an asterix character '*'.
Parameters:
bPassword - true if password-mode, false if text-mode
See Also:
isPassword()

isPassword

public boolean isPassword()
Returns whether the text box is in password mode.
Returns:
true if in password-mode, false if in text-mode
See Also:
setPassword(boolean)

getSize

public java.lang.String getSize()
Returns the size of the text box.
Returns:
the size of the text box
See Also:
setSize(String)

setSize

public void setSize(java.lang.String sSize)

Sets the size of the text box. The width of the text box will be based on the size specified. This will depend on each browser, but generally the actual width will be determined by multiplying the pixel width of a standard character with the size specified.

The html attribute it sets is "size".

If null is specified the attribute is cleared.

Parameters:
sSize - the size for this widget, if null is specified then this attribute will be cleared
See Also:
getSize()

getMaxLength

public java.lang.String getMaxLength()
Returns the maximum length of the text box.
Returns:
the maximum length of the text box
See Also:
setMaxLength(String)

setMaxLength

public void setMaxLength(java.lang.String sMaxLength)

Sets the maximum length of the text box. When this attribute is set then the text box is limited to only having at most this number of characters. If this attribute is not set then there is no limit on the number of characters than can be entered.

The html attribute it sets is "maxlength".

If null is specified the attribute is cleared.

Parameters:
sMaxLength - the maxlength for this widget, if null is specified then this attribute will be cleared
See Also:
getMaxLength()

setReadOnly

public void setReadOnly(boolean bReadOnly)

Sets the text box to be either read-only or read-write mode. In read-only mode the text area becomes unmodifiable.

The html attribute it sets is "readonly".

If false is specified the attribute is cleared.

Parameters:
bReadOnly - true if read-only, false if read-write
See Also:
HtmlInput.setBooleanAttribute(String, boolean), isReadOnly()

isReadOnly

public boolean isReadOnly()
Returns true if the text box is in read-only mode, false otherwise
Returns:
true if read-only, false if read-write
See Also:
HtmlElement.getBooleanAttribute(String), setReadOnly(boolean)

updateData

public void updateData(javax.servlet.http.HttpServletRequest objRequest)

Updates this object with the data submitted from the client. It will update the text (using setText(String)) of this object with the data submitted.

The object will only be updated if the auto-update is on and if the object is visible and not disabled and not in read-only mode.

Overrides:
updateData in class HtmlControlWidget
Parameters:
objRequest - the request object that contains the user submitted data
See Also:
HtmlInput.getText(), HtmlWidget.isVisible(), HtmlControlWidget.isDisabled(), HtmlControlWidget.isAutoUpdate(), HtmlControlWidget.getSubmittedData(HttpServletRequest)