Package org.opencms.gwt.client.ui.input
Class A_CmsSelectBox<OPTION extends A_CmsSelectCell>
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<OPTION>
- Type Parameters:
OPTION
- the widget type of the select options
- All Implemented Interfaces:
com.google.gwt.event.dom.client.HasFocusHandlers
,com.google.gwt.event.logical.shared.HasAttachHandlers
,com.google.gwt.event.logical.shared.HasValueChangeHandlers<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_CmsTruncable
,I_CmsFormWidget
- Direct Known Subclasses:
CmsComboBox
,CmsFilterSelectBox
,CmsMultiSelectBox
,CmsSelectBox
public abstract class A_CmsSelectBox<OPTION extends A_CmsSelectCell>
extends com.google.gwt.user.client.ui.Composite
implements I_CmsFormWidget, com.google.gwt.event.logical.shared.HasValueChangeHandlers<String>, com.google.gwt.event.dom.client.HasFocusHandlers, I_CmsTruncable
Abstract superclass for select box widgets.
- Since:
- 8.0.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static interface
The UI Binder interface for this widget.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
FieldsModifier and TypeFieldDescriptionprotected static final I_CmsInputCss
The layout bundle.protected CmsErrorWidget
Error widget.protected com.google.gwt.event.shared.SimpleEventBus
The event bus.protected com.google.gwt.event.shared.HandlerRegistration
Handler registration for mouse wheel handlers.protected CmsPushButton
The open-close button.protected com.google.gwt.user.client.ui.FocusPanel
The opener widget.protected com.google.gwt.user.client.ui.Panel
Container for the opener and error widget.protected com.google.gwt.user.client.ui.PopupPanel
The popup panel inside which the selector will be shown.protected final CmsStyleVariable
Style of the select box widget.The map of select options.protected String
The value of the currently selected option.protected com.google.gwt.user.client.ui.Panel
The selector which contains the select options.protected final CmsStyleVariable
Style of the select box widget.Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncom.google.gwt.event.shared.HandlerRegistration
addFocusHandler
(com.google.gwt.event.dom.client.FocusHandler handler) void
Adds a new select option to the select box.com.google.gwt.event.shared.HandlerRegistration
addValueChangeHandler
(com.google.gwt.event.logical.shared.ValueChangeHandler<String> handler) void
addWidget
(com.google.gwt.user.client.ui.Widget widget) Adds a widget.protected void
Internal helper method for clearing the select options.protected void
close()
Internal method which is called when the selector is closed.protected abstract OPTION
createUnknownOption
(String value) Internal method to create a select option for an unknown value.boolean
Returns whether the select options are being displayed below or above the widget.protected void
doClickOpener
(com.google.gwt.event.dom.client.ClickEvent e) Handle clicks on the opener.Returns the type of data this widget produces.Gets the selected/entered value from the widget.Gets the current value of the widget as a string.protected int
Returns the offset height of the popup panel, should also work when the popup is currently not showing.com.google.gwt.user.client.ui.Panel
Returns the selector of this widget.protected abstract void
The implementation of this method should initialize the opener of the select box.protected int
Initializes the selector width.boolean
Returnstrue
if this widget is enabled.void
onBrowserEvent
(com.google.gwt.user.client.Event event) protected void
onDetach()
protected void
onFocus
(com.google.gwt.event.dom.client.FocusEvent event) Handles the focus event on the opener.protected void
onLoad()
protected void
onUnload()
protected void
onValueSelect
(String value) This method is called when a value is selected.protected void
onValueSelect
(String value, boolean fireEvents) Internal handler method which is called when a new value is selected.protected void
open()
Internal method which is called when the selector is opened.protected void
Deinstalls the window resize handler.void
reset()
Resets the widget to its default state.void
selectValue
(String value) Helper method to set the current selected option.void
setEnabled
(boolean enabled) Enables or disables the widget.void
setErrorMessage
(String errorMessage) Sets the error message for this widget.void
setFormValue
(Object value) Sets the form value of this select box.void
setFormValue
(Object value, boolean fireEvents) Sets the form value of this select box.void
setFormValueAsString
(String formValue) Sets the current value of the widget as a string.void
setPopupResize
(boolean resize) Sets the behavior of the popup if the input is bigger than the selectbox itself.void
Truncates long text and sets the original text to the title attribute.protected abstract void
truncateOpener
(String prefix, int width) Abstract method whose implementation should truncate the opener widget(s).protected abstract void
updateOpener
(String newValue) The implementation of this method should update the opener when a new value is selected by the user.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
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.google.gwt.event.shared.HasHandlers
fireEvent
Methods inherited from interface org.opencms.gwt.client.ui.input.I_CmsFormWidget
getApparentValue, setAutoHideParent
-
Field Details
-
CSS
The layout bundle. -
m_error
Error widget. -
m_eventBus
The event bus. -
m_mousewheelRegistration
Handler registration for mouse wheel handlers. -
m_openClose
The open-close button. -
m_opener
The opener widget. -
m_panel
Container for the opener and error widget. -
m_popup
The popup panel inside which the selector will be shown. -
m_selectBoxState
Style of the select box widget. -
m_selectCells
The map of select options. -
m_selectedValue
The value of the currently selected option. -
m_selector
The selector which contains the select options. -
m_selectorState
Style of the select box widget.
-
-
Constructor Details
-
A_CmsSelectBox
public A_CmsSelectBox()Creates a new select box.
-
-
Method Details
-
addFocusHandler
public com.google.gwt.event.shared.HandlerRegistration addFocusHandler(com.google.gwt.event.dom.client.FocusHandler handler) - Specified by:
addFocusHandler
in interfacecom.google.gwt.event.dom.client.HasFocusHandlers
- See Also:
-
HasFocusHandlers.addFocusHandler(com.google.gwt.event.dom.client.FocusHandler)
-
addOption
Adds a new select option to the select box.- Parameters:
cell
- the widget representing the select option
-
addWidget
Adds a widget.- Parameters:
widget
- the widget to add
-
displayingAbove
Returns whether the select options are being displayed below or above the widget.- Returns:
true
in case the select options are displayed above the widget
-
getFieldType
Description copied from interface:I_CmsFormWidget
Returns the type of data this widget produces.- Specified by:
getFieldType
in interfaceI_CmsFormWidget
- Returns:
- the data type
- See Also:
-
getFormValue
Description copied from interface:I_CmsFormWidget
Gets the selected/entered value from the widget.- Specified by:
getFormValue
in interfaceI_CmsFormWidget
- Returns:
- the value
- See Also:
-
getFormValueAsString
Description copied from interface:I_CmsFormWidget
Gets the current value of the widget as a string.- Specified by:
getFormValueAsString
in interfaceI_CmsFormWidget
- Returns:
- the current value of the widget
- See Also:
-
getSelectorPopup
Returns the selector of this widget.- Returns:
- the selector of this widget
-
isEnabled
Description copied from interface:I_CmsFormWidget
Returnstrue
if this widget is enabled.- Specified by:
isEnabled
in interfaceI_CmsFormWidget
- Returns:
true
if this widget is enabled- See Also:
-
onBrowserEvent
- Specified by:
onBrowserEvent
in interfacecom.google.gwt.user.client.EventListener
- Overrides:
onBrowserEvent
in classcom.google.gwt.user.client.ui.Composite
- See Also:
-
Composite.onBrowserEvent(com.google.gwt.user.client.Event)
-
reset
Description copied from interface:I_CmsFormWidget
Resets the widget to its default state.- Specified by:
reset
in interfaceI_CmsFormWidget
- See Also:
-
selectValue
Helper method to set the current selected option.This method does not trigger the "value changed" event.
- Parameters:
value
- the new value
-
setEnabled
Description copied from interface:I_CmsFormWidget
Enables or disables the widget.- Specified by:
setEnabled
in interfaceI_CmsFormWidget
- Parameters:
enabled
- if true, the widget will be enabled, else disabled- See Also:
-
setErrorMessage
Description copied from interface:I_CmsFormWidget
Sets the error message for this widget.If the error message is null, no error message will be displayed.
- Specified by:
setErrorMessage
in interfaceI_CmsFormWidget
- Parameters:
errorMessage
- an error message or null- See Also:
-
setFormValue
Sets the form value of this select box.- Parameters:
value
- the new value
-
setFormValue
Sets the form value of this select box.- Parameters:
value
- the new valuefireEvents
- true if change events should be fired
-
setFormValueAsString
Description copied from interface:I_CmsFormWidget
Sets the current value of the widget as a string.- Specified by:
setFormValueAsString
in interfaceI_CmsFormWidget
- Parameters:
formValue
- the new value of the widget- See Also:
-
setPopupResize
Sets the behavior of the popup if the input is bigger than the selectbox itself.- Parameters:
resize
-true
to resize
-
truncate
Description copied from interface:I_CmsTruncable
Truncates long text and sets the original text to the title attribute.- Specified by:
truncate
in interfaceI_CmsTruncable
- Parameters:
textMetricsPrefix
- the key identifying the text metrics to usewidgetWidth
- the width to use in pixels- See Also:
-
clearItems
Internal helper method for clearing the select options. -
close
Internal method which is called when the selector is closed. -
createUnknownOption
Internal method to create a select option for an unknown value.- Parameters:
value
- the value for which to create the option- Returns:
- the new option
-
doClickOpener
Handle clicks on the opener.- Parameters:
e
- the click event
-
getPopupHeight
Returns the offset height of the popup panel, should also work when the popup is currently not showing.- Returns:
- the offset height
-
initOpener
The implementation of this method should initialize the opener of the select box. -
initPreferredPopupWidth
Initializes the selector width.- Returns:
- the preferred popup width
-
onDetach
- Overrides:
onDetach
in classcom.google.gwt.user.client.ui.Composite
- See Also:
-
Composite.onDetach()
-
onFocus
Handles the focus event on the opener.- Parameters:
event
- the focus event
-
onLoad
- Overrides:
onLoad
in classcom.google.gwt.user.client.ui.Widget
- See Also:
-
Widget.onLoad()
-
onUnload
- Overrides:
onUnload
in classcom.google.gwt.user.client.ui.Widget
- See Also:
-
Widget.onUnload()
-
onValueSelect
This method is called when a value is selected.- Parameters:
value
- the selected value
-
onValueSelect
Internal handler method which is called when a new value is selected.- Parameters:
value
- the new valuefireEvents
- true if change events should be fired
-
open
Internal method which is called when the selector is opened. -
removeWindowResizeHandler
Deinstalls the window resize handler. -
truncateOpener
Abstract method whose implementation should truncate the opener widget(s).- Parameters:
prefix
- the text metrics prefixwidth
- the widget width
-
updateOpener
The implementation of this method should update the opener when a new value is selected by the user.- Parameters:
newValue
- the value selected by the user
-