to.etc.domui.component.input
Class ComboComponentBase<T,V>

java.lang.Object
  extended by to.etc.domui.dom.css.CssBase
      extended by to.etc.domui.dom.html.NodeBase
          extended by to.etc.domui.dom.html.NodeContainer
              extended by to.etc.domui.dom.html.InputNodeContainer
                  extended by to.etc.domui.dom.html.Select
                      extended by to.etc.domui.component.input.ComboComponentBase<T,V>
All Implemented Interfaces:
java.lang.Iterable<NodeBase>, IModelBinding, IBindable, INodeErrorDelegate, IActionControl, IControl<V>, IDisplayControl<V>, IHasChangeListener, IHasModifiedIndication, IInputNode<V>
Direct Known Subclasses:
ComboFixed, ComboLookup

public class ComboComponentBase<T,V>
extends Select
implements IInputNode<V>, IHasModifiedIndication


Constructor Summary
ComboComponentBase()
           
ComboComponentBase(java.lang.Class<? extends IComboDataSet<T>> dataSetClass)
           
ComboComponentBase(java.lang.Class<? extends IComboDataSet<T>> set, INodeContentRenderer<T> r)
           
ComboComponentBase(IComboDataSet<T> dataSet)
           
ComboComponentBase(IListMaker<T> maker)
           
ComboComponentBase(java.util.List<T> in)
           
ComboComponentBase(QCriteria<T> query)
           
 
Method Summary
 IBinder bind()
          Return the binder for this control.
 void createContent()
          Render the actual combobox.
 INodeContentRenderer<T> getContentRenderer()
           
 java.lang.Class<? extends INodeContentRenderer<T>> getContentRendererClass()
           
 java.util.List<T> getData()
          Returns the data to use as the list-of-values of this combo.
protected  SelectOption getEmptyOption()
          If this combobox has a "unselected" option currently this contains that option.
 java.lang.String getEmptyText()
           
 IListMaker<T> getListMaker()
           
 PropertyMetaModel<?> getPropertyMetaModel()
           
 V getValue()
          Returns the current value of this input component.
 V getValueSafe()
          Like IDisplayControl.getValue() this returns the value of the component, but this returns null if the value was invalid.
 IValueTransformer<V> getValueTransformer()
           
 boolean hasError()
          Return T if this node currently has an error associated with it.
protected  V internalGetCurrentValue()
           
protected  boolean internalOnUserInput(int oldindex, int nindex)
          The user selected a different option.
protected  void internalSetCurrentValue(V val)
           
 boolean isBound()
          Returns T if this control is bound to some data value.
protected  V listToValue(T in)
           
protected  java.util.List<T> provideData()
          Creates the list-of-values that is to be used if no specific lov is set using setData().
protected  void renderOptionLabel(SelectOption o, T object)
           
 void setContentRenderer(INodeContentRenderer<T> contentRenderer)
           
 void setContentRendererClass(java.lang.Class<? extends INodeContentRenderer<T>> contentRendererClass)
           
 void setData(java.util.List<T> data)
          Can be used to set a specific list-of-values.
protected  void setEmptyOption(SelectOption emptyOption)
          See getter.
 void setEmptyText(java.lang.String emptyText)
           
 void setListMaker(IListMaker<T> listMaker)
           
 void setPropertyMetaModel(PropertyMetaModel<?> propertyMetaModel)
           
 void setValue(V v)
          Set the combo to the specified value.
 void setValueTransformer(IValueTransformer<V> valueTransformer)
           
 
Methods inherited from class to.etc.domui.dom.html.Select
acceptRequestParameter, addExtraButton, canContain, clearSelected, getOption, getSelectedIndex, getSize, internalSetSelectedIndex, isDisabled, isModified, isMultiple, onAddedToPage, onRemoveFromPage, setDisabled, setModified, setMultiple, setReadOnly, setSelectedIndex, setSize, visit
 
Methods inherited from class to.etc.domui.dom.html.InputNodeContainer
callOnValueChanged, getOnValueChanged, isMandatory, isReadOnly, setMandatory, setOnValueChanged
 
Methods inherited from class to.etc.domui.dom.html.NodeContainer
add, add, add, addTable, delegateTo, findChildIndex, forceRebuild, getChild, getChildCount, getChildren, getDeepChild, getDeepChildren, getErrorFence, internalCheckNotDirty, internalClearDelta, internalClearDeltaFully, internalGetOldChildren, internalShelve, internalUnshelve, iterator, moveControlToModel, moveModelToControl, onRefresh, removeAllChildren, removeChild, removeChild, replaceChild, setControlsEnabled, setErrorFence, setErrorFence, setText, setValue
 
