to.etc.domui.dom.html
Class Select

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
All Implemented Interfaces:
java.lang.Iterable<NodeBase>, IModelBinding, INodeErrorDelegate, IHasChangeListener, IHasModifiedIndication
Direct Known Subclasses:
ComboComponentBase, SelectBasedControl

public class Select
extends InputNodeContainer
implements IHasModifiedIndication

INCOMPLETE A full-coded select box: this is unsuitable for large amount of options. Handling the selected item is incomplete.

Author:
Frits Jalvingh Created on Jul 11, 2008

Constructor Summary
Select()
           
Select(java.lang.String... txt)
           
 
Method Summary
 boolean acceptRequestParameter(java.lang.String[] values)
           
 void addExtraButton(java.lang.String img, java.lang.String title, IClicked<NodeBase> click)
          Add a small image button after the combo.
protected  void canContain(NodeBase node)
          Only allow SelectOption as child.
 void clearSelected()
          Deprecated. 
 SelectOption getOption(int ix)
           
 int getSelectedIndex()
           
 int getSize()
           
protected  boolean internalOnUserInput(int oldindex, int nindex)
          Called when user input has changed the selected index.
protected  void internalSetSelectedIndex(int ix)
          Fast way to set index without walking the option tree, to use if the subclass knows a faster way to set all option selected values.
 boolean isDisabled()
           
 boolean isModified()
          Returns the modified-by-user flag.
 boolean isMultiple()
           
 void onAddedToPage(Page p)
           
 void onRemoveFromPage(Page p)
           
 void setDisabled(boolean disabled)
           
 void setModified(boolean as)
          Set or clear the modified by user flag.
 void setMultiple(boolean multiple)
           
 void setReadOnly(boolean readOnly)
          WARNING: The "select" node HAS NO READONLY!!!
 void setSelectedIndex(int ix)
          Set the selected index - expensive because it has to walk all Option children and reset their selected attribute - O(n) runtime.
 void setSize(int size)
           
 void visit(INodeVisitor v)
          This must visit the appropriate method in the node visitor.
 
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, createContent, findComponentBundle, getActualID, getClicked, getComponentBundle, getCreateJS, getCssClass, getErrorDelegate, getErrorLocation, getMessage, getOnClickJS, getOnMouseDownJS, getPage, getParent, getParent, getParent, getSharedContext, getSpecialAttribute, getSpecialAttributeList, getTag, getTestID, getTitle, getUserObject, handleDrop, hasCssClass, hasError, 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
 

Constructor Detail

Select

public Select()

Select

public Select(java.lang.String... txt)
Method Detail

visit

public void visit(INodeVisitor v)
           throws java.lang.Exception
Description copied from class: NodeBase
This must visit the appropriate method in the node visitor. It should NOT recurse it's children.

Specified by:
visit in class InputNodeContainer
Throws:
java.lang.Exception

canContain

protected void canContain(NodeBase node)
Only allow SelectOption as child.

Overrides:
canContain in class NodeContainer
See Also:
NodeContainer.canContain(to.etc.domui.dom.html.NodeBase)

isMultiple

public boolean isMultiple()

setMultiple

public void setMultiple(boolean multiple)

isDisabled

public boolean isDisabled()

setDisabled

public void setDisabled(boolean disabled)

getSize

public int getSize()

setSize

public void setSize(int size)

setReadOnly

public void setReadOnly(boolean readOnly)
WARNING: The "select" node HAS NO READONLY!!!

Overrides:
setReadOnly in class InputNodeContainer
See Also:
InputNodeContainer.setReadOnly(boolean)

getOption

public SelectOption getOption(int ix)

acceptRequestParameter

public final boolean acceptRequestParameter(java.lang.String[] values)
                                     throws java.lang.Exception
Overrides:
acceptRequestParameter in class NodeBase
Throws:
java.lang.Exception

internalOnUserInput

protected boolean internalOnUserInput(int oldindex,
                                      int nindex)
Called when user input has changed the selected index.

Parameters:
oldindex -
nindex -

clearSelected

@Deprecated
public void clearSelected()
Deprecated. 

Dangerous interface for derived classes.


getSelectedIndex

public int getSelectedIndex()

internalSetSelectedIndex

protected void internalSetSelectedIndex(int ix)
Fast way to set index without walking the option tree, to use if the subclass knows a faster way to set all option selected values.

Parameters:
ix -

setSelectedIndex

public void setSelectedIndex(int ix)
Set the selected index - expensive because it has to walk all Option children and reset their selected attribute - O(n) runtime.

Parameters:
ix -

addExtraButton

public void addExtraButton(java.lang.String img,
                           java.lang.String title,
                           IClicked<NodeBase> click)
Add a small image button after the combo.

Parameters:
img -
title -
clicked -

onAddedToPage

public void onAddedToPage(Page p)
Overrides:
onAddedToPage in class NodeBase

onRemoveFromPage

public void onRemoveFromPage(Page p)
Overrides:
onRemoveFromPage in class NodeBase

isModified

public final boolean isModified()
Returns the modified-by-user flag.

Specified by:
isModified in interface IHasModifiedIndication
See Also:
IHasModifiedIndication.isModified()

setModified

public final void setModified(boolean as)
Set or clear the modified by user flag.

Specified by:
setModified in interface IHasModifiedIndication
See Also:
IHasModifiedIndication.setModified(boolean)