com.vaadin.ui
Class CustomComponent

java.lang.Object
  extended by com.vaadin.server.AbstractClientConnector
      extended by com.vaadin.ui.AbstractComponent
          extended by com.vaadin.ui.CustomComponent
All Implemented Interfaces:
MethodEventSource, ClientConnector, Sizeable, com.vaadin.shared.Connector, Component, HasComponents, java.io.Serializable, java.lang.Iterable<Component>
Direct Known Subclasses:
ColorPickerHistory, ColorPickerSelect, DragAndDropWrapper, LoginForm

public class CustomComponent
extends AbstractComponent
implements HasComponents

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
Author:
Vaadin Ltd.
See Also:
Serialized Form

Nested Class Summary
 
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.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
 
Field Summary
 
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
CustomComponent()
          Constructs a new custom component.
CustomComponent(Component compositionRoot)
          Constructs a new custom component.
 
Method Summary
 int getComponentCount()
          Gets the number of contained components.
protected  Component getCompositionRoot()
          Returns the composition root.
 java.util.Iterator<Component> iterator()
          Gets an iterator to the collection of contained components.
protected  void setCompositionRoot(Component compositionRoot)
          Sets the compositions root.
 
Methods inherited from class com.vaadin.ui.AbstractComponent
addListener, addShortcutListener, addStyleName, attach, beforeClientResponse, detach, findAncestor, fireComponentErrorEvent, fireComponentEvent, focus, getActionManager, getCaption, getComponentError, getData, getDebugId, getDescription, getErrorMessage, getHeight, getHeightUnits, getIcon, getId, getLocale, getParent, getPrimaryStyleName, getState, getState, getStyleName, getWidth, getWidthUnits, isConnectorEnabled, isEnabled, isImmediate, isReadOnly, isVisible, removeListener, removeShortcutListener, removeStyleName, setCaption, setComponentError, setData, setDebugId, setDescription, setEnabled, setHeight, setHeight, setIcon, setId, setImmediate, setLocale, setParent, setPrimaryStyleName, setReadOnly, setSizeFull, setSizeUndefined, setStyleName, setVisible, setWidth, setWidth
 
Methods inherited from class com.vaadin.server.AbstractClientConnector
addAttachListener, addDetachListener, addExtension, addListener, addListener, addListener, addMethodInvocationToQueue, createState, encodeState, fireEvent, getAllChildrenIterable, getConnectorId, getErrorHandler, getExtensions, getListeners, getResource, getRpcManager, getRpcProxy, getSession, getStateType, getUI, handleConnectorRequest, hasListeners, markAsDirty, markAsDirtyRecursive, registerRpc, registerRpc, removeAttachListener, removeDetachListener, removeExtension, removeListener, removeListener, removeListener, removeListener, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler, setResource
 
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, attach, getCaption, getDescription, getIcon, getId, getLocale, getParent, getPrimaryStyleName, getStyleName, getUI, isEnabled, isReadOnly, isVisible, removeListener, removeStyleName, setCaption, setEnabled, setIcon, setId, setPrimaryStyleName, setReadOnly, setStyleName, setVisible
 
Methods inherited from interface com.vaadin.server.ClientConnector
addAttachListener, addDetachListener, beforeClientResponse, detach, encodeState, getErrorHandler, getExtensions, getRpcManager, getStateType, handleConnectorRequest, isConnectorEnabled, markAsDirty, markAsDirtyRecursive, removeAttachListener, removeDetachListener, removeExtension, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler, setParent
 
Methods inherited from interface com.vaadin.shared.Connector
getConnectorId
 
Methods inherited from interface com.vaadin.server.Sizeable
getHeight, getHeightUnits, getWidth, getWidthUnits, setHeight, setHeight, setSizeFull, setSizeUndefined, setWidth, setWidth
 

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)
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.

Parameters:
compositionRoot - the root of the composition component tree.
Method Detail

getCompositionRoot

protected Component getCompositionRoot()
Returns the composition root.

Returns:
the Component Composition root.

setCompositionRoot

protected void setCompositionRoot(Component compositionRoot)
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.

Parameters:
compositionRoot - the root of the composition component tree.

iterator

public java.util.Iterator<Component> iterator()
Description copied from interface: HasComponents
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:
iterator in interface HasComponents
Specified by:
iterator in interface java.lang.Iterable<Component>
Returns:
the component iterator.

getComponentCount

public int getComponentCount()
Gets the number of contained components. Consistent with the iterator returned by #getComponentIterator().

Returns:
the number of contained components (zero or one)


Copyright © 2000-2011 Vaadin Ltd. All Rights Reserved.