com.alkacon.geranium.client.ui.input
public class SelectBox extends A_SelectBox<LabelSelectCell> implements I_HasInit, I_HasGhostValue
A_SelectBox.I_SelectBoxUiBindercom.google.gwt.user.client.ui.UIObject.DebugIdImpl, com.google.gwt.user.client.ui.UIObject.DebugIdImplEnabledI_FormWidget.FieldType| Modifier and Type | Field and Description |
|---|---|
protected Label |
m_openerWidget
The widget displayed in the opener.
|
static java.lang.String |
NO_SELECTION_TEXT
The key for the text which should be displayed if no option is available.
|
CSS, m_error, m_eventBus, m_openClose, m_opener, m_panel, m_popup, m_selectBoxState, m_selectCells, m_selectedValue, m_selector, m_selectorState| Constructor and Description |
|---|
SelectBox()
Default constructor.
|
SelectBox(java.util.Map<java.lang.String,java.lang.String> items)
Constructs a new select box from a map.
|
SelectBox(java.util.Map<java.lang.String,java.lang.String> items,
boolean addNullOption)
Creates a new select box, with the option of adding a "not selected" choice.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addOption(java.lang.String value,
java.lang.String text)
Adds a new selection cell.
|
protected LabelSelectCell |
createUnknownOption(java.lang.String value)
Internal method to create a select option for an unknown value.
|
java.lang.String |
getApparentValue()
Returns the "apparent value", i.e. either the real value if available, or else the ghost value if available, or null otherwise.
|
protected void |
initOpener()
The implementation of this method should initialize the opener of the select box.
|
void |
setAutoHideParent(I_AutoHider autoHideParent)
Call this when auto hiding parents are shown.
|
void |
setGhostMode(boolean ghostMode)
Enables or disables ghost mode, if possible.
|
void |
setGhostValue(java.lang.String value,
boolean ghostMode)
Sets the "ghost value" of the widget and optionally sets it to "ghost mode".
|
void |
setItems(java.util.Map<java.lang.String,java.lang.String> items)
Sets the items using a map from option values to label texts.
|
void |
setTextForNullSelection(java.lang.String text)
Sets the text that is used for the "not selected" option.
|
void |
truncateOpener(java.lang.String prefix,
int width)
Abstract method whose implementation should truncate the opener widget(s).
|
protected void |
updateOpener(java.lang.String newValue)
The implementation of this method should update the opener when a new value is selected by the user.
|
addOption, addValueChangeHandler, clearItems, close, doClickOpener, getFieldType, getFormValue, getFormValueAsString, initMaxCellWidth, isEnabled, onBrowserEvent, onValueSelect, open, reset, selectValue, setEnabled, setErrorMessage, setFormValue, setFormValueAsString, truncateclaimElement, getWidget, initializeClaimedElement, initWidget, isAttached, onAttach, onDetach, render, render, resolvePotentialElement, setWidgetaddAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isOrWasAttached, onLoad, onUnload, removeFromParent, setLayoutData, sinkEventsaddStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, toString, unsinkEventspublic static final java.lang.String NO_SELECTION_TEXT
protected Label m_openerWidget
public SelectBox()
public SelectBox(java.util.Map<java.lang.String,java.lang.String> items)
The keys of the map are the values of the select options, and the values of the map are the labels to be displayed for each option.
items - the map of select optionspublic SelectBox(java.util.Map<java.lang.String,java.lang.String> items,
boolean addNullOption)
items - the map of select optionsaddNullOption - if true, a "not selected" option will be added to the select boxpublic void addOption(java.lang.String value,
java.lang.String text)
value - the value of the select optiontext - the text to be displayed for the select optionpublic java.lang.String getApparentValue()
I_FormWidgetgetApparentValue in interface I_FormWidgetI_FormWidget.getApparentValue()public void setAutoHideParent(I_AutoHider autoHideParent)
I_FormWidgetsetAutoHideParent in interface I_FormWidgetautoHideParent - the auto hide parentI_FormWidget.setAutoHideParent(com.alkacon.geranium.client.ui.I_AutoHider)public void setGhostMode(boolean ghostMode)
I_HasGhostValuesetGhostMode in interface I_HasGhostValueghostMode - if ghost mode should be enabled, else disabledI_HasGhostValue.setGhostMode(boolean)public void setGhostValue(java.lang.String value,
boolean ghostMode)
I_HasGhostValue"Ghost mode" can be used to show the user the value (called "ghost value") which will be used if he either doesn't choose an option in the widget, or explicitly chooses an "empty" or "default" option.
setGhostValue in interface I_HasGhostValuevalue - the ghost valueghostMode - if true, sets the widget to ghost modeI_HasGhostValue.setGhostValue(java.lang.String, boolean)public void setItems(java.util.Map<java.lang.String,java.lang.String> items)
items - the map containing the select optionspublic void setTextForNullSelection(java.lang.String text)
text - the text which should be used for the "not selected" optionpublic void truncateOpener(java.lang.String prefix,
int width)
A_SelectBoxtruncateOpener in class A_SelectBox<LabelSelectCell>prefix - the text metrics prefixwidth - the widget widthA_SelectBox.truncateOpener(java.lang.String, int)protected LabelSelectCell createUnknownOption(java.lang.String value)
A_SelectBoxcreateUnknownOption in class A_SelectBox<LabelSelectCell>value - the value for which to create the optionA_SelectBox.createUnknownOption(java.lang.String)protected void initOpener()
A_SelectBoxinitOpener in class A_SelectBox<LabelSelectCell>A_SelectBox.initOpener()protected void updateOpener(java.lang.String newValue)
A_SelectBoxupdateOpener in class A_SelectBox<LabelSelectCell>newValue - the value selected by the userA_SelectBox.updateOpener(java.lang.String)