Methods inherited from class to.etc.domui.dom.html.NodeBase
$, addCssClass, addGlobalMessage, afterCreateContent, appendAfterMe, appendBeforeMe, appendCreateJS, appendJavascript, build, changed, clearFocusRequested, clearGlobalMessage, clearGlobalMessage, clearGlobalMessage, clearMessage, componentHandleWebAction, findComponentBundle, getActualID, getClicked, getComponentBundle, getCreateJS, getCssClass, getErrorDelegate, getErrorLocation, getMessage, getOnClickJS, getOnMouseDownJS, getPage, getParent, getParent, getParent, getSharedContext, getSpecialAttribute, getSpecialAttributeList, getTag, getTestID, getTitle, getUserObject, handleDrop, hasCssClass, internalGetOldParent, internalHasChangedAttributes, internalNeedClickHandler, internalOnClicked, internalSetHasChangedAttributes, internalSetHasChangedAttributes, internalSetTag, isBuilt, isFocusRequested, onBeforeFullRender, onForceRebuild, onHeaderContributors, onShelve, onUnshelve, refresh, remove, removeCssClass, renderJavascriptState, replaceWith, setClicked, setComponentBundle, setCssClass, setErrorDelegate, setErrorLocation, setFocus, setMessage, setOnClickJS, setOnMouseDownJS, setSpecialAttribute, setTestID, setTitle, setUserObject, stretchHeight, toString
 
Methods inherited from class to.etc.domui.dom.css.CssBase
getBackgroundAttachment, getBackgroundColor, getBackgroundImage, getBackgroundPosition, getBackgroundRepeat, getBorderBottomColor, getBorderBottomStyle, getBorderBottomWidth, getBorderLeftColor, getBorderLeftStyle, getBorderLeftWidth, getBorderRightColor, getBorderRightStyle, getBorderRightWidth, getBorderTopColor, getBorderTopStyle, getBorderTopWidth, getBottom, getCachedStyle, getClear, getColor, getDisplay, getFloat, getFontFamily, getFontSize, getFontSizeAdjust, getFontStyle, getFontVariant, getFontWeight, getHeight, getLeft, getLineHeight, getMarginBottom, getMarginLeft, getMarginRight, getMarginTop, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getOverflow, getPosition, getRight, getTextAlign, getTop, getTransform, getVerticalAlign, getVisibility, getWidth, getZIndex, internalSetDisplay, setBackgroundAttachment, setBackgroundColor, setBackgroundImage, setBackgroundPosition, setBackgroundRepeat, setBorder, setBorder, setBorderBottomColor, setBorderBottomStyle, setBorderBottomWidth, setBorderColor, setBorderLeftColor, setBorderLeftStyle, setBorderLeftWidth, setBorderRightColor, setBorderRightStyle, setBorderRightWidth, setBorderStyle, setBorderTopColor, setBorderTopStyle, setBorderTopWidth, setBorderWidth, setBottom, setBottom, setCachedStyle, setClear, setColor, setDisplay, setFloat, setFontFamily, setFontSize, setFontSizeAdjust, setFontStyle, setFontVariant, setFontWeight, setHeight, setLeft, setLeft, setLineHeight, setMargin, setMarginBottom, setMarginLeft, setMarginRight, setMarginTop, setMaxHeight, setMaxWidth, setMinHeight, setMinWidth, setOverflow, setPosition, setRight, setRight, setTextAlign, setTop, setTop, setTransform, setVerticalAlign, setVisibility, setWidth, setZIndex
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface to.etc.domui.dom.html.IControl
getErrorLocation, isDisabled, isMandatory, isReadOnly, setErrorLocation, setMandatory, setReadOnly
 
Methods inherited from interface to.etc.domui.dom.html.IDisplayControl
setTestID
 
Methods inherited from interface to.etc.domui.dom.html.IActionControl
setDisabled, setTestID
 
Methods inherited from interface to.etc.domui.dom.html.IHasChangeListener
getOnValueChanged, setOnValueChanged
 
Methods inherited from interface to.etc.domui.dom.errors.INodeErrorDelegate
clearMessage, getMessage, setMessage
 
Methods inherited from interface to.etc.domui.dom.html.IHasModifiedIndication
isModified, setModified
 

Constructor Detail

ComboComponentBase

public ComboComponentBase()

ComboComponentBase

public ComboComponentBase(IListMaker<T> maker)

ComboComponentBase

public ComboComponentBase(IComboDataSet<T> dataSet)

ComboComponentBase

public ComboComponentBase(QCriteria<T> query)

ComboComponentBase

public ComboComponentBase(java.lang.Class<? extends IComboDataSet<T>> dataSetClass)

ComboComponentBase

public ComboComponentBase(java.util.List<T> in)

ComboComponentBase

public ComboComponentBase(java.lang.Class<? extends IComboDataSet<T>> set,
                          INodeContentRenderer<T> r)
Method Detail

createContent

public void createContent()
                   throws java.lang.Exception
Render the actual combobox. This renders the value domain as follows: Fixes bug# 790.

Overrides:
createContent in class NodeBase
Throws:
java.lang.Exception

getValue

public final V getValue()
Description copied from interface: IDisplayControl
Returns the current value of this input component. If the component contains no value this returns null. All text input components will return null when their value is the empty string! If the component, during conversion or validation of the input value, discovers that the input is invalid it will set itself in "error" mode, post an error message up the form, and throw a ValidationException. This means that this call either delivers correct input (as defined by it's converter and validators), null (when empty) or throws an exception. When a ValidationException occurs the framework mostly ignores it - it does not produce a stacktrace or error in the client. Instead the resulting error as posted by the error handling framework gets displayed on the form when the request completes.

To get the value of a component while ignoring exceptions call #getValueSafe().

Specified by:
getValue in interface IDisplayControl<V>
Returns:
See Also:
IDisplayControl.getValue()

setValue

public final void setValue(V v)
Set the combo to the specified value. The value must be in the domain specified by the data list and must be findable in that list; if not the results are undefined. If the value set is null and the combobox is a mandatory one the code will check if an "unselected" item is present to select. If not the unselected item will be added by this call(!).

Specified by:
setValue in interface IDisplayControl<V>
See Also:
IDisplayControl.setValue(java.lang.Object)

internalOnUserInput

protected boolean internalOnUserInput(int oldindex,
                                      int nindex)
The user selected a different option.

Overrides:
internalOnUserInput in class Select
See Also:
Select.internalOnUserInput(int, int)

listToValue

protected V listToValue(T in)
                 throws java.lang.Exception
Parameters:
in -
Returns:
Throws:
java.lang.Exception

renderOptionLabel

protected void renderOptionLabel(SelectOption o,
                                 T object)
                          throws java.lang.Exception
Throws:
java.lang.Exception

setData

public void setData(java.util.List<T> data)
Can be used to set a specific list-of-values. When called this clears the existing dataset.

Parameters:
data -

getData

public java.util.List<T> getData()
                          throws java.lang.Exception
Returns the data to use as the list-of-values of this combo. This must contain actual selectable values only, it may not contain a "no selection made" value thingerydoo.

Returns:
Throws:
java.lang.Exception

provideData

protected java.util.List<T> provideData()
                                 throws java.lang.Exception
Creates the list-of-values that is to be used if no specific lov is set using setData(). The default implementation walks the data providers to see if one is present.

Returns:
Throws:
java.lang.Exception

getValueSafe

public V getValueSafe()
Description copied from interface: IControl
Like IDisplayControl.getValue() this returns the value of the component, but this returns null if the value was invalid. For this method NULL either means the value was invalid OR it's content was empty. To distinguish between the two call IControl.hasError() or use IDisplayControl.getValue() instead of this call.

Specified by:
getValueSafe in interface IControl<V>
Returns:
See Also:
IControl.getValueSafe()

hasError

public boolean hasError()
Description copied from class: NodeBase
Return T if this node currently has an error associated with it.

Specified by:
hasError in interface IControl<V>
Overrides:
hasError in class NodeBase
Returns:
See Also:
IControl.hasError()

bind

public IBinder bind()
Return the binder for this control.

Specified by:
bind in interface IBindable
Returns:
See Also:
IBindable.bind()

isBound

public boolean isBound()
Returns T if this control is bound to some data value.

Specified by:
isBound in interface IBindable
Returns:
See Also:
IBindable.isBound()

getContentRenderer

public INodeContentRenderer<T> getContentRenderer()

setContentRenderer

public void setContentRenderer(INodeContentRenderer<T> contentRenderer)

getContentRendererClass

public java.lang.Class<? extends INodeContentRenderer<T>> getContentRendererClass()

setContentRendererClass

public void setContentRendererClass(java.lang.Class<? extends INodeContentRenderer<T>> contentRendererClass)

getPropertyMetaModel

public PropertyMetaModel<?> getPropertyMetaModel()

setPropertyMetaModel

public void setPropertyMetaModel(PropertyMetaModel<?> propertyMetaModel)

getListMaker

public IListMaker<T> getListMaker()

setListMaker

public void setListMaker(IListMaker<T> listMaker)

getValueTransformer

public IValueTransformer<V> getValueTransformer()

setValueTransformer

public void setValueTransformer(IValueTransformer<V> valueTransformer)

getEmptyText

public java.lang.String getEmptyText()

setEmptyText

public void setEmptyText(java.lang.String emptyText)

getEmptyOption

protected SelectOption getEmptyOption()
If this combobox has a "unselected" option currently this contains that option. When present it means that indexes in the combo list are one higher than indexes in the backing dataset (because this empty option is always choice# 0).

Returns:

setEmptyOption

protected void setEmptyOption(SelectOption emptyOption)
See getter.

Parameters:
emptyOption -

internalGetCurrentValue

protected V internalGetCurrentValue()

internalSetCurrentValue

protected void internalSetCurrentValue(V val)