de.mguennewig.pobjform.html
Class HtmlStringElement

java.lang.Object
  extended by de.mguennewig.pobjform.AbstractFormElement
      extended by de.mguennewig.pobjform.AbstractValueElement
          extended by de.mguennewig.pobjform.AbstractInputElement
              extended by de.mguennewig.pobjform.html.HtmlInputElement
                  extended by de.mguennewig.pobjform.html.HtmlStringElement
All Implemented Interfaces:
FormElement, HtmlFormElement, InputElement, StringElement, ValueElement

public class HtmlStringElement
extends HtmlInputElement
implements StringElement

Class description goes here.

Author:
Michael Günnewig

Field Summary
 
Fields inherited from interface de.mguennewig.pobjform.InputElement
MAX_INPUT_SIZE, RENDER_AS_DISABLED, RENDER_AS_HIDDEN, RENDER_AS_HIDDEN_WITH_LABEL, RENDER_AS_INPUT, RENDER_AS_TEXT
 
Constructor Summary
HtmlStringElement(PObjHtmlForm form, InputEntry entry)
          Creates a new HtmlStringElement.
 
Method Summary
 int getMaxLength()
           
 MapItem[] getRestrictTo()
          Returns the current allowed set of values.
 int getSize()
           
 java.lang.String getVisualString()
          Returns the human readable textual representation of the current value.
 boolean isStaticIfOneOption()
          Tests whether the input element will be rendered as static if the number of non-null options is exactly one.
 void read(javax.servlet.http.HttpServletRequest request)
          Reads the internal state from the HTTP request.
 boolean removeOption(java.lang.Object value)
          Removes the given option from the current set of allowed values.
 void setMaxLength(int maxLength)
           
 void setRestrictTo(MapItem[] restrictTo)
          Sets the set of allowed values.
 void setSize(int size)
           
 void setStaticIfOneOption(boolean staticIfOneOption)
          Sets whether the input element will be rendered as static if the number on non-null options is exactly one.
 
Methods inherited from class de.mguennewig.pobjform.html.HtmlInputElement
getCurrentString, getInitialObject, getInitialString, getObject, hasChanged, setCurrentAsInitialState, setCurrentString, setInitialString, setObject, write, write, writeErrors
 
Methods inherited from class de.mguennewig.pobjform.AbstractInputElement
addChangeListener, getChangeListeners, getInputEntry, getRenderAs, getType, isHiddenInput, isMandatory, isRightAligned, isVisible, removeChangeListener, setMandatory, setRenderAs, setRightAligned, setVisible, validate
 
Methods inherited from class de.mguennewig.pobjform.AbstractFormElement
appendToList, getContainer, getEntry, getForm, getLabel, getProperty, getPullInPrefix, isPulledIn, omitRowHeader, setLabel, setProperty, setPullInPrefix, startsNewCell
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface de.mguennewig.pobjform.InputElement
addChangeListener, getInputEntry, getRenderAs, getType, isHiddenInput, isMandatory, isRightAligned, isVisible, removeChangeListener, setMandatory, setRenderAs, setRightAligned
 
Methods inherited from interface de.mguennewig.pobjform.ValueElement
getCurrentString, getInitialObject, getInitialString, getObject, setCurrentAsInitialState, setObject
 
Methods inherited from interface de.mguennewig.pobjform.FormElement
appendToList, getContainer, getEntry, getForm, getLabel, getProperty, getPullInPrefix, hasChanged, isPulledIn, omitRowHeader, setLabel, setProperty, setPullInPrefix, setVisible, startsNewCell, validate
 

Constructor Detail

HtmlStringElement

public HtmlStringElement(PObjHtmlForm form,
                         InputEntry entry)
Creates a new HtmlStringElement.

Method Detail

getSize

public final int getSize()
Specified by:
getSize in interface StringElement

setSize

public void setSize(int size)
Specified by:
setSize in interface StringElement

getMaxLength

public final int getMaxLength()
Specified by:
getMaxLength in interface StringElement

setMaxLength

public void setMaxLength(int maxLength)
Specified by:
setMaxLength in interface StringElement

getRestrictTo

public final MapItem[] getRestrictTo()
Description copied from interface: StringElement
Returns the current allowed set of values.

Specified by:
getRestrictTo in interface StringElement

setRestrictTo

public void setRestrictTo(MapItem[] restrictTo)
Description copied from interface: StringElement
Sets the set of allowed values.

This only restricts the visual options by using a selection box with these values.

Specified by:
setRestrictTo in interface StringElement

removeOption

public boolean removeOption(java.lang.Object value)
Removes the given option from the current set of allowed values.

Specified by:
removeOption in interface StringElement
Returns:
true if the value has been found in the current set of allowed values and removed, otherwise false.
See Also:
StringElement.getRestrictTo(), StringElement.setRestrictTo(MapItem[])

getVisualString

public java.lang.String getVisualString()
Returns the human readable textual representation of the current value.

This is the value used to write the current value into the UI element. It is never null.

Specified by:
getVisualString in interface InputElement
Overrides:
getVisualString in class AbstractInputElement

read

public final void read(javax.servlet.http.HttpServletRequest request)
Reads the internal state from the HTTP request.

Specified by:
read in interface HtmlFormElement
Overrides:
read in class HtmlInputElement

isStaticIfOneOption

public final boolean isStaticIfOneOption()
Tests whether the input element will be rendered as static if the number of non-null options is exactly one.

Specified by:
isStaticIfOneOption in interface StringElement
See Also:
StringElement.setStaticIfOneOption(boolean)

setStaticIfOneOption

public void setStaticIfOneOption(boolean staticIfOneOption)
Sets whether the input element will be rendered as static if the number on non-null options is exactly one.

Specified by:
setStaticIfOneOption in interface StringElement