com.vaadin.ui.
Class AbstractComponentContainer
- java.lang.Object
-
- com.vaadin.server.AbstractClientConnector
-
- com.vaadin.ui.AbstractComponent
-
- com.vaadin.ui.AbstractComponentContainer
-
All Implemented Interfaces:
ContextClickEvent.ContextClickNotifier
,MethodEventSource
,ClientConnector
,Sizeable
,Connector
,Component
,ComponentContainer
,HasComponents
,HasComponents.ComponentAttachDetachNotifier
,Serializable
,Iterable<Component>
Direct Known Subclasses:
public abstract class AbstractComponentContainer extends AbstractComponent implements ComponentContainer
Extension to
AbstractComponent
that defines the default implementation for the methods inComponentContainer
. Basic UI components that need to contain other components inherit this class to easily qualify as a component container.Since:
3.0
Author:
Vaadin Ltd
See Also:
-
-
Nested Class Summary
-
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.ui.Component
Component.ErrorEvent, Component.Event, Component.Focusable, Component.Listener
-
Nested classes/interfaces inherited from interface com.vaadin.ui.HasComponents
HasComponents.ComponentAttachDetachNotifier, HasComponents.ComponentAttachEvent, HasComponents.ComponentAttachListener, HasComponents.ComponentDetachEvent, HasComponents.ComponentDetachListener
-
Nested classes/interfaces inherited from interface com.vaadin.server.Sizeable
Sizeable.Unit
-
-
Field Summary
-
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 Description AbstractComponentContainer()
Constructs a new component container.
-
Method Summary
All Methods Modifier and Type Method Description void
addComponent(Component c)
This only implements the events and component parent calls.
Registration
addComponentAttachListener(HasComponents.ComponentAttachListener listener)
Listens the component attach events.
Registration
addComponentDetachListener(HasComponents.ComponentDetachListener listener)
Listens the component detach events.
void
addComponents(Component... components)
Adds the components in the given order to this component container.
protected void
fireComponentAttachEvent(Component component)
Fires the component attached event.
protected void
fireComponentDetachEvent(Component component)
Fires the component detached event.
Iterator<Component>
getComponentIterator()
Deprecated.
As of 7.0, useHasComponents.iterator()
instead.protected AbstractComponentContainerState
getState()
Returns the shared state bean with information to be sent from the server to the client.
protected AbstractComponentContainerState
getState(boolean markAsDirty)
Returns the shared state for this connector.
void
moveComponentsFrom(ComponentContainer source)
Moves all components from an another container into this container.
void
removeAllComponents()
Removes all components from the container.
void
removeComponent(Component c)
This only implements the events and component parent calls.
void
removeComponentAttachListener(HasComponents.ComponentAttachListener listener)
Deprecated.
void
removeComponentDetachListener(HasComponents.ComponentDetachListener listener)
Deprecated.
void
setHeight(float height, Sizeable.Unit unit)
Sets the height of the object.
void
setWidth(float width, Sizeable.Unit unit)
Sets the width of the object.
-
Methods inherited from class com.vaadin.ui.AbstractComponent
addContextClickListener, addListener, addShortcutListener, addStyleName, attach, beforeClientResponse, detach, findAncestor, fireComponentErrorEvent, fireComponentEvent, focus, getActionManager, getCaption, getComponentError, getCustomAttributes, getData, getDebugId, getDescription, getErrorMessage, getHeight, getHeightUnits, getIcon, getId, getLocale, getParent, getPrimaryStyleName, getStyleName, getWidth, getWidthUnits, isCaptionAsHtml, isConnectorEnabled, isEnabled, isOrHasAncestor, isReadOnly, isRequiredIndicatorVisible, isResponsive, isVisible, readDesign, removeContextClickListener, removeListener, removeShortcutListener, removeStyleName, setCaption, setCaptionAsHtml, setComponentError, setData, setDebugId, setDescription, setDescription, setEnabled, setHeight, setHeightFull, setHeightUndefined, setIcon, setId, setLocale, setParent, setPrimaryStyleName, setReadOnly, setRequiredIndicatorVisible, setResponsive, setSizeFull, setSizeUndefined, setStyleName, setVisible, setWidth, setWidthFull, setWidthUndefined, writeDesign
-
Methods inherited from class com.vaadin.server.AbstractClientConnector
addAttachListener, addDetachListener, addExtension, addListener, addListener, addListener, addListener, addListener, addListener, addMethodInvocationToQueue, createState, encodeState, equals, fireEvent, getAllChildrenIterable, getConnectorId, getErrorHandler, getExtensions, getListeners, getResource, getRpcManager, getRpcProxy, getSession, getStateType, getUI, handleConnectorRequest, hashCode, hasListeners, isAttached, isThis, markAsDirty, markAsDirtyRecursive, registerRpc, registerRpc, removeAttachListener, removeDetachListener, removeExtension, removeListener, removeListener, removeListener, removeListener, removeListener, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler, setResource, updateDiffstate
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.vaadin.server.ClientConnector
addAttachListener, addDetachListener, beforeClientResponse, detach, encodeState, getErrorHandler, getExtensions, getRpcManager, getStateType, handleConnectorRequest, isAttached, isConnectorEnabled, markAsDirty, markAsDirtyRecursive, removeAttachListener, removeDetachListener, removeExtension, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler
-
Methods inherited from interface com.vaadin.ui.Component
addListener, addStyleName, addStyleNames, attach, getCaption, getDescription, getIcon, getId, getLocale, getParent, getPrimaryStyleName, getStyleName, getUI, isEnabled, isVisible, readDesign, removeListener, removeStyleName, removeStyleNames, setCaption, setEnabled, setIcon, setId, setParent, setPrimaryStyleName, setStyleName, setStyleName, setVisible, writeDesign
-
Methods inherited from interface com.vaadin.ui.ComponentContainer
getComponentCount, replaceComponent
-
Methods inherited from interface com.vaadin.shared.Connector
getConnectorId
-
Methods inherited from interface com.vaadin.ui.HasComponents
iterator
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Methods inherited from interface com.vaadin.server.Sizeable
getHeight, getHeightUnits, getWidth, getWidthUnits, setHeight, setHeightFull, setHeightUndefined, setSizeFull, setSizeUndefined, setWidth, setWidthFull, setWidthUndefined
-
-
-
-
Method Detail
-
addComponents
public void addComponents(Component... components)
Description copied from interface:
ComponentContainer
Adds the components in the given order to this component container.
Specified by:
addComponents
in interfaceComponentContainer
Parameters:
components
- The components to add.
-
removeAllComponents
public void removeAllComponents()
Removes all components from the container. This should probably be re-implemented in extending classes for a more powerful implementation.
Specified by:
removeAllComponents
in interfaceComponentContainer
-
moveComponentsFrom
public void moveComponentsFrom(ComponentContainer source)
Description copied from interface:
ComponentContainer
Moves all components from an another container into this container. The components are removed from
source
.Specified by:
moveComponentsFrom
in interfaceComponentContainer
Parameters:
source
- the container which contains the components that are to be moved to this container.
-
addComponentAttachListener
public Registration addComponentAttachListener(HasComponents.ComponentAttachListener listener)
Description copied from interface:
HasComponents.ComponentAttachDetachNotifier
Listens the component attach events.
Specified by:
addComponentAttachListener
in interfaceHasComponents.ComponentAttachDetachNotifier
Parameters:
listener
- the listener to add, not nullReturns:
a registration object for removing the listener
See Also:
-
removeComponentAttachListener
@Deprecated public void removeComponentAttachListener(HasComponents.ComponentAttachListener listener)
Deprecated.Description copied from interface:
HasComponents.ComponentAttachDetachNotifier
Stops the listening component attach events.
Specified by:
removeComponentAttachListener
in interfaceHasComponents.ComponentAttachDetachNotifier
Parameters:
listener
- the listener to removed.
-
addComponentDetachListener
public Registration addComponentDetachListener(HasComponents.ComponentDetachListener listener)
Description copied from interface:
HasComponents.ComponentAttachDetachNotifier
Listens the component detach events.
Specified by:
addComponentDetachListener
in interfaceHasComponents.ComponentAttachDetachNotifier
-
removeComponentDetachListener
@Deprecated public void removeComponentDetachListener(HasComponents.ComponentDetachListener listener)
Deprecated.Description copied from interface:
HasComponents.ComponentAttachDetachNotifier
Stops the listening component detach events.
Specified by:
removeComponentDetachListener
in interfaceHasComponents.ComponentAttachDetachNotifier
-
fireComponentAttachEvent
protected void fireComponentAttachEvent(Component component)
Fires the component attached event. This should be called by the addComponent methods after the component have been added to this container.
Parameters:
component
- the component that has been added to this container.
-
fireComponentDetachEvent
protected void fireComponentDetachEvent(Component component)
Fires the component detached event. This should be called by the removeComponent methods after the component have been removed from this container.
Parameters:
component
- the component that has been removed from this container.
-
addComponent
public void addComponent(Component c)
This only implements the events and component parent calls. The extending classes must implement component list maintenance and call this method after component list maintenance.
Specified by:
addComponent
in interfaceComponentContainer
Parameters:
c
- the component to be added.See Also:
-
removeComponent
public void removeComponent(Component c)
This only implements the events and component parent calls. The extending classes must implement component list maintenance and call this method before component list maintenance.
Specified by:
removeComponent
in interfaceComponentContainer
Parameters:
c
- the component to be removed.See Also:
-
setWidth
public void setWidth(float width, Sizeable.Unit unit)
Description copied from interface:
Sizeable
Sets the width of the object. Negative number implies unspecified size (terminal is free to set the size).
Specified by:
setWidth
in interfaceSizeable
Overrides:
setWidth
in classAbstractComponent
Parameters:
width
- the width of the object.unit
- the unit used for the width.
-
setHeight
public void setHeight(float height, Sizeable.Unit unit)
Description copied from interface:
Sizeable
Sets the height of the object. Negative number implies unspecified size (terminal is free to set the size).
Specified by:
setHeight
in interfaceSizeable
Overrides:
setHeight
in classAbstractComponent
Parameters:
height
- the height of the object.unit
- the unit used for the width.
-
getComponentIterator
@Deprecated public Iterator<Component> getComponentIterator()
Deprecated.As of 7.0, useHasComponents.iterator()
instead.Gets an iterator to the collection of contained components. Using this iterator it is possible to step through all components contained in this container.
Specified by:
getComponentIterator
in interfaceComponentContainer
Returns:
the component iterator.
-
getState
protected AbstractComponentContainerState 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 classAbstractComponent
Returns:
updated component shared state
-
getState
protected AbstractComponentContainerState getState(boolean markAsDirty)
Description copied from class:
AbstractClientConnector
Returns the shared state for this connector.
Overrides:
getState
in classAbstractComponent
Parameters:
markAsDirty
- true if the connector should automatically be marked dirty, false otherwiseReturns:
The shared state for this connector. Never null.
See Also:
-
-