com.vaadin.ui
Class AbsoluteLayout

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.AbstractLayout
                  extended by com.vaadin.ui.AbsoluteLayout
All Implemented Interfaces:
LayoutEvents.LayoutClickNotifier, MethodEventSource, Connector, ClientConnector, RpcTarget, Sizeable, Component, ComponentContainer, HasComponents, Layout, Layout.MarginHandler, Serializable, Iterable<Component>

public class AbsoluteLayout
extends AbstractLayout
implements LayoutEvents.LayoutClickNotifier

AbsoluteLayout is a layout implementation that mimics html absolute positioning.

See Also:
Serialized Form

Nested Class Summary
 class AbsoluteLayout.ComponentPosition
          The CompontPosition class represents a components position within the absolute layout.
 
Nested classes/interfaces inherited from class com.vaadin.ui.AbstractComponent
AbstractComponent.ComponentErrorEvent, AbstractComponent.ComponentErrorHandler
 
Nested classes/interfaces inherited from interface com.vaadin.ui.Layout
Layout.AlignmentHandler, Layout.MarginHandler, Layout.MarginInfo, Layout.SpacingHandler
 
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 class com.vaadin.ui.AbstractLayout
margins
 
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
AbsoluteLayout()
          Creates an AbsoluteLayout with full size.
 
Method Summary
 void addComponent(Component c)
          This only implements the events and component parent calls.
 void addComponent(Component c, String cssPosition)
          Adds a component to the layout.
 void addListener(LayoutEvents.LayoutClickListener listener)
          Add a click listener to the layout.
 int getComponentCount()
          Gets the number of contained components.
 Iterator<Component> getComponentIterator()
          Gets an iterator for going through all components enclosed in the absolute layout.
 AbsoluteLayout.ComponentPosition getPosition(Component component)
          Gets the position of a component in the layout.
 AbsoluteLayoutState getState()
          Returns the shared state bean with information to be sent from the server to the client.
 void removeComponent(Component c)
          This only implements the events and component parent calls.
 void removeListener(LayoutEvents.LayoutClickListener listener)
          Removes an LayoutClickListener.
 void replaceComponent(Component oldComponent, Component newComponent)
          Replaces one component with another one.
 void setPosition(Component component, AbsoluteLayout.ComponentPosition position)
          Sets the position of a component in the layout.
 void updateState()
          Called before the shared state is sent to the client.
 
Methods inherited from class com.vaadin.ui.AbstractLayout
getMargin, setMargin, setMargin, setMargin
 
Methods inherited from class com.vaadin.ui.AbstractComponentContainer
addListener, addListener, fireComponentAttachEvent, fireComponentDetachEvent, isComponentVisible, iterator, moveComponentsFrom, removeAllComponents, 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, 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
 
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.ComponentContainer
addListener, addListener, moveComponentsFrom, removeAllComponents, removeListener, removeListener
 
Methods inherited from interface com.vaadin.ui.HasComponents
isComponentVisible
 
Methods inherited from interface com.vaadin.ui.Component
addListener, addStyleName, attach, getApplication, getCaption, getDebugId, getIcon, getLocale, getParent, getRoot, getStyleName, isEnabled, isReadOnly, isVisible, removeListener, removeStyleName, setCaption, setDebugId, setEnabled, setIcon, setReadOnly, setStyleName, setVisible
 
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, setHeight, setSizeFull, setSizeUndefined, setWidth, setWidth
 
Methods inherited from interface java.lang.Iterable
iterator
 

Constructor Detail

AbsoluteLayout

public AbsoluteLayout()
Creates an AbsoluteLayout with full size.

Method Detail

getState

public AbsoluteLayoutState getState()
Description copied from class: AbstractComponent
Returns the shared state bean with information to be sent from the server to the client. Subclasses should override this method and set any relevant fields of the state returned by super.getState().

Specified by:
getState in interface Connector
Specified by:
getState in interface Component
Overrides:
getState in class AbstractLayout
Returns:
updated component shared state

getComponentIterator

public Iterator<Component> getComponentIterator()
Gets an iterator for going through all components enclosed in the absolute layout.

Specified by:
getComponentIterator in interface HasComponents
Returns:
the component iterator.

getComponentCount

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

Specified by:
getComponentCount in interface ComponentContainer
Returns:
the number of contained components

replaceComponent

public void replaceComponent(Component oldComponent,
                             Component newComponent)
Replaces one component with another one. The new component inherits the old components position.

Specified by:
replaceComponent in interface ComponentContainer
Parameters:
oldComponent - the old component that will be replaced.
newComponent - the new component to be replaced.

addComponent

public void addComponent(Component c)
Description copied from class: AbstractComponentContainer
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.

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

addComponent

public void addComponent(Component c,
                         String cssPosition)
Adds a component to the layout. The component can be positioned by providing a string formatted in CSS-format.

For example the string "top:10px;left:10px" will position the component 10 pixels from the left and 10 pixels from the top. The identifiers: "top","left","right" and "bottom" can be used to specify the position.

Parameters:
c - The component to add to the layout
cssPosition - The css position string

updateState

public void updateState()
Description copied from interface: Component
Called before the shared state is sent to the client. Gives the component an opportunity to set computed/dynamic state values e.g. state values that depend on other component features.

This method must not alter the component hierarchy in any way.

Specified by:
updateState in interface Component
Overrides:
updateState in class AbstractComponent

removeComponent

public void removeComponent(Component c)
Description copied from class: AbstractComponentContainer
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.

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

getPosition

public AbsoluteLayout.ComponentPosition getPosition(Component component)
Gets the position of a component in the layout. Returns null if component is not attached to the layout.

Note that you cannot update the position by updating this object. Call setPosition(Component, ComponentPosition) with the updated AbsoluteLayout.ComponentPosition object.

Parameters:
component - The component which position is needed
Returns:
An instance of ComponentPosition containing the position of the component, or null if the component is not enclosed in the layout.

setPosition

public void setPosition(Component component,
                        AbsoluteLayout.ComponentPosition position)
Sets the position of a component in the layout.

Parameters:
component -
position -

addListener

public void addListener(LayoutEvents.LayoutClickListener listener)
Description copied from interface: LayoutEvents.LayoutClickNotifier
Add a click listener to the layout. The listener is called whenever the user clicks inside the layout. An event is also triggered when the click targets a component inside a nested layout or Panel, provided the targeted component does not prevent the click event from propagating. A caption is not considered part of a component. The child component that was clicked is included in the LayoutEvents.LayoutClickEvent. Use #removeListener(LayoutClickListener) to remove the listener.

Specified by:
addListener in interface LayoutEvents.LayoutClickNotifier
Parameters:
listener - The listener to add

removeListener

public void removeListener(LayoutEvents.LayoutClickListener listener)
Description copied from interface: LayoutEvents.LayoutClickNotifier
Removes an LayoutClickListener.

Specified by:
removeListener in interface LayoutEvents.LayoutClickNotifier
Parameters:
listener - LayoutClickListener to be removed


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