com.vaadin.ui.
Class OptionGroup
-
All Implemented Interfaces:
Buffered, BufferedValidatable, Container, Container.ItemSetChangeListener, Container.ItemSetChangeNotifier, Container.PropertySetChangeListener, Container.PropertySetChangeNotifier, Container.Viewer, Property<Object>, Property.Editor, Property.ReadOnlyStatusChangeListener, Property.ReadOnlyStatusChangeNotifier, Property.ValueChangeListener, Property.ValueChangeNotifier, Property.Viewer, Validatable, Action.ShortcutNotifier, ConnectorEventListener, ContextClickEvent.ContextClickNotifier, FieldEvents.BlurNotifier, FieldEvents.FocusNotifier, MethodEventSource, ClientConnector, Sizeable, VariableOwner, Connector, Component, Component.Focusable, Field<Object>, LegacyComponent, Serializable, EventListener
public class OptionGroup extends AbstractSelect implements FieldEvents.BlurNotifier, FieldEvents.FocusNotifier
Configures select to be used as an option group.
See Also:
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.vaadin.ui.AbstractSelect
AbstractSelect.AbstractSelectTargetDetails, AbstractSelect.AcceptItem, AbstractSelect.CaptionChangeListener, AbstractSelect.DefaultNewItemHandler, AbstractSelect.Filtering, AbstractSelect.ItemCaptionMode, AbstractSelect.ItemDescriptionGenerator, AbstractSelect.NewItemHandler, AbstractSelect.TargetItemIs, AbstractSelect.VerticalLocationIs
-
Nested classes/interfaces inherited from class com.vaadin.ui.AbstractField
AbstractField.FocusShortcut, AbstractField.ReadOnlyStatusChangeEvent
-
Nested classes/interfaces inherited from interface com.vaadin.data.Container
Container.Editor, Container.Filter, Container.Filterable, Container.Hierarchical, Container.Indexed, Container.ItemSetChangeListener, Container.ItemSetChangeNotifier, Container.Ordered, Container.PropertySetChangeListener, Container.PropertySetChangeNotifier, Container.SimpleFilterable, Container.Sortable, Container.Viewer
-
Nested classes/interfaces inherited from interface com.vaadin.ui.Component
Component.ErrorEvent, Component.Event, Component.Focusable, Component.Listener
-
Nested classes/interfaces inherited from interface com.vaadin.server.ClientConnector
ClientConnector.AttachEvent, ClientConnector.AttachListener, ClientConnector.ConnectorErrorEvent, ClientConnector.DetachEvent, ClientConnector.DetachListener
-
Nested classes/interfaces inherited from interface com.vaadin.server.Sizeable
Sizeable.Unit
-
Nested classes/interfaces inherited from interface com.vaadin.ui.Field
Field.ValueChangeEvent
-
Nested classes/interfaces inherited from interface com.vaadin.data.Buffered
Buffered.SourceException
-
Nested classes/interfaces inherited from interface com.vaadin.data.Property
Property.Editor, Property.ReadOnlyException, Property.ReadOnlyStatusChangeListener, Property.ReadOnlyStatusChangeNotifier, Property.Transactional<T>, Property.ValueChangeListener, Property.ValueChangeNotifier, Property.Viewer
-
-
Field Summary
-
Fields inherited from class com.vaadin.ui.AbstractSelect
ITEM_CAPTION_MODE_EXPLICIT, ITEM_CAPTION_MODE_EXPLICIT_DEFAULTS_ID, ITEM_CAPTION_MODE_ICON_ONLY, ITEM_CAPTION_MODE_ID, ITEM_CAPTION_MODE_INDEX, ITEM_CAPTION_MODE_ITEM, ITEM_CAPTION_MODE_PROPERTY, itemIdMapper, items
-
Fields inherited from class com.vaadin.ui.AbstractComponent
DESIGN_ATTR_PLAIN_TEXT
-
Fields inherited from interface com.vaadin.server.Sizeable
SIZE_UNDEFINED, UNITS_CM, UNITS_EM, UNITS_EX, UNITS_INCH, UNITS_MM, UNITS_PERCENTAGE, UNITS_PICAS, UNITS_PIXELS, UNITS_POINTS
-
-
Constructor Summary
Constructors Constructor and Description OptionGroup()
OptionGroup(String caption)
OptionGroup(String caption, Collection<?> options)
OptionGroup(String caption, Container dataSource)
-
Method Summary
All Methods Modifier and Type Method and Description void
addBlurListener(FieldEvents.BlurListener listener)
Adds a
BlurListener
to the Component which gets fired when aField
loses keyboard focus.void
addFocusListener(FieldEvents.FocusListener listener)
Adds a
FocusListener
to the Component which gets fired when aField
receives keyboard focus.void
addListener(FieldEvents.BlurListener listener)
Deprecated.
As of 7.0, replaced by#addBlurListener(BlurListener)
void
addListener(FieldEvents.FocusListener listener)
Deprecated.
As of 7.0, replaced by#addFocusListener(FocusListener)
void
changeVariables(Object source, Map<String,Object> variables)
Invoked when the value of a variable has changed.
protected OptionGroupState
getState()
Returns the shared state bean with information to be sent from the server to the client.
boolean
isHtmlContentAllowed()
Checks whether captions are interpreted as html or plain text.
boolean
isItemEnabled(Object itemId)
Returns true if the item is enabled.
void
paintContent(PaintTarget target)
Paints the content of this component.
protected void
paintItem(PaintTarget target, Object itemId)
protected Object
readItem(org.jsoup.nodes.Element child, Set<String> selected, DesignContext context)
Reads an Item from a design and inserts it into the data source.
void
removeBlurListener(FieldEvents.BlurListener listener)
Removes a
BlurListener
from the Component.void
removeFocusListener(FieldEvents.FocusListener listener)
Removes a
FocusListener
from the Component.void
removeListener(FieldEvents.BlurListener listener)
Deprecated.
As of 7.0, replaced by#removeBlurListener(BlurListener)
void
removeListener(FieldEvents.FocusListener listener)
Deprecated.
As of 7.0, replaced by#removeFocusListener(FocusListener)
void
setHtmlContentAllowed(boolean htmlContentAllowed)
Sets whether html is allowed in the item captions.
void
setItemEnabled(Object itemId, boolean enabled)
Sets an item disabled or enabled.
protected void
setValue(Object newValue, boolean repaintIsNotNeeded)
Sets the value of the field.
protected org.jsoup.nodes.Element
writeItem(org.jsoup.nodes.Element design, Object itemId, DesignContext context)
Writes a data source Item to a design.
-
Methods inherited from class com.vaadin.ui.AbstractSelect
addContainerProperty, addItem, addItem, addItems, addItems, addItemSetChangeListener, addListener, addListener, addPropertySetChangeListener, attach, containerItemSetChange, containerPropertySetChange, containsId, detach, fireItemSetChange, firePropertySetChange, getCaptionChangeListener, getContainerDataSource, getContainerProperty, getContainerPropertyIds, getItem, getItemCaption, getItemCaptionMode, getItemCaptionPropertyId, getItemIcon, getItemIconPropertyId, getItemIds, getListeners, getNewItemHandler, getNullSelectionItemId, getType, getType, getValue, getVisibleItemIds, isEmpty, isMultiSelect, isNewItemsAllowed, isNullSelectionAllowed, isSelected, readDesign, readItems, removeAllItems, removeContainerProperty, removeItem, removeItemSetChangeListener, removeListener, removeListener, removePropertySetChangeListener, sanitizeSelection, select, setContainerDataSource, setItemCaption, setItemCaptionMode, setItemCaptionPropertyId, setItemIcon, setItemIconPropertyId, setMultiSelect, setNewItemHandler, setNewItemsAllowed, setNullSelectionAllowed, setNullSelectionItemId, setValue, setValue, size, unselect, writeDesign, writeItems
-
Methods inherited from class com.vaadin.ui.AbstractField
addListener, addListener, addReadOnlyStatusChangeListener, addValidator, addValueChangeListener, beforeClientResponse, clear, commit, discard, fireReadOnlyStatusChange, fireValueChange, focus, getConversionError, getConversionError, getConvertedValue, getConverter, getCurrentBufferedSourceException, getCustomAttributes, getErrorMessage, getInternalValue, getModelType, getPropertyDataSource, getRequiredError, getState, getTabIndex, getValidators, isBuffered, isImmediate, isInvalidAllowed, isInvalidCommitted, isModified, isReadOnly, isRequired, isValid, isValidationVisible, readOnlyStatusChange, removeAllValidators, removeListener, removeListener, removeReadOnlyStatusChangeListener, removeValidator, removeValueChangeListener, setBuffered, setConversionError, setConvertedValue, setConverter, setConverter, setCurrentBufferedSourceException, setInternalValue, setInvalidAllowed, setInvalidCommitted, setLocale, setPropertyDataSource, setReadOnly, setRequired, setRequiredError, setTabIndex, setValidationVisible, shouldHideErrors, toString, validate, validate, valueChange
-
Methods inherited from class com.vaadin.ui.AbstractComponent
addContextClickListener, addListener, addShortcutListener, addStyleName, findAncestor, fireComponentErrorEvent, fireComponentEvent, getActionManager, getCaption, getComponentError, getData, getDebugId, getDescription, getExplicitImmediateValue, getHeight, getHeightUnits, getIcon, getId, getLocale, getParent, getPrimaryStyleName, getStyleName, getWidth, getWidthUnits, isCaptionAsHtml, isConnectorEnabled, isEnabled, isOrHasAncestor, isResponsive, isVisible, removeContextClickListener, removeListener, removeShortcutListener, removeStyleName, setCaption, setCaptionAsHtml, setComponentError, setData, setDebugId, setDescription, setEnabled, setHeight, setHeight, setHeightUndefined, setIcon, setId, setImmediate, setParent, setPrimaryStyleName, setResponsive, setSizeFull, setSizeUndefined, setStyleName, setStyleName, setVisible, setWidth, setWidth, setWidthUndefined
-
Methods inherited from class com.vaadin.server.AbstractClientConnector
addAttachListener, addDetachListener, addExtension, addListener, addListener, addListener, addMethodInvocationToQueue, createState, encodeState, equals, fireEvent, getAllChildrenIterable, getConnectorId, getErrorHandler, getExtensions, getResource, getRpcManager, getRpcProxy, getSession, getStateType, getUI, handleConnectorRequest, hashCode, hasListeners, isAttached, isThis, markAsDirty, markAsDirtyRecursive, registerRpc, registerRpc, removeAttachListener, removeDetachListener, removeExtension, removeListener, removeListener, removeListener, removeListener, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler, setResource
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.vaadin.ui.LegacyComponent
markAsDirty
-
Methods inherited from interface com.vaadin.server.VariableOwner
isEnabled, isImmediate
-
Methods inherited from interface com.vaadin.ui.Component
addListener, addStyleName, getCaption, getDescription, getIcon, getId, getLocale, getParent, getPrimaryStyleName, getStyleName, getUI, isEnabled, isReadOnly, isVisible, removeListener, removeStyleName, setCaption, setEnabled, setIcon, setId, setParent, setPrimaryStyleName, setReadOnly, setStyleName, setVisible
-
Methods inherited from interface com.vaadin.server.ClientConnector
addAttachListener, addDetachListener, beforeClientResponse, encodeState, getErrorHandler, getExtensions, getRpcManager, getStateType, handleConnectorRequest, isAttached, isConnectorEnabled, markAsDirtyRecursive, removeAttachListener, removeDetachListener, removeExtension, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler
-
Methods inherited from interface com.vaadin.shared.Connector
getConnectorId
-
Methods inherited from interface com.vaadin.server.Sizeable
getHeight, getHeightUnits, getWidth, getWidthUnits, setHeight, setHeight, setHeightUndefined, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthUndefined
-
Methods inherited from interface com.vaadin.event.Action.ShortcutNotifier
addShortcutListener, removeShortcutListener
-
-
-
-
Constructor Detail
-
OptionGroup
public OptionGroup()
-
OptionGroup
public OptionGroup(String caption, Collection<?> options)
-
OptionGroup
public OptionGroup(String caption)
-
-
Method Detail
-
paintContent
public void paintContent(PaintTarget target) throws PaintException
Description copied from class:
AbstractSelect
Paints the content of this component.
Specified by:
paintContent
in interfaceLegacyComponent
Overrides:
paintContent
in classAbstractSelect
Parameters:
target
- the Paint Event.Throws:
PaintException
- if the paint operation failed.
-
paintItem
protected void paintItem(PaintTarget target, Object itemId) throws PaintException
Overrides:
paintItem
in classAbstractSelect
Throws:
-
changeVariables
public void changeVariables(Object source, Map<String,Object> variables)
Description copied from class:
AbstractSelect
Invoked when the value of a variable has changed.
Specified by:
changeVariables
in interfaceVariableOwner
Overrides:
changeVariables
in classAbstractSelect
Parameters:
source
- the Source of the variable change. This is the origin of the event. For example in Web Adapter this is the request.variables
- the Mapping from variable names to new variable values.See Also:
AbstractComponent#changeVariables(java.lang.Object, java.util.Map)
-
addBlurListener
public void addBlurListener(FieldEvents.BlurListener listener)
Description copied from interface:
FieldEvents.BlurNotifier
Adds a
BlurListener
to the Component which gets fired when aField
loses keyboard focus.Specified by:
addBlurListener
in interfaceFieldEvents.BlurNotifier
See Also:
-
addListener
@Deprecated public void addListener(FieldEvents.BlurListener listener)
Deprecated. As of 7.0, replaced by
#addBlurListener(BlurListener)
Specified by:
addListener
in interfaceFieldEvents.BlurNotifier
-
removeBlurListener
public void removeBlurListener(FieldEvents.BlurListener listener)
Description copied from interface:
FieldEvents.BlurNotifier
Removes a
BlurListener
from the Component.Specified by:
removeBlurListener
in interfaceFieldEvents.BlurNotifier
See Also:
-
removeListener
@Deprecated public void removeListener(FieldEvents.BlurListener listener)
Deprecated. As of 7.0, replaced by
#removeBlurListener(BlurListener)
Specified by:
removeListener
in interfaceFieldEvents.BlurNotifier
-
addFocusListener
public void addFocusListener(FieldEvents.FocusListener listener)
Description copied from interface:
FieldEvents.FocusNotifier
Adds a
FocusListener
to the Component which gets fired when aField
receives keyboard focus.Specified by:
addFocusListener
in interfaceFieldEvents.FocusNotifier
See Also:
-
addListener
@Deprecated public void addListener(FieldEvents.FocusListener listener)
Deprecated. As of 7.0, replaced by
#addFocusListener(FocusListener)
Specified by:
addListener
in interfaceFieldEvents.FocusNotifier
-
removeFocusListener
public void removeFocusListener(FieldEvents.FocusListener listener)
Description copied from interface:
FieldEvents.FocusNotifier
Removes a
FocusListener
from the Component.Specified by:
removeFocusListener
in interfaceFieldEvents.FocusNotifier
See Also:
-
removeListener
@Deprecated public void removeListener(FieldEvents.FocusListener listener)
Deprecated. As of 7.0, replaced by
#removeFocusListener(FocusListener)
Specified by:
removeListener
in interfaceFieldEvents.FocusNotifier
-
setValue
protected void setValue(Object newValue, boolean repaintIsNotNeeded)
Description copied from class:
AbstractField
Sets the value of the field.
Overrides:
setValue
in classAbstractField<Object>
Parameters:
newValue
- the New value of the field.repaintIsNotNeeded
- True iff caller is sure that repaint is not needed.
-
setItemEnabled
public void setItemEnabled(Object itemId, boolean enabled)
Sets an item disabled or enabled. In the multiselect mode, a disabled item cannot be selected or deselected by the user. In the single selection mode, a disable item cannot be selected. However, programmatical selection or deselection of an disable item is possible. By default, items are enabled.
Parameters:
itemId
- the id of the item to be disabled or enabledenabled
- if true the item is enabled, otherwise the item is disabled
-
isItemEnabled
public boolean isItemEnabled(Object itemId)
Returns true if the item is enabled.
Parameters:
itemId
- the id of the item to be checkedReturns:
true if the item is enabled, false otherwise
See Also:
-
setHtmlContentAllowed
public void setHtmlContentAllowed(boolean htmlContentAllowed)
Sets whether html is allowed in the item captions. If set to true, the captions are passed to the browser as html and the developer is responsible for ensuring no harmful html is used. If set to false, the content is passed to the browser as plain text.
Parameters:
htmlContentAllowed
- true if the captions are used as html, false if used as plain text
-
isHtmlContentAllowed
public boolean isHtmlContentAllowed()
Checks whether captions are interpreted as html or plain text.
Returns:
true if the captions are used as html, false if used as plain text
See Also:
-
readItem
protected Object readItem(org.jsoup.nodes.Element child, Set<String> selected, DesignContext context)
Description copied from class:
AbstractSelect
Reads an Item from a design and inserts it into the data source. Hierarchical select components should override this method to recursively recursively read any child items as well.
Overrides:
readItem
in classAbstractSelect
Parameters:
child
- a child element representing the itemselected
- A set accumulating selected items. If the item that is read is marked as selected, its item id should be added to this set.context
- the DesignContext instance used in parsingReturns:
the item id of the new item
-
writeItem
protected org.jsoup.nodes.Element writeItem(org.jsoup.nodes.Element design, Object itemId, DesignContext context)
Description copied from class:
AbstractSelect
Writes a data source Item to a design. Hierarchical select components should override this method to recursively write any child items as well.
Overrides:
writeItem
in classAbstractSelect
Parameters:
design
- the element into which to insert the itemitemId
- the id of the item to writecontext
- the DesignContext instance used in writingReturns:
-
getState
protected OptionGroupState getState()
Description copied from class:
AbstractComponent
Returns the shared state bean with information to be sent from the server to the client. Subclasses should override this method and set any relevant fields of the state returned by super.getState().
Overrides:
getState
in classAbstractSelect
Returns:
updated component shared state
-
-