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 interfaceThe 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.DebugIdImplEnabledNested classes/interfaces inherited from interface org.opencms.gwt.client.ui.input.I_CmsFormWidget
I_CmsFormWidget.FieldType -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final I_CmsInputCssThe layout bundle.protected CmsErrorWidgetError widget.protected com.google.gwt.event.shared.SimpleEventBusThe event bus.protected com.google.gwt.event.shared.HandlerRegistrationHandler registration for mouse wheel handlers.protected CmsPushButtonThe open-close button.protected com.google.gwt.user.client.ui.FocusPanelThe opener widget.protected com.google.gwt.user.client.ui.PanelContainer for the opener and error widget.protected com.google.gwt.user.client.ui.PopupPanelThe popup panel inside which the selector will be shown.protected final CmsStyleVariableStyle of the select box widget.The map of select options.protected StringThe value of the currently selected option.protected com.google.gwt.user.client.ui.PanelThe selector which contains the select options.protected final CmsStyleVariableStyle 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.HandlerRegistrationaddFocusHandler(com.google.gwt.event.dom.client.FocusHandler handler) voidAdds a new select option to the select box.com.google.gwt.event.shared.HandlerRegistrationaddValueChangeHandler(com.google.gwt.event.logical.shared.ValueChangeHandler<String> handler) voidaddWidget(com.google.gwt.user.client.ui.Widget widget) Adds a widget.protected voidInternal helper method for clearing the select options.protected voidclose()Internal method which is called when the selector is closed.protected abstract OPTIONcreateUnknownOption(String value) Internal method to create a select option for an unknown value.booleanReturns whether the select options are being displayed below or above the widget.protected voiddoClickOpener(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 intReturns the offset height of the popup panel, should also work when the popup is currently not showing.com.google.gwt.user.client.ui.PanelReturns the selector of this widget.protected abstract voidThe implementation of this method should initialize the opener of the select box.protected intInitializes the selector width.booleanReturnstrueif this widget is enabled.voidonBrowserEvent(com.google.gwt.user.client.Event event) protected voidonDetach()protected voidonFocus(com.google.gwt.event.dom.client.FocusEvent event) Handles the focus event on the opener.protected voidonLoad()protected voidonUnload()protected voidonValueSelect(String value) This method is called when a value is selected.protected voidonValueSelect(String value, boolean fireEvents) Internal handler method which is called when a new value is selected.protected voidopen()Internal method which is called when the selector is opened.protected voidDeinstalls the window resize handler.voidreset()Resets the widget to its default state.voidselectValue(String value) Helper method to set the current selected option.voidsetEnabled(boolean enabled) Enables or disables the widget.voidsetErrorMessage(String errorMessage) Sets the error message for this widget.voidsetFormValue(Object value) Sets the form value of this select box.voidsetFormValue(Object value, boolean fireEvents) Sets the form value of this select box.voidsetFormValueAsString(String formValue) Sets the current value of the widget as a string.voidsetPopupResize(boolean resize) Sets the behavior of the popup if the input is bigger than the selectbox itself.voidTruncates long text and sets the original text to the title attribute.protected abstract voidtruncateOpener(String prefix, int width) Abstract method whose implementation should truncate the opener widget(s).protected abstract voidupdateOpener(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, setWidgetMethods 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, unsinkEventsMethods 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, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.google.gwt.event.shared.HasHandlers
fireEventMethods 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:
addFocusHandlerin interfacecom.google.gwt.event.dom.client.HasFocusHandlers- See Also:
-
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:
truein case the select options are displayed above the widget
-
getFieldType
Description copied from interface:I_CmsFormWidgetReturns the type of data this widget produces.- Specified by:
getFieldTypein interfaceI_CmsFormWidget- Returns:
- the data type
- See Also:
-
getFormValue
Description copied from interface:I_CmsFormWidgetGets the selected/entered value from the widget.- Specified by:
getFormValuein interfaceI_CmsFormWidget- Returns:
- the value
- See Also:
-
getFormValueAsString
Description copied from interface:I_CmsFormWidgetGets the current value of the widget as a string.- Specified by:
getFormValueAsStringin 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_CmsFormWidgetReturnstrueif this widget is enabled.- Specified by:
isEnabledin interfaceI_CmsFormWidget- Returns:
trueif this widget is enabled- See Also:
-
onBrowserEvent
- Specified by:
onBrowserEventin interfacecom.google.gwt.user.client.EventListener- Overrides:
onBrowserEventin classcom.google.gwt.user.client.ui.Composite- See Also:
-
reset
Description copied from interface:I_CmsFormWidgetResets the widget to its default state.- Specified by:
resetin 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_CmsFormWidgetEnables or disables the widget.- Specified by:
setEnabledin interfaceI_CmsFormWidget- Parameters:
enabled- if true, the widget will be enabled, else disabled- See Also:
-
setErrorMessage
Description copied from interface:I_CmsFormWidgetSets the error message for this widget.If the error message is null, no error message will be displayed.
- Specified by:
setErrorMessagein 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_CmsFormWidgetSets the current value of the widget as a string.- Specified by:
setFormValueAsStringin 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-trueto resize
-
truncate
Description copied from interface:I_CmsTruncableTruncates long text and sets the original text to the title attribute.- Specified by:
truncatein 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:
onDetachin classcom.google.gwt.user.client.ui.Composite- See Also:
-
onFocus
Handles the focus event on the opener.- Parameters:
event- the focus event
-
onLoad
- Overrides:
onLoadin classcom.google.gwt.user.client.ui.Widget- See Also:
-
onUnload
- Overrides:
onUnloadin classcom.google.gwt.user.client.ui.Widget- See Also:
-
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
-