public abstract class AbstractSingleComponentContainer extends AbstractComponent implements SingleComponentContainer
AbstractComponentContainer instead of this class.HasComponents.ComponentAttachDetachNotifier, HasComponents.ComponentAttachEvent, HasComponents.ComponentAttachListener, HasComponents.ComponentDetachEvent, HasComponents.ComponentDetachListenerComponent.ErrorEvent, Component.Event, Component.Focusable, Component.ListenerClientConnector.AttachEvent, ClientConnector.AttachListener, ClientConnector.ConnectorErrorEvent, ClientConnector.DetachEvent, ClientConnector.DetachListenerSizeable.UnitDESIGN_ATTR_PLAIN_TEXTSIZE_UNDEFINED, UNITS_CM, UNITS_EM, UNITS_EX, UNITS_INCH, UNITS_MM, UNITS_PERCENTAGE, UNITS_PICAS, UNITS_PIXELS, UNITS_POINTS| Constructor and Description |
|---|
AbstractSingleComponentContainer() |
| Modifier and Type | Method and Description |
|---|---|
void |
addComponentAttachListener(HasComponents.ComponentAttachListener listener)
Listens the component attach events.
|
void |
addComponentDetachListener(HasComponents.ComponentDetachListener listener)
Listens the component detach events.
|
protected void |
fireComponentAttachEvent(Component component)
Fires the component attached event.
|
protected void |
fireComponentDetachEvent(Component component)
Fires the component detached event.
|
int |
getComponentCount()
Gets the number of children this
SingleComponentContainer has. |
Component |
getContent()
Gets the content of this container.
|
Iterator<Component> |
iterator()
Gets an iterator to the collection of contained components.
|
void |
readDesign(org.jsoup.nodes.Element design,
DesignContext designContext)
Reads the component state from the given design.
|
protected void |
readDesignChildren(org.jsoup.select.Elements children,
DesignContext context)
Reads the content component from the list of child elements of a design.
|
void |
removeComponentAttachListener(HasComponents.ComponentAttachListener listener)
Stops the listening component attach events.
|
void |
removeComponentDetachListener(HasComponents.ComponentDetachListener listener)
Stops the listening component detach events.
|
static void |
removeFromParent(Component content)
Utility method for removing a component from its parent (if possible).
|
void |
setContent(Component content)
Sets the content of this container.
|
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.
|
void |
writeDesign(org.jsoup.nodes.Element design,
DesignContext designContext)
Writes the component state to the given design.
|
addContextClickListener, addListener, addShortcutListener, addStyleName, attach, beforeClientResponse, detach, findAncestor, fireComponentErrorEvent, fireComponentEvent, focus, getActionManager, getCaption, getComponentError, getCustomAttributes, getData, getDebugId, getDescription, getErrorMessage, getExplicitImmediateValue, getHeight, getHeightUnits, getIcon, getId, getLocale, getParent, getPrimaryStyleName, getState, getState, getStyleName, getWidth, getWidthUnits, isCaptionAsHtml, isConnectorEnabled, isEnabled, isImmediate, isOrHasAncestor, isReadOnly, isResponsive, isVisible, removeContextClickListener, removeListener, removeShortcutListener, removeStyleName, setCaption, setCaptionAsHtml, setComponentError, setData, setDebugId, setDescription, setEnabled, setHeight, setHeightUndefined, setIcon, setId, setImmediate, setLocale, setParent, setPrimaryStyleName, setReadOnly, setResponsive, setSizeFull, setSizeUndefined, setStyleName, setStyleName, setVisible, setWidth, setWidthUndefinedaddAttachListener, addDetachListener, addExtension, 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, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler, setResourceclone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitaddListener, addStyleName, attach, getCaption, getDescription, getIcon, getId, getLocale, getParent, getPrimaryStyleName, getStyleName, getUI, isEnabled, isReadOnly, isVisible, removeListener, removeStyleName, setCaption, setEnabled, setIcon, setId, setParent, setPrimaryStyleName, setReadOnly, setStyleName, setVisibleaddAttachListener, addDetachListener, beforeClientResponse, detach, encodeState, getErrorHandler, getExtensions, getRpcManager, getStateType, handleConnectorRequest, isAttached, isConnectorEnabled, markAsDirty, markAsDirtyRecursive, removeAttachListener, removeDetachListener, removeExtension, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandlergetConnectorIdgetHeight, getHeightUnits, getWidth, getWidthUnits, setHeight, setHeightUndefined, setSizeFull, setSizeUndefined, setWidth, setWidthUndefinedforEach, spliteratorpublic int getComponentCount()
SingleComponentContainerSingleComponentContainer has.
This must be symmetric with what HasComponents.iterator() returns and thus
typically return 1 if the content is set, 0 otherwise.getComponentCount in interface SingleComponentContainerpublic Iterator<Component> iterator()
HasComponentsiterator in interface HasComponentsiterator in interface Iterable<Component>public void addComponentAttachListener(HasComponents.ComponentAttachListener listener)
HasComponents.ComponentAttachDetachNotifieraddComponentAttachListener in interface HasComponents.ComponentAttachDetachNotifierlistener - the listener to add.public void removeComponentAttachListener(HasComponents.ComponentAttachListener listener)
HasComponents.ComponentAttachDetachNotifierremoveComponentAttachListener in interface HasComponents.ComponentAttachDetachNotifierlistener - the listener to removed.public void addComponentDetachListener(HasComponents.ComponentDetachListener listener)
HasComponents.ComponentAttachDetachNotifieraddComponentDetachListener in interface HasComponents.ComponentAttachDetachNotifierpublic void removeComponentDetachListener(HasComponents.ComponentDetachListener listener)
HasComponents.ComponentAttachDetachNotifierremoveComponentDetachListener in interface HasComponents.ComponentAttachDetachNotifierprotected void fireComponentAttachEvent(Component component)
setContent(Component) method after the component has been set as
the content.component - the component that has been added to this container.protected void fireComponentDetachEvent(Component component)
setContent(Component) method after the content component has
been replaced by other content.component - the component that has been removed from this container.public Component getContent()
SingleComponentContainergetContent in interface SingleComponentContainerSingleComponentContainer.setContent(Component)public void setContent(Component content)
VerticalLayout with margins
enabled as the default content but that is no longer the case.setContent in interface SingleComponentContainercontent - a component (typically a layout) to use as contentpublic static void removeFromParent(Component content) throws IllegalArgumentException
content - component to removeIllegalArgumentExceptionpublic void setWidth(float width,
Sizeable.Unit unit)
SizeablesetWidth in interface SizeablesetWidth in class AbstractComponentwidth - the width of the object.unit - the unit used for the width.public void setHeight(float height,
Sizeable.Unit unit)
SizeablesetHeight in interface SizeablesetHeight in class AbstractComponentheight - the height of the object.unit - the unit used for the width.public void readDesign(org.jsoup.nodes.Element design,
DesignContext designContext)
ComponentThe component is responsible not only for updating its own state but also for ensuring that its children update their state based on the design.
It is assumed that the component is in its default state when this method is called. Reading should only take into consideration attributes specified in the design and not reset any unspecified attributes to their defaults.
This method must not modify the design.
readDesign in interface ComponentreadDesign in class AbstractComponentdesign - The element to obtain the state fromdesignContext - The DesignContext instance used for parsing the designprotected void readDesignChildren(org.jsoup.select.Elements children,
DesignContext context)
children - the child elements of the design that is being readcontext - the DesignContext instance used to parse the designDesignException - if there are multiple child elementsDesignException - if a child element could not be parsed as a Componentpublic void writeDesign(org.jsoup.nodes.Element design,
DesignContext designContext)
ComponentThe component is responsible not only for writing its own state but also for ensuring that its children write their state to the design.
This method must not modify the component state.
writeDesign in interface ComponentwriteDesign in class AbstractComponentdesign - The element to write the component state to. Any previous
attributes or child nodes are not cleared.designContext - The DesignContext instance used for writing the designCopyright © 2023 Vaadin Ltd. All rights reserved.