de.mguennewig.pobjform.html
Class HtmlReferenceElement

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.HtmlReferenceElement
All Implemented Interfaces:
FormElement, HtmlFormElement, InputElement, ReferenceElement, ValueElement

public class HtmlReferenceElement
extends HtmlInputElement
implements ReferenceElement

An HTML implementation of a ReferenceElement.

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
HtmlReferenceElement(PObjHtmlForm form, InputEntry entry)
          Creates a new HtmlReferenceElement.
 
Method Summary
 java.lang.Object getInitialObject()
          Returns the initial object.
 java.lang.Object getObject()
          Returns the current object.
 boolean isStaticIfOneOption()
          Tests whether the input element will be rendered as static if the number of non-null options is exactly one.
 void setGroupBy(Member designator, boolean ascending)
          Group the set by the designator.
 void setObject(java.lang.Object obj)
          Sets the current object to the new value.
 void setRestriction(java.lang.Class<? extends PObject>[] tableClasses, Predicate[] filters)
          Restrict the set of values to an arbitrary subset of the entries of the referenced table.
 void setRestriction(ClassDecl[] tableExprs, Predicate[] filters)
          Restrict the set of values to an arbitrary subset of the entries of the referenced table.
 void setRestriction(Predicate filter)
          Restrict the set of values to an arbitrary subset of the entries of the referenced table.
 void setStaticIfOneOption(boolean staticIfOneOption)
          Sets whether the input element will be rendered as static if the number on non-null options is exactly one.
 void validate()
          Checks for a valid value in this form element and any possible children.
 
Methods inherited from class de.mguennewig.pobjform.html.HtmlInputElement
getCurrentString, getInitialString, hasChanged, read, setCurrentAsInitialState, setCurrentString, setInitialString, write, write, writeErrors
 
Methods inherited from class de.mguennewig.pobjform.AbstractInputElement
addChangeListener, getChangeListeners, getInputEntry, getRenderAs, getType, getVisualString, isHiddenInput, isMandatory, isRightAligned, isVisible, removeChangeListener, setMandatory, setRenderAs, setRightAligned, setVisible
 
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, getVisualString, isHiddenInput, isMandatory, isRightAligned, isVisible, removeChangeListener, setMandatory, setRenderAs, setRightAligned
 
Methods inherited from interface de.mguennewig.pobjform.ValueElement
getCurrentString, getInitialString, setCurrentAsInitialState
 
Methods inherited from interface de.mguennewig.pobjform.FormElement
appendToList, getContainer, getEntry, getForm, getLabel, getProperty, getPullInPrefix, hasChanged, isPulledIn, omitRowHeader, setLabel, setProperty, setPullInPrefix, setVisible, startsNewCell
 

Constructor Detail

HtmlReferenceElement

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

Method Detail

setGroupBy

public void setGroupBy(Member designator,
                       boolean ascending)
Group the set by the designator.

Specified by:
setGroupBy in interface ReferenceElement
See Also:
ReferenceElement.setRestriction(ClassDecl[],Predicate[]), Query.ASCENDING, Query.DESCENDING

setRestriction

public void setRestriction(Predicate filter)
Restrict the set of values to an arbitrary subset of the entries of the referenced table.

Specified by:
setRestriction in interface ReferenceElement
See Also:
ReferenceElement.setRestriction(ClassDecl[],Predicate[])

setRestriction

public void setRestriction(java.lang.Class<? extends PObject>[] tableClasses,
                           Predicate[] filters)
Restrict the set of values to an arbitrary subset of the entries of the referenced table.

Specified by:
setRestriction in interface ReferenceElement
See Also:
ReferenceElement.setRestriction(ClassDecl[],Predicate[])

setRestriction

public void setRestriction(ClassDecl[] tableExprs,
                           Predicate[] filters)
Restrict the set of values to an arbitrary subset of the entries of the referenced table.

By default the set of values is defined as part of the column which is used in the select box. The filter is used as part of the query that returns a list of values of the target table.

Specified by:
setRestriction in interface ReferenceElement
Parameters:
tableExprs - A list of table declarations that will be included in the query. The first element must be the declaration of the referenced table or null.
filters - A list of predicates to restrict the result set of the query or an empty list to clear any filter.
See Also:
Query

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 ReferenceElement
See Also:
ReferenceElement.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 ReferenceElement

validate

public void validate()
Checks for a valid value in this form element and any possible children.

Specified by:
validate in interface FormElement
Overrides:
validate in class AbstractInputElement

getInitialObject

public final java.lang.Object getInitialObject()
Returns the initial object.

Specified by:
getInitialObject in interface ValueElement
Overrides:
getInitialObject in class HtmlInputElement

getObject

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

Specified by:
getObject in interface ValueElement
Overrides:
getObject in class HtmlInputElement

setObject

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

Specified by:
setObject in interface ValueElement
Overrides:
setObject in class HtmlInputElement