de.mguennewig.pobjform
Class AbstractInputElement

java.lang.Object
  extended by de.mguennewig.pobjform.AbstractFormElement
      extended by de.mguennewig.pobjform.AbstractValueElement
          extended by de.mguennewig.pobjform.AbstractInputElement
All Implemented Interfaces:
FormElement, InputElement, ValueElement
Direct Known Subclasses:
HtmlInputElement, SwingInputElement

public abstract class AbstractInputElement
extends AbstractValueElement
implements InputElement

Abstract implementation of an input element.

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
AbstractInputElement(PObjForm form, InputEntry entry)
          Creates a new AbstractInputElement.
 
Method Summary
 void addChangeListener(javax.swing.event.ChangeListener l)
          Adds a listener for change events for this element.
 javax.swing.event.ChangeListener[] getChangeListeners()
           
 InputEntry getInputEntry()
          
 java.lang.Object getObject()
          Returns the current object.
 int getRenderAs()
          
 Type getType()
          
 java.lang.String getVisualString()
          Returns the human readable textual representation of the current value.
 boolean isHiddenInput()
          Tests whether this input element is hidden.
 boolean isMandatory()
          Tests whether data for this element must be entered.
 boolean isRightAligned()
          Returns whether the data will be right aligned.
 boolean isVisible()
          Tests whether this input element is hidden.
 void removeChangeListener(javax.swing.event.ChangeListener l)
          Removed a previously added listener for change events.
 void setMandatory(boolean mandatory)
          
 void setObject(java.lang.Object obj)
          Sets the current object to the new value.
 void setRenderAs(int renderAs)
          
 void setRightAligned(boolean rightAligned)
          Sets whether the data should be right aligned.
 void setVisible(boolean visible)
          Sets whether this element will be written visibly.
 void validate()
          Checks for a valid value in this form element and any possible children.
 
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.ValueElement
getCurrentString, getInitialObject, getInitialString, setCurrentAsInitialState
 
Methods inherited from interface de.mguennewig.pobjform.FormElement
appendToList, getContainer, getEntry, getForm, getLabel, getProperty, getPullInPrefix, hasChanged, isPulledIn, omitRowHeader, setLabel, setProperty, setPullInPrefix, startsNewCell
 

Constructor Detail

AbstractInputElement

public AbstractInputElement(PObjForm form,
                            InputEntry entry)
Creates a new AbstractInputElement.

Method Detail

addChangeListener

public final void addChangeListener(javax.swing.event.ChangeListener l)
Adds a listener for change events for this element.

Specified by:
addChangeListener in interface InputElement

removeChangeListener

public final void removeChangeListener(javax.swing.event.ChangeListener l)
Removed a previously added listener for change events.

If the given listener is not registered anymore this method will do nothing.

Specified by:
removeChangeListener in interface InputElement

getChangeListeners

public final javax.swing.event.ChangeListener[] getChangeListeners()

getObject

public java.lang.Object getObject()
Returns the current object.

Specified by:
getObject in interface ValueElement

setObject

public void setObject(java.lang.Object obj)
Sets the current object to the new value.

Specified by:
setObject in interface ValueElement

getInputEntry

public final InputEntry getInputEntry()

Specified by:
getInputEntry in interface InputElement

getType

public final Type getType()

Specified by:
getType in interface InputElement

getRenderAs

public final int getRenderAs()

Specified by:
getRenderAs in interface InputElement

setRenderAs

public void setRenderAs(int renderAs)

Specified by:
setRenderAs in interface InputElement

isMandatory

public final boolean isMandatory()
Tests whether data for this element must be entered.

Specified by:
isMandatory in interface FormElement
Specified by:
isMandatory in interface InputElement

setMandatory

public void setMandatory(boolean mandatory)

Specified by:
setMandatory in interface InputElement

isRightAligned

public final boolean isRightAligned()
Returns whether the data will be right aligned.

Specified by:
isRightAligned in interface InputElement

setRightAligned

public void setRightAligned(boolean rightAligned)
Sets whether the data should be right aligned.

Specified by:
setRightAligned in interface InputElement

isVisible

public final boolean isVisible()
Tests whether this input element is hidden.

The value RENDER_AS_HIDDEN_WITH_LABEL is classified as visible.

Specified by:
isVisible in interface FormElement
Specified by:
isVisible in interface InputElement

setVisible

public final void setVisible(boolean visible)
Sets whether this element will be written visibly.

Specified by:
setVisible in interface FormElement
See Also:
setRenderAs(int), InputElement.RENDER_AS_INPUT, InputElement.RENDER_AS_HIDDEN

isHiddenInput

public final boolean isHiddenInput()
Tests whether this input element is hidden.

RENDER_AS_HIDDEN_WITH_LABEL is classified as invisible.

Specified by:
isHiddenInput in interface InputElement

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

validate

public void validate()
Description copied from interface: FormElement
Checks for a valid value in this form element and any possible children.

Specified by:
validate in interface FormElement