com.vaadin.ui
Class CustomComponent

java.lang.Object
  extended by com.vaadin.terminal.AbstractClientConnector
      extended by com.vaadin.ui.AbstractComponent
          extended by com.vaadin.ui.AbstractComponentContainer
              extended by com.vaadin.ui.CustomComponent
All Implemented Interfaces:
MethodEventSource, Connector, ClientConnector, RpcTarget, Sizeable, Component, ComponentContainer, HasComponents, Serializable, Iterable<Component>
Direct Known Subclasses:
DragAndDropWrapper, LoginForm, Navigator.SimpleViewDisplay

public class CustomComponent
extends AbstractComponentContainer

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

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.Sizeable
Sizeable.Unit
 
Field Summary
 
Fields inherited from interface com.vaadin.terminal.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
 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.
protected  Component getCompositionRoot()
          Returns the composition root.
 void moveComponentsFrom(ComponentContainer source)
          This method is not supported by CustomComponent.
 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.
protected  void setCompositionRoot(Component compositionRoot)
          Sets the compositions root.
 
Methods inherited from class com.vaadin.ui.AbstractComponentContainer
addListener, addListener, fireComponentAttachEvent, fireComponentDetachEvent, isComponentVisible, iterator, removeListener, removeListener, setHeight, setVisible, setWidth
 
Methods inherited from class com.vaadin.ui.AbstractComponent
addListener, addListener, addListener, addListener, addShortcutListener, addStyleName, attach, detach, findAncestor, fireComponentErrorEvent, fireComponentEvent, fireEvent, focus, getActionManager, getApplication, getCaption, getComponentError, getData, getDebugId, getDescription, getErrorHandler, getErrorMessage, getHeight, getHeightUnits, getIcon, getListeners, getLocale, getParent, getRoot, getState, getStyle, getStyleName, getWidth, getWidthUnits, handleError, hasListeners, isConnectorEnabled, isEnabled, isImmediate, isReadOnly, isVisible, removeListener, removeListener, removeListener, removeListener, removeListener, removeShortcutListener, removeStyleName, requestRepaint, setCaption, setComponentError, setData, setDebugId, setDescription, setEnabled, setErrorHandler, setHeight, setIcon, setImmediate, setLocale, setParent, setReadOnly, setSizeFull, setSizeUndefined, setStyle, setStyleName, setWidth, updateState
 
Methods inherited from class com.vaadin.terminal.AbstractClientConnector
addExtension, addMethodInvocationToQueue, createState, getAllChildrenIterable, getConnectorId, getExtensions, getRpcManager, getRpcProxy, getStateType, registerRpc, registerRpc, removeExtension, requestRepaintAll, retrievePendingRpcCalls
 
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, getApplication, getCaption, getDebugId, getIcon, getLocale, getParent, getRoot, getState, getStyleName, isEnabled, isReadOnly, isVisible, removeListener, removeStyleName, setCaption, setDebugId, setEnabled, setIcon, setReadOnly, setStyleName, updateState
 
Methods inherited from interface com.vaadin.terminal.gwt.server.ClientConnector
detach, getExtensions, getStateType, isConnectorEnabled, removeExtension, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setParent
 
Methods inherited from interface com.vaadin.terminal.gwt.client.Connector
getConnectorId
 
Methods inherited from interface com.vaadin.terminal.gwt.server.RpcTarget
getRpcManager
 
Methods inherited from interface com.vaadin.terminal.Sizeable
getHeight, getHeightUnits, getWidth, getWidthUnits, setHeight, setSizeFull, setSizeUndefined, 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.

getComponentIterator

public Iterator<Component> getComponentIterator()
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.

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)

replaceComponent

public void replaceComponent(Component oldComponent,
                             Component newComponent)
This method is not supported by CustomComponent.

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)

addComponent

public void addComponent(Component c)
This method is not supported by CustomComponent. Use setCompositionRoot(Component) to set CustomComponents "child".

Specified by:
addComponent in interface ComponentContainer
Overrides:
addComponent in class AbstractComponentContainer
Parameters:
c - the component to be added.
See Also:
AbstractComponentContainer.addComponent(com.vaadin.ui.Component)

moveComponentsFrom

public void moveComponentsFrom(ComponentContainer source)
This method is not supported by CustomComponent.

Specified by:
moveComponentsFrom in interface ComponentContainer
Overrides:
moveComponentsFrom in class AbstractComponentContainer
Parameters:
source - the container which contains the components that are to be moved to this container.
See Also:
AbstractComponentContainer.moveComponentsFrom(com.vaadin.ui.ComponentContainer)

removeAllComponents

public void removeAllComponents()
This method is not supported by CustomComponent.

Specified by:
removeAllComponents in interface ComponentContainer
Overrides:
removeAllComponents in class AbstractComponentContainer
See Also:
AbstractComponentContainer.removeAllComponents()

removeComponent

public void removeComponent(Component c)
This method is not supported by CustomComponent.

Specified by:
removeComponent in interface ComponentContainer
Overrides:
removeComponent in class AbstractComponentContainer
Parameters:
c - the component to be removed.
See Also:
AbstractComponentContainer.removeComponent(com.vaadin.ui.Component)


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