Class AbsoluteLayout
-
- All Implemented Interfaces:
ContextClickEvent.ContextClickNotifier
,LayoutEvents.LayoutClickNotifier
,MethodEventSource
,ClientConnector
,Sizeable
,Connector
,Component
,ComponentContainer
,HasComponents
,HasComponents.ComponentAttachDetachNotifier
,Layout
,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
Nested Classes Modifier and Type Class Description class
AbsoluteLayout.ComponentPosition
The CompontPosition class represents a components position within the absolute layout.-
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.ui.Component
Component.ErrorEvent, Component.Event, Component.Focusable, Component.Listener
-
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.Layout
Layout.AlignmentHandler, Layout.MarginHandler, Layout.SpacingHandler
-
Nested classes/interfaces inherited from interface com.vaadin.server.Sizeable
Sizeable.Unit
-
-
Field Summary
-
Fields inherited from class com.vaadin.ui.AbstractComponent
DESIGN_ATTR_PLAIN_TEXT
-
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
Constructors Constructor Description AbsoluteLayout()
Creates an AbsoluteLayout with full size.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description 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
addLayoutClickListener(LayoutEvents.LayoutClickListener listener)
Add a click listener to the layout.void
addListener(LayoutEvents.LayoutClickListener listener)
Deprecated.As of 7.0, replaced byaddLayoutClickListener(LayoutClickListener)
void
beforeClientResponse(boolean initial)
Called before the shared state and RPC invocations are sent to the client.int
getComponentCount()
Gets the number of contained components.AbsoluteLayout.ComponentPosition
getPosition(Component component)
Gets the position of a component in the layout.protected AbsoluteLayoutState
getState()
Returns the shared state bean with information to be sent from the server to the client.Iterator<Component>
iterator()
Gets an iterator for going through all components enclosed in the absolute layout.void
readDesign(org.jsoup.nodes.Element design, DesignContext designContext)
Reads the component state from the given design.void
removeComponent(Component c)
This only implements the events and component parent calls.void
removeLayoutClickListener(LayoutEvents.LayoutClickListener listener)
Removes an LayoutClickListener.void
removeListener(LayoutEvents.LayoutClickListener listener)
Deprecated.As of 7.0, replaced byremoveLayoutClickListener(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
writeDesign(org.jsoup.nodes.Element design, DesignContext designContext)
Writes the component state to the given design.-
Methods inherited from class com.vaadin.ui.AbstractLayout
readMargin, writeMargin
-
Methods inherited from class com.vaadin.ui.AbstractComponentContainer
addComponentAttachListener, addComponentDetachListener, addComponents, addListener, addListener, fireComponentAttachEvent, fireComponentDetachEvent, getComponentIterator, moveComponentsFrom, removeAllComponents, removeComponentAttachListener, removeComponentDetachListener, removeListener, removeListener, setHeight, setWidth
-
Methods inherited from class com.vaadin.ui.AbstractComponent
addContextClickListener, addListener, addShortcutListener, addStyleName, attach, detach, findAncestor, fireComponentErrorEvent, fireComponentEvent, focus, getActionManager, getCaption, getComponentError, getCustomAttributes, getData, getDebugId, getDescription, getErrorMessage, getExplicitImmediateValue, getHeight, getHeightUnits, getIcon, getId, getLocale, getParent, getPrimaryStyleName, getState, getStyleName, getWidth, getWidthUnits, isCaptionAsHtml, isConnectorEnabled, isEnabled, isImmediate, isOrHasAncestor, isReadOnly, isResponsive, isVisible, removeContextClickListener, removeListener, removeShortcutListener, removeStyleName, setCaption, setCaptionAsHtml, setComponentError, setData, setDebugId, setDescription, setEnabled, setHeight, setHeightUndefined, setIcon, setId, setImmediate, setLocale, setParent, setPrimaryStyleName, setReadOnly, setResponsive, setSizeFull, setSizeUndefined, setStyleName, setStyleName, setVisible, setWidth, setWidthUndefined
-
Methods inherited from class com.vaadin.server.AbstractClientConnector
addAttachListener, addDetachListener, addExtension, addListener, addListener, addListener, addMethodInvocationToQueue, createState, encodeState, equals, fireEvent, getAllChildrenIterable, getConnectorId, getErrorHandler, getExtensions, getListeners, getResource, getRpcManager, getRpcProxy, getSession, getStateType, getUI, handleConnectorRequest, hashCode, hasListeners, isAttached, isThis, markAsDirty, markAsDirtyRecursive, registerRpc, registerRpc, removeAttachListener, removeDetachListener, removeExtension, removeListener, removeListener, removeListener, removeListener, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler, setResource
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.vaadin.server.ClientConnector
addAttachListener, addDetachListener, detach, encodeState, getErrorHandler, getExtensions, getRpcManager, getStateType, handleConnectorRequest, isAttached, isConnectorEnabled, markAsDirty, markAsDirtyRecursive, removeAttachListener, removeDetachListener, removeExtension, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler
-
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, setParent, setPrimaryStyleName, setReadOnly, setStyleName, setVisible
-
Methods inherited from interface com.vaadin.ui.ComponentContainer
addComponents, addListener, addListener, getComponentIterator, moveComponentsFrom, removeAllComponents, removeListener, removeListener
-
Methods inherited from interface com.vaadin.shared.Connector
getConnectorId
-
Methods inherited from interface com.vaadin.ui.HasComponents.ComponentAttachDetachNotifier
addComponentAttachListener, addComponentDetachListener, removeComponentAttachListener, removeComponentDetachListener
-
Methods inherited from interface com.vaadin.server.Sizeable
getHeight, getHeightUnits, getWidth, getWidthUnits, setHeight, setHeight, setHeightUndefined, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthUndefined
-
-
-
-
Method Detail
-
getState
protected 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().- Overrides:
getState
in classAbstractLayout
- Returns:
- updated component shared state
-
iterator
public Iterator<Component> iterator()
Gets an iterator for going through all components enclosed in the absolute layout.- Specified by:
iterator
in interfaceHasComponents
- Specified by:
iterator
in interfaceIterable<Component>
- Returns:
- the component iterator.
-
getComponentCount
public int getComponentCount()
Gets the number of contained components. Consistent with the iterator returned byAbstractComponentContainer.getComponentIterator()
.- Specified by:
getComponentCount
in interfaceComponentContainer
- 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 interfaceComponentContainer
- 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 interfaceComponentContainer
- Overrides:
addComponent
in classAbstractComponentContainer
- 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 layoutcssPosition
- The css position string
-
beforeClientResponse
public void beforeClientResponse(boolean initial)
Description copied from interface:ClientConnector
Called before the shared state and RPC invocations are sent to the client. Gives the connector an opportunity to set computed/dynamic state values or to invoke last minute RPC methods depending on other component features.- Specified by:
beforeClientResponse
in interfaceClientConnector
- Overrides:
beforeClientResponse
in classAbstractComponent
- Parameters:
initial
-true
if the client-side connector will be created and initialized after this method has been invoked.false
if there is already an initialized client-side connector.
-
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 interfaceComponentContainer
- Overrides:
removeComponent
in classAbstractComponentContainer
- 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 updatedAbsoluteLayout.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
-
-
addLayoutClickListener
public void addLayoutClickListener(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 theLayoutEvents.LayoutClickEvent
. UseLayoutEvents.LayoutClickNotifier.removeListener(LayoutClickListener)
to remove the listener.- Specified by:
addLayoutClickListener
in interfaceLayoutEvents.LayoutClickNotifier
- Parameters:
listener
- The listener to add
-
addListener
@Deprecated public void addListener(LayoutEvents.LayoutClickListener listener)
Deprecated.As of 7.0, replaced byaddLayoutClickListener(LayoutClickListener)
- Specified by:
addListener
in interfaceLayoutEvents.LayoutClickNotifier
-
removeLayoutClickListener
public void removeLayoutClickListener(LayoutEvents.LayoutClickListener listener)
Description copied from interface:LayoutEvents.LayoutClickNotifier
Removes an LayoutClickListener.- Specified by:
removeLayoutClickListener
in interfaceLayoutEvents.LayoutClickNotifier
- Parameters:
listener
- LayoutClickListener to be removed
-
removeListener
@Deprecated public void removeListener(LayoutEvents.LayoutClickListener listener)
Deprecated.As of 7.0, replaced byremoveLayoutClickListener(LayoutClickListener)
- Specified by:
removeListener
in interfaceLayoutEvents.LayoutClickNotifier
-
readDesign
public void readDesign(org.jsoup.nodes.Element design, DesignContext designContext)
Description copied from interface:Component
Reads the component state from the given design.The component is responsible not only for updating its own state but also for ensuring that its children update their state based on the design.
It is assumed that the component is in its default state when this method is called. Reading should only take into consideration attributes specified in the design and not reset any unspecified attributes to their defaults.
This method must not modify the design.
- Specified by:
readDesign
in interfaceComponent
- Overrides:
readDesign
in classAbstractComponent
- Parameters:
design
- The element to obtain the state fromdesignContext
- The DesignContext instance used for parsing the design
-
writeDesign
public void writeDesign(org.jsoup.nodes.Element design, DesignContext designContext)
Description copied from interface:Component
Writes the component state to the given design.The component is responsible not only for writing its own state but also for ensuring that its children write their state to the design.
This method must not modify the component state.
- Specified by:
writeDesign
in interfaceComponent
- Overrides:
writeDesign
in classAbstractComponent
- Parameters:
design
- The element to write the component state to. Any previous attributes or child nodes are not cleared.designContext
- The DesignContext instance used for writing the design
-
-