objectivehtml.htmlwidget
Class HtmlInput

java.lang.Object
  |
  +--objectivehtml.oms.OMSObject
        |
        +--objectivehtml.htmlwidget.HtmlElement
              |
              +--objectivehtml.htmlwidget.HtmlWidget
                    |
                    +--objectivehtml.htmlwidget.HtmlControlWidget
                          |
                          +--objectivehtml.htmlwidget.HtmlInput
Direct Known Subclasses:
HtmlCheckBox, HtmlFileInput, HtmlHiddenInput, HtmlPushButton, HtmlRadioButton, HtmlTextBox

public abstract class HtmlInput
extends HtmlControlWidget

This abstract class is the base class for all control widgets that use the "input" tag. i.e.

<input type="text" ... >

The class implements all the common functionality that all "input" objects have.

If auto-escape is turned on then the text set in the "value" attribute will be escaped before being written out by the HtmlUtils.htmlSpecialChars(String) method.

See Also:
getValue(), HtmlUtils.htmlSpecialChars(String)

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
HtmlInput(HtmlContainerWidget objParent, java.lang.String sName, java.lang.String sType, boolean bSkipNameValidation)
          Constructs an instance of the HtmlInput object.
 
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.
 java.lang.String getText()
          Alias for getValue().
 java.lang.String getType()
          Returns the type of this object.
 java.lang.String getValue()
          Returns the value of this object.
 void setAttribute(java.lang.String sAttribute, java.lang.String sValue)
          Sets a html attribute for this object.
 void setBooleanAttribute(java.lang.String sAttribute, boolean bIsOn)
          Sets a html boolean-attribute for this object.
 void setText(java.lang.String sText)
          Alias for setValue(String).
protected  void setType(java.lang.String sType)
          Sets the type of this object.
 void setValue(java.lang.String sValue)
          Sets the value for this input object.
 Signal valueChanged(java.lang.String sNewValue, java.lang.String sOldValue)
          This signal is emitted when the "value" attribute of this object is changed.
 
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, updateData
 
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

HtmlInput

public HtmlInput(HtmlContainerWidget objParent,
                 java.lang.String sName,
                 java.lang.String sType,
                 boolean bSkipNameValidation)
          throws InvalidControlNameException,
                 InvalidParentWidgetException,
                 InvalidChildWidgetException
Constructs an instance of the HtmlInput object.
Parameters:
objParent - the parent of this widget
sName - the unique control name for the object
sType - can be a string value of the following control types: text|password|checkbox|radio|submit|reset|file|hidden|image|button
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

getType

public java.lang.String getType()
Returns the type of this object.
Returns:
the type of this object
See Also:
HtmlElement.getAttribute(String), setType(String)

setType

protected void setType(java.lang.String sType)

Sets the type of this object. The type will determine the type of "input" object this will become.

This is a protected method and should remain so. T

he html attribute it sets is "type".

If null is specified the attribute is cleared.

Parameters:
sType - the type for this element
See Also:
setAttribute(String, String), getType()

getText

public java.lang.String getText()
Alias for getValue().
Returns:
the text of this input object
See Also:
getValue(), setText(String)

setText

public void setText(java.lang.String sText)
Alias for setValue(String).
Parameters:
sText - the text for this input object
See Also:
setValue(String), getText()

getValue

public java.lang.String getValue()
Returns the value of this object.
Returns:
the value for this element, null is returned if the attribute is not set
See Also:
setValue(String), HtmlElement.getAttribute(String)

setValue

public void setValue(java.lang.String sValue)

Sets the value for this input object.

The html attribute it sets is "value".

If null is specified the attribute is cleared.

Parameters:
sValue - the value for this element
See Also:
setAttribute(String, String), getValue()

setAttribute

public void setAttribute(java.lang.String sAttribute,
                         java.lang.String sValue)
                  throws InvalidAttributeException

Sets a html attribute for this object. The name of the attribute is case-insensitive.

Calls parent version of the method but stops the "type" attribute being changed! If "type" is specified then an InvalidAttributeException is thrown.

Overrides:
setAttribute in class HtmlControlWidget
Parameters:
sName - the name of the attribute
sValue - the value of the attribute, if null is specified then the attribute will be cleared
Throws:
InvalidAttributeException - if the name is not valid
See Also:
setBooleanAttribute(String, boolean)

setBooleanAttribute

public 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.

Calls parent version of the method but stops the "type" attribute being changed! If "type" is specified then an InvalidAttributeException is thrown.

Overrides:
setBooleanAttribute in class HtmlControlWidget
Parameters:
sName - the name of the attribute
bIsOn - true if attribute should be set, if false is specified then the attribute is cleared
Throws:
InvalidAttributeException - if the name is not valid
See Also:
setAttribute(String, String)

genStartTag

protected java.lang.String genStartTag(int nOutputType)

Generates the start tag with all the attribute values that have been set for this object.

If auto-escape is turned on then the text set in the "value" attribute will be escaped before being written out by the HtmlUtils.htmlSpecialChars(String) method.

Overrides:
genStartTag in class HtmlElement
Parameters:
nOutputType - the output type
See Also:
HtmlControlWidget.isAutoEscape(), getValue(), HtmlUtils.htmlSpecialChars(String)

valueChanged

public Signal valueChanged(java.lang.String sNewValue,
                           java.lang.String sOldValue)
This signal is emitted when the "value" attribute of this object is changed.
Parameters:
sNewValue - the new value
sOldValue - the old value
Returns:
the signal object for this signal event