com.vaadin.ui.
Class AbstractComponentContainer
java.lang.Object
com.vaadin.ui.AbstractComponent
com.vaadin.ui.AbstractComponentContainer
All Implemented Interfaces:
MethodEventSource, Paintable, Sizeable, VariableOwner, Component, ComponentContainer, Serializable, EventListener
Direct Known Subclasses:
- extends AbstractComponent
- implements ComponentContainer
public abstract class AbstractComponentContainer
Extension to AbstractComponent
that defines the default
implementation for the methods in ComponentContainer
. Basic UI
components that need to contain other components inherit this class to easily
qualify as a component container.
Since:
3.0
Version:
6.8.18
Author:
Vaadin Ltd
See Also:
Nested Class Summary |
---|
Nested classes/interfaces inherited from class com.vaadin.ui.AbstractComponent |
---|
AbstractComponent.ComponentErrorEvent, AbstractComponent.ComponentErrorHandler |
Nested classes/interfaces inherited from interface com.vaadin.ui.ComponentContainer |
---|
ComponentContainer.ComponentAttachEvent, ComponentContainer.ComponentAttachListener, ComponentContainer.ComponentDetachEvent, ComponentContainer.ComponentDetachListener |
Nested classes/interfaces inherited from interface com.vaadin.ui.Component |
---|
Component.ErrorEvent, Component.ErrorListener, Component.Event, Component.Focusable, Component.Listener |
Nested classes/interfaces inherited from interface com.vaadin.terminal.Paintable |
---|
Paintable.RepaintRequestEvent, Paintable.RepaintRequestListener |
Field Summary |
---|
Fields inherited from interface com.vaadin.terminal.Sizeable |
---|
SIZE_UNDEFINED, UNIT_SYMBOLS, UNITS_CM, UNITS_EM, UNITS_EX, UNITS_INCH, UNITS_MM, UNITS_PERCENTAGE, UNITS_PICAS, UNITS_PIXELS, UNITS_POINTS |
Constructor Summary | |
---|---|
AbstractComponentContainer()
Constructs a new component container. |
Method Summary | |
---|---|
void |
addComponent(Component c)
This only implements the events and component parent calls. |
void |
addListener(ComponentContainer.ComponentAttachListener listener)
Listens the component attach events. |
void |
addListener(ComponentContainer.ComponentDetachListener listener)
Listens the component detach events. |
void |
attach()
Notifies all contained components that the container is attached to a window. |
void |
detach()
Notifies all contained components that the container is detached from a window. |
protected void |
fireComponentAttachEvent(Component component)
Fires the component attached event. |
protected void |
fireComponentDetachEvent(Component component)
Fires the component detached event. |
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 |
removeListener(ComponentContainer.ComponentAttachListener listener)
Stops the listening component attach events. |
void |
removeListener(ComponentContainer.ComponentDetachListener listener)
Stops the listening component detach events. |
void |
requestRepaintAll()
Causes a repaint of this component, and all components below it. |
void |
setEnabled(boolean enabled)
Enables or disables the component. |
void |
setHeight(float height,
int unit)
Sets the height of the object. |
void |
setWidth(float width,
int unit)
Sets the width of the object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.vaadin.ui.ComponentContainer |
---|
getComponentIterator, replaceComponent |
Methods inherited from interface com.vaadin.ui.Component |
---|
addListener, addStyleName, childRequestedRepaint, getApplication, getCaption, getIcon, getLocale, getParent, getStyleName, getWindow, isEnabled, isReadOnly, isVisible, removeListener, removeStyleName, setCaption, setIcon, setParent, setReadOnly, setStyleName, setVisible |
Methods inherited from interface com.vaadin.terminal.Paintable |
---|
addListener, getDebugId, paint, removeListener, requestRepaint, requestRepaintRequests, setDebugId |
Methods inherited from interface com.vaadin.terminal.VariableOwner |
---|
changeVariables, isImmediate |
Methods inherited from interface com.vaadin.terminal.Sizeable |
---|
getHeight, getHeightUnits, getWidth, getWidthUnits, setHeight, setHeight, setHeightUnits, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthUnits |
Constructor Detail |
---|
AbstractComponentContainer
public AbstractComponentContainer()
Constructs a new component container.
Method Detail |
---|
removeAllComponents
public void removeAllComponents()
- Specified by:
removeAllComponents
in interfaceComponentContainer
Removes all components from the container. This should probably be re-implemented in extending classes for a more powerful implementation.
moveComponentsFrom
public void moveComponentsFrom(ComponentContainer source)
- Specified by:
moveComponentsFrom
in interfaceComponentContainer
- Parameters:
source
- the container which contains the components that are to be moved to this container.
Description copied from interface: ComponentContainer
Moves all components from an another container into this container. The
components are removed from source
.
attach
public void attach()
- Specified by:
attach
in interfaceComponent
- Overrides:
attach
in classAbstractComponent
- See Also:
Component.attach()
Notifies all contained components that the container is attached to a window.
detach
public void detach()
- Specified by:
detach
in interfaceComponent
- Overrides:
detach
in classAbstractComponent
- See Also:
Component.detach()
Notifies all contained components that the container is detached from a window.
addListener
public void addListener(ComponentContainer.ComponentAttachListener listener)
- Specified by:
addListener
in interfaceComponentContainer
- Parameters:
listener
- the listener to add.
Description copied from interface: ComponentContainer
Listens the component attach events.
addListener
public void addListener(ComponentContainer.ComponentDetachListener listener)
- Specified by:
addListener
in interfaceComponentContainer
Description copied from interface: ComponentContainer
Listens the component detach events.
removeListener
public void removeListener(ComponentContainer.ComponentAttachListener listener)
- Specified by:
removeListener
in interfaceComponentContainer
- Parameters:
listener
- the listener to removed.
Description copied from interface: ComponentContainer
Stops the listening component attach events.
removeListener
public void removeListener(ComponentContainer.ComponentDetachListener listener)
- Specified by:
removeListener
in interfaceComponentContainer
Description copied from interface: ComponentContainer
Stops the listening component detach events.
fireComponentAttachEvent
protected void fireComponentAttachEvent(Component component)
- Parameters:
component
- the component that has been added to this container.
Fires the component attached event. This should be called by the addComponent methods after the component have been added to this container.
fireComponentDetachEvent
protected void fireComponentDetachEvent(Component component)
- Parameters:
component
- the component that has been removed from this container.
Fires the component detached event. This should be called by the removeComponent methods after the component have been removed from this container.
addComponent
public void addComponent(Component c)
- Specified by:
addComponent
in interfaceComponentContainer
- Parameters:
c
- the component to be added.- See Also:
ComponentContainer.addComponent(Component)
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.
removeComponent
public void removeComponent(Component c)
- Specified by:
removeComponent
in interfaceComponentContainer
- Parameters:
c
- the component to be removed.- See Also:
ComponentContainer.removeComponent(Component)
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.
setEnabled
public void setEnabled(boolean enabled)
- Specified by:
setEnabled
in interfaceComponent
- Overrides:
setEnabled
in classAbstractComponent
- Parameters:
enabled
- a boolean value specifying if the component should be enabled or not
Description copied from interface: Component
Enables or disables the component. The user can not interact disabled components, which are shown with a style that indicates the status, usually shaded in light gray color. Components are enabled by default. Children of a disabled component are automatically disabled; if a child component is explicitly set as disabled, changes in the disabled status of its parents do not change its status.
Button enabled = new Button("Enabled");
enabled.setEnabled(true); // The default
layout.addComponent(enabled);
Button disabled = new Button("Disabled");
disabled.setEnabled(false);
layout.addComponent(disabled);
This method will trigger a
RepaintRequestEvent
for the component and, if it is a
ComponentContainer
, for all its children recursively.
setWidth
public void setWidth(float width,
int unit)
- Specified by:
setWidth
in interfaceSizeable
- Overrides:
setWidth
in classAbstractComponent
- Parameters:
width
- the width of the object.unit
- the unit used for the width. Possible values includeSizeable.UNITS_PIXELS
,Sizeable.UNITS_POINTS
,Sizeable.UNITS_PICAS
,Sizeable.UNITS_EM
,Sizeable.UNITS_EX
,Sizeable.UNITS_MM
,Sizeable.UNITS_CM
,Sizeable.UNITS_INCH
,Sizeable.UNITS_PERCENTAGE
.
Description copied from interface: Sizeable
Sets the width of the object. Negative number implies unspecified size (terminal is free to set the size).
setHeight
public void setHeight(float height,
int unit)
- Specified by:
setHeight
in interfaceSizeable
- Overrides:
setHeight
in classAbstractComponent
- Parameters:
height
- the height of the object.unit
- the unit used for the width. Possible values includeSizeable.UNITS_PIXELS
,Sizeable.UNITS_POINTS
,Sizeable.UNITS_PICAS
,Sizeable.UNITS_EM
,Sizeable.UNITS_EX
,Sizeable.UNITS_MM
,Sizeable.UNITS_CM
,Sizeable.UNITS_INCH
,Sizeable.UNITS_PERCENTAGE
.
Description copied from interface: Sizeable
Sets the height of the object. Negative number implies unspecified size (terminal is free to set the size).
requestRepaintAll
public void requestRepaintAll()
- Specified by:
requestRepaintAll
in interfaceComponentContainer
Description copied from interface: ComponentContainer
Causes a repaint of this component, and all components below it. This should only be used in special cases, e.g when the state of a descendant depends on the state of a ancestor.