public class CmsSelectBox extends A_CmsSelectBox<CmsLabelSelectCell> implements I_CmsHasInit, I_CmsHasGhostValue
A_CmsSelectBox.I_CmsSelectBoxUiBinder, A_CmsSelectBox.ScrollEventPreviewHandler
com.google.gwt.user.client.ui.UIObject.DebugIdImpl, com.google.gwt.user.client.ui.UIObject.DebugIdImplEnabled
I_CmsFormWidget.FieldType
限定符和类型 | 字段和说明 |
---|---|
protected java.lang.String |
m_ghostValue
The ghost value.
|
protected CmsLabel |
m_openerWidget
The widget displayed in the opener.
|
static java.lang.String |
NO_SELECTION_OPENER_TEXT
The key for the text which should be displayed in the opener if no option is available.
|
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_previewHandlerRegistration, m_selectBoxState, m_selectCells, m_selectedValue, m_selector, m_selectorState
构造器和说明 |
---|
CmsSelectBox()
Default constructor.
|
CmsSelectBox(java.util.Map<java.lang.String,java.lang.String> items)
Constructs a new select box from a map.
|
CmsSelectBox(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.
|
限定符和类型 | 方法和说明 |
---|---|
void |
addOption(java.lang.String value,
java.lang.String text)
Adds a new selection cell.
|
protected CmsLabelSelectCell |
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.
|
java.util.Map<java.lang.String,java.lang.String> |
getItems()
Returns the items as a map for option values to label text.
|
com.google.gwt.user.client.ui.FocusPanel |
getOpener()
Returns the opener of this widget.
|
protected java.lang.String |
getTitle(java.lang.String option,
java.lang.String defaultValue)
Helper method to get the title for a given select option.
|
static void |
initClass()
Initializes this class.
|
protected void |
initOpener()
The implementation of this method should initialize the opener of the select box.
|
protected void |
onLoad() |
void |
selectValue(java.lang.String value)
Helper method to set the current selected option.
|
void |
setAutoHideParent(I_CmsAutoHider 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 |
setTitle(java.lang.String option,
java.lang.String title)
Sets the title for a select option.
|
void |
truncateOpener(java.lang.String prefix,
int width)
Abstract method whose implementation should truncate the opener widget(s).
|
void |
updateCell(CmsLabelSelectCell cell)
Updates a single select cell.
|
void |
updateCells()
Updates the select cells.
|
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.
|
protected void |
updateStyle()
This method should be used to make changes to the CSS style of the select box when the value changes.
|
addFocusHandler, addOption, addValueChangeHandler, clearItems, close, doClickOpener, getFieldType, getFormValue, getFormValueAsString, getSelectorPopup, initMaxCellWidth, isEnabled, onBrowserEvent, onDetach, onFocus, onValueSelect, onValueSelect, open, removeWindowResizeHandler, reset, setEnabled, setErrorMessage, setFormValue, setFormValue, setFormValueAsString, setPopupResize, truncate
claimElement, getWidget, initializeClaimedElement, initWidget, isAttached, onAttach, render, render, resolvePotentialElement, setWidget
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isOrWasAttached, onUnload, removeFromParent, setLayoutData, sinkEvents
addStyleDependentName, 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, unsinkEvents
public static final java.lang.String NO_SELECTION_OPENER_TEXT
public static final java.lang.String NO_SELECTION_TEXT
protected java.lang.String m_ghostValue
protected CmsLabel m_openerWidget
public CmsSelectBox()
public CmsSelectBox(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 CmsSelectBox(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 static void initClass()
public 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_CmsFormWidget
getApparentValue
在接口中 I_CmsFormWidget
I_CmsFormWidget.getApparentValue()
public java.util.Map<java.lang.String,java.lang.String> getItems()
public com.google.gwt.user.client.ui.FocusPanel getOpener()
public void selectValue(java.lang.String value)
A_CmsSelectBox
This method does not trigger the "value changed" event.
selectValue
在类中 A_CmsSelectBox<CmsLabelSelectCell>
value
- the new valueA_CmsSelectBox.selectValue(java.lang.String)
public void setAutoHideParent(I_CmsAutoHider autoHideParent)
I_CmsFormWidget
setAutoHideParent
在接口中 I_CmsFormWidget
autoHideParent
- the auto hide parentI_CmsFormWidget.setAutoHideParent(org.opencms.gwt.client.ui.I_CmsAutoHider)
public void setGhostMode(boolean ghostMode)
I_CmsHasGhostValue
setGhostMode
在接口中 I_CmsHasGhostValue
ghostMode
- if ghost mode should be enabled, else disabledI_CmsHasGhostValue.setGhostMode(boolean)
public void setGhostValue(java.lang.String value, boolean ghostMode)
I_CmsHasGhostValue
"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
在接口中 I_CmsHasGhostValue
value
- the ghost valueghostMode
- if true, sets the widget to ghost modeI_CmsHasGhostValue.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 setTitle(java.lang.String option, java.lang.String title)
Note: This will only affect select options added *after* calling this method!
option
- the select option valuetitle
- the new title for the optionpublic void truncateOpener(java.lang.String prefix, int width)
A_CmsSelectBox
truncateOpener
在类中 A_CmsSelectBox<CmsLabelSelectCell>
prefix
- the text metrics prefixwidth
- the widget widthA_CmsSelectBox.truncateOpener(java.lang.String, int)
public void updateCell(CmsLabelSelectCell cell)
cell
- the select cell to updatepublic void updateCells()
protected CmsLabelSelectCell createUnknownOption(java.lang.String value)
A_CmsSelectBox
createUnknownOption
在类中 A_CmsSelectBox<CmsLabelSelectCell>
value
- the value for which to create the optionA_CmsSelectBox.createUnknownOption(java.lang.String)
protected java.lang.String getTitle(java.lang.String option, java.lang.String defaultValue)
option
- the select option valuedefaultValue
- the value to return when no title for the value was foundprotected void initOpener()
A_CmsSelectBox
initOpener
在类中 A_CmsSelectBox<CmsLabelSelectCell>
A_CmsSelectBox.initOpener()
protected void onLoad()
onLoad
在类中 A_CmsSelectBox<CmsLabelSelectCell>
Widget.onLoad()
protected void updateOpener(java.lang.String newValue)
A_CmsSelectBox
updateOpener
在类中 A_CmsSelectBox<CmsLabelSelectCell>
newValue
- the value selected by the userA_CmsSelectBox.updateOpener(java.lang.String)
protected void updateStyle()