Package org.opencms.gwt.client.ui.input
Class CmsFilterSelectBox
- java.lang.Object
-
- com.google.gwt.user.client.ui.UIObject
-
- com.google.gwt.user.client.ui.Widget
-
- com.google.gwt.user.client.ui.Composite
-
- org.opencms.gwt.client.ui.input.A_CmsSelectBox<CmsLabelSelectCell>
-
- org.opencms.gwt.client.ui.input.CmsFilterSelectBox
-
- All Implemented Interfaces:
com.google.gwt.event.dom.client.HasFocusHandlers
,com.google.gwt.event.logical.shared.HasAttachHandlers
,com.google.gwt.event.logical.shared.HasValueChangeHandlers<java.lang.String>
,com.google.gwt.event.shared.HasHandlers
,com.google.gwt.user.client.EventListener
,com.google.gwt.user.client.ui.HasVisibility
,com.google.gwt.user.client.ui.IsRenderable
,com.google.gwt.user.client.ui.IsWidget
,I_CmsHasInit
,I_CmsTruncable
,I_CmsFormWidget
public class CmsFilterSelectBox extends A_CmsSelectBox<CmsLabelSelectCell> implements I_CmsHasInit
Select box that allows client-side filtering for its options.Filtering is done by a case-insensitive substring test on the user-readable select option texts.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.opencms.gwt.client.ui.input.A_CmsSelectBox
A_CmsSelectBox.I_CmsSelectBoxUiBinder
-
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject
com.google.gwt.user.client.ui.UIObject.DebugIdImpl, com.google.gwt.user.client.ui.UIObject.DebugIdImplEnabled
-
Nested classes/interfaces inherited from interface org.opencms.gwt.client.ui.input.I_CmsFormWidget
I_CmsFormWidget.FieldType
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
WIDGET_TYPE
The widget type identifier.-
Fields inherited from class org.opencms.gwt.client.ui.input.A_CmsSelectBox
CSS, m_error, m_eventBus, m_mousewheelRegistration, m_openClose, m_opener, m_panel, m_popup, m_selectBoxState, m_selectCells, m_selectedValue, m_selector, m_selectorState
-
-
Constructor Summary
Constructors Constructor Description CmsFilterSelectBox()
Creates a new instance.CmsFilterSelectBox(java.util.Map<java.lang.String,java.lang.String> options)
Creates a new instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addOption(CmsLabelSelectCell cell)
Adds a new select option to the select box.protected void
close()
Internal method which is called when the selector is closed.protected CmsLabelSelectCell
createUnknownOption(java.lang.String value)
Internal method to create a select option for an unknown value.boolean
displayingAbove()
Returns whether the select options are being displayed below or above the widget.protected void
filterCells(java.lang.String filter)
Updates the visibility of select options based on the given filter string.java.lang.String
getApparentValue()
Returns the "apparent value", i.e.java.util.LinkedHashMap<java.lang.String,java.lang.String>
getItems()
Gets the selection items as a map (the values are map keys, and the labels are the corresponding map values).com.google.gwt.user.client.ui.FocusPanel
getOpener()
Gets the opener.static void
initClass()
Initializes this class.protected void
initOpener()
The implementation of this method should initialize the opener of the select box.void
onBrowserEvent(com.google.gwt.user.client.Event event)
protected void
open()
Internal method which is called when the selector is opened.void
setAutoHideParent(I_CmsAutoHider autoHideParent)
Call this when auto hiding parents are shown.void
setEnabled(boolean enabled)
Enables or disables the widget.void
setItems(java.util.Map<java.lang.String,java.lang.String> options)
Sets the select options.void
setTitle(java.lang.String key, java.lang.String title)
Sets the title for a select option.protected 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.-
Methods inherited from class org.opencms.gwt.client.ui.input.A_CmsSelectBox
addFocusHandler, addValueChangeHandler, addWidget, clearItems, doClickOpener, getFieldType, getFormValue, getFormValueAsString, getPopupHeight, getSelectorPopup, initPreferredPopupWidth, isEnabled, onDetach, onFocus, onLoad, onUnload, onValueSelect, onValueSelect, removeWindowResizeHandler, reset, selectValue, setErrorMessage, setFormValue, setFormValue, setFormValueAsString, setPopupResize, truncate
-
Methods inherited from class com.google.gwt.user.client.ui.Composite
claimElement, getWidget, initializeClaimedElement, initWidget, isAttached, onAttach, render, render, resolvePotentialElement, setWidget
-
Methods inherited from class com.google.gwt.user.client.ui.Widget
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isOrWasAttached, removeFromParent, setLayoutData, sinkEvents, unsinkEvents
-
Methods inherited from class com.google.gwt.user.client.ui.UIObject
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
-
-
-
-
Field Detail
-
WIDGET_TYPE
public static final java.lang.String WIDGET_TYPE
The widget type identifier.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CmsFilterSelectBox
public CmsFilterSelectBox()
Creates a new instance.
-
CmsFilterSelectBox
public CmsFilterSelectBox(java.util.Map<java.lang.String,java.lang.String> options)
Creates a new instance.- Parameters:
options
- the select options
-
-
Method Detail
-
initClass
public static void initClass()
Initializes this class.
-
addOption
public void addOption(CmsLabelSelectCell cell)
Description copied from class:A_CmsSelectBox
Adds a new select option to the select box.- Overrides:
addOption
in classA_CmsSelectBox<CmsLabelSelectCell>
- Parameters:
cell
- the widget representing the select option- See Also:
A_CmsSelectBox.addOption(org.opencms.gwt.client.ui.input.A_CmsSelectCell)
-
displayingAbove
public boolean displayingAbove()
Description copied from class:A_CmsSelectBox
Returns whether the select options are being displayed below or above the widget.- Overrides:
displayingAbove
in classA_CmsSelectBox<CmsLabelSelectCell>
- Returns:
true
in case the select options are displayed above the widget- See Also:
A_CmsSelectBox.displayingAbove()
-
getApparentValue
public java.lang.String getApparentValue()
Description copied from interface:I_CmsFormWidget
Returns the "apparent value", i.e. either the real value if available, or else the ghost value if available, or null otherwise.- Specified by:
getApparentValue
in interfaceI_CmsFormWidget
- Returns:
- the apparent value
- See Also:
I_CmsFormWidget.getApparentValue()
-
getItems
public java.util.LinkedHashMap<java.lang.String,java.lang.String> getItems()
Gets the selection items as a map (the values are map keys, and the labels are the corresponding map values).- Returns:
- the selection items as a map
-
getOpener
public com.google.gwt.user.client.ui.FocusPanel getOpener()
Gets the opener.- Returns:
- the opener
-
onBrowserEvent
public void onBrowserEvent(com.google.gwt.user.client.Event event)
- Specified by:
onBrowserEvent
in interfacecom.google.gwt.user.client.EventListener
- Overrides:
onBrowserEvent
in classA_CmsSelectBox<CmsLabelSelectCell>
- See Also:
A_CmsSelectBox.onBrowserEvent(com.google.gwt.user.client.Event)
-
setAutoHideParent
public void setAutoHideParent(I_CmsAutoHider autoHideParent)
Description copied from interface:I_CmsFormWidget
Call this when auto hiding parents are shown.- Specified by:
setAutoHideParent
in interfaceI_CmsFormWidget
- Parameters:
autoHideParent
- the auto hide parent- See Also:
I_CmsFormWidget.setAutoHideParent(org.opencms.gwt.client.ui.I_CmsAutoHider)
-
setEnabled
public void setEnabled(boolean enabled)
Description copied from interface:I_CmsFormWidget
Enables or disables the widget.- Specified by:
setEnabled
in interfaceI_CmsFormWidget
- Overrides:
setEnabled
in classA_CmsSelectBox<CmsLabelSelectCell>
- Parameters:
enabled
- if true, the widget will be enabled, else disabled- See Also:
A_CmsSelectBox.setEnabled(boolean)
-
setItems
public void setItems(java.util.Map<java.lang.String,java.lang.String> options)
Sets the select options.- Parameters:
options
- the select options
-
setTitle
public void setTitle(java.lang.String key, java.lang.String title)
Sets the title for a select option.- Parameters:
key
- the select option keytitle
- the title
-
close
protected void close()
Description copied from class:A_CmsSelectBox
Internal method which is called when the selector is closed.- Overrides:
close
in classA_CmsSelectBox<CmsLabelSelectCell>
- See Also:
A_CmsSelectBox.close()
-
createUnknownOption
protected CmsLabelSelectCell createUnknownOption(java.lang.String value)
Description copied from class:A_CmsSelectBox
Internal method to create a select option for an unknown value.- Specified by:
createUnknownOption
in classA_CmsSelectBox<CmsLabelSelectCell>
- Parameters:
value
- the value for which to create the option- Returns:
- the new option
- See Also:
A_CmsSelectBox.createUnknownOption(java.lang.String)
-
filterCells
protected void filterCells(java.lang.String filter)
Updates the visibility of select options based on the given filter string.An option matches the filter if the display text contains the filter string as a substring, without regard for case.
- Parameters:
filter
- the filter string
-
initOpener
protected void initOpener()
Description copied from class:A_CmsSelectBox
The implementation of this method should initialize the opener of the select box.- Specified by:
initOpener
in classA_CmsSelectBox<CmsLabelSelectCell>
- See Also:
A_CmsSelectBox.initOpener()
-
open
protected void open()
Description copied from class:A_CmsSelectBox
Internal method which is called when the selector is opened.- Overrides:
open
in classA_CmsSelectBox<CmsLabelSelectCell>
- See Also:
A_CmsSelectBox.open()
-
truncateOpener
protected void truncateOpener(java.lang.String prefix, int width)
Description copied from class:A_CmsSelectBox
Abstract method whose implementation should truncate the opener widget(s).- Specified by:
truncateOpener
in classA_CmsSelectBox<CmsLabelSelectCell>
- Parameters:
prefix
- the text metrics prefixwidth
- the widget width- See Also:
A_CmsSelectBox.truncateOpener(java.lang.String, int)
-
updateOpener
protected void updateOpener(java.lang.String newValue)
Description copied from class:A_CmsSelectBox
The implementation of this method should update the opener when a new value is selected by the user.- Specified by:
updateOpener
in classA_CmsSelectBox<CmsLabelSelectCell>
- Parameters:
newValue
- the value selected by the user- See Also:
A_CmsSelectBox.updateOpener(java.lang.String)
-
-