com.vaadin.ui.
Class CustomComponent
java.lang.Object
com.vaadin.ui.AbstractComponent
com.vaadin.ui.AbstractComponentContainer
com.vaadin.ui.CustomComponent
All Implemented Interfaces:
MethodEventSource, Paintable, Sizeable, VariableOwner, Component, ComponentContainer, Serializable, EventListener
Direct Known Subclasses:
- extends AbstractComponentContainer
public class CustomComponent
Custom component provides simple implementation of Component interface for creation of new UI components by composition of existing components.
The component is used by inheriting the CustomComponent class and setting composite root inside the Custom component. The composite root itself can contain more components, but their interfaces are hidden from the users.
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 | |
---|---|
CustomComponent()
Constructs a new custom component. |
|
CustomComponent(Component compositionRoot)
Constructs a new custom component. |
Method Summary | |
---|---|
void |
addComponent(Component c)
This method is not supported by CustomComponent. |
int |
getComponentCount()
Gets the number of contained components. |
Iterator<Component> |
getComponentIterator()
Gets an iterator to the collection of contained components. |
String |
getComponentType()
Deprecated. not more useful as the whole tag system has been removed |
protected Component |
getCompositionRoot()
Returns the composition root. |
void |
moveComponentsFrom(ComponentContainer source)
This method is not supported by CustomComponent. |
void |
paintContent(PaintTarget target)
Paints any needed component-specific things to the given UIDL stream. |
void |
removeAllComponents()
This method is not supported by CustomComponent. |
void |
removeComponent(Component c)
This method is not supported by CustomComponent. |
void |
replaceComponent(Component oldComponent,
Component newComponent)
This method is not supported by CustomComponent. |
void |
setComponentType(String componentType)
Deprecated. not more useful as the whole tag system has been removed |
protected void |
setCompositionRoot(Component compositionRoot)
Sets the compositions root. |
Methods inherited from class com.vaadin.ui.AbstractComponentContainer |
---|
addListener, addListener, attach, detach, fireComponentAttachEvent, fireComponentDetachEvent, removeListener, removeListener, requestRepaintAll, setEnabled, setHeight, setWidth |
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.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 |
---|
CustomComponent
public CustomComponent()
Constructs a new custom component.
The component is implemented by wrapping the methods of the composition root component given as parameter. The composition root must be set before the component can be used.
CustomComponent
public CustomComponent(Component compositionRoot)
- Parameters:
compositionRoot
- the root of the composition component tree.
Constructs a new custom component.
The component is implemented by wrapping the methods of the composition root component given as parameter. The composition root must not be null and can not be changed after the composition.
Method Detail |
---|
getCompositionRoot
protected Component getCompositionRoot()
- Returns:
- the Component Composition root.
Returns the composition root.
setCompositionRoot
protected void setCompositionRoot(Component compositionRoot)
- Parameters:
compositionRoot
- the root of the composition component tree.
Sets the compositions root.
The composition root must be set to non-null value before the component can be used. The composition root can only be set once.
paintContent
public void paintContent(PaintTarget target)
throws PaintException
- Overrides:
paintContent
in classAbstractComponent
- Parameters:
target
- the target UIDL stream where the component should paint itself to- Throws:
PaintException
- if the paint operation failed.
Description copied from class: AbstractComponent
Paints any needed component-specific things to the given UIDL stream. The
more general AbstractComponent.paint(PaintTarget)
method handles all general
attributes common to all components, and it calls this method to paint
any component-specific attributes to the UIDL stream.
getComponentType
@Deprecated
public String getComponentType()
- Returns:
- the component type.
Deprecated. not more useful as the whole tag system has been removed
Gets the component type. The component type is textual type of the component. This is included in the UIDL as component tag attribute.
setComponentType
@Deprecated
public void setComponentType(String componentType)
- Parameters:
componentType
- the componentType to set.
Deprecated. not more useful as the whole tag system has been removed
Sets the component type. The component type is textual type of the component. This is included in the UIDL as component tag attribute.
getComponentIterator
public Iterator<Component> getComponentIterator()
- Returns:
- the component iterator.
Description copied from interface: ComponentContainer
Gets an iterator to the collection of contained components. Using this iterator it is possible to step through all components contained in this container.
getComponentCount
public int getComponentCount()
- Returns:
- the number of contained components (zero or one)
Gets the number of contained components. Consistent with the iterator
returned by getComponentIterator()
.
replaceComponent
public void replaceComponent(Component oldComponent,
Component newComponent)
- Parameters:
oldComponent
- the old component that will be replaced.newComponent
- the new component to be replaced.- See Also:
ComponentContainer.replaceComponent(com.vaadin.ui.Component, com.vaadin.ui.Component)
This method is not supported by CustomComponent.
addComponent
public void addComponent(Component c)
- Specified by:
addComponent
in interfaceComponentContainer
- Overrides:
addComponent
in classAbstractComponentContainer
- Parameters:
c
- the component to be added.- See Also:
AbstractComponentContainer.addComponent(com.vaadin.ui.Component)
This method is not supported by CustomComponent. Use
setCompositionRoot(Component)
to set
CustomComponents "child".
moveComponentsFrom
public void moveComponentsFrom(ComponentContainer source)
- Specified by:
moveComponentsFrom
in interfaceComponentContainer
- Overrides:
moveComponentsFrom
in classAbstractComponentContainer
- Parameters:
source
- the container which contains the components that are to be moved to this container.- See Also:
AbstractComponentContainer.moveComponentsFrom(com.vaadin.ui.ComponentContainer)
This method is not supported by CustomComponent.
removeAllComponents
public void removeAllComponents()
- Specified by:
removeAllComponents
in interfaceComponentContainer
- Overrides:
removeAllComponents
in classAbstractComponentContainer
This method is not supported by CustomComponent.
removeComponent
public void removeComponent(Component c)
- Specified by:
removeComponent
in interfaceComponentContainer
- Overrides:
removeComponent
in classAbstractComponentContainer
- Parameters:
c
- the component to be removed.- See Also:
AbstractComponentContainer.removeComponent(com.vaadin.ui.Component)
This method is not supported by CustomComponent.