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 classAbsoluteLayout.ComponentPositionThe 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 voidaddComponent(Component c)This only implements the events and component parent calls.voidaddComponent(Component c, String cssPosition)Adds a component to the layout.voidaddLayoutClickListener(LayoutEvents.LayoutClickListener listener)Add a click listener to the layout.voidaddListener(LayoutEvents.LayoutClickListener listener)Deprecated.As of 7.0, replaced byaddLayoutClickListener(LayoutClickListener)voidbeforeClientResponse(boolean initial)Called before the shared state and RPC invocations are sent to the client.intgetComponentCount()Gets the number of contained components.AbsoluteLayout.ComponentPositiongetPosition(Component component)Gets the position of a component in the layout.protected AbsoluteLayoutStategetState()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.voidreadDesign(org.jsoup.nodes.Element design, DesignContext designContext)Reads the component state from the given design.voidremoveComponent(Component c)This only implements the events and component parent calls.voidremoveLayoutClickListener(LayoutEvents.LayoutClickListener listener)Removes an LayoutClickListener.voidremoveListener(LayoutEvents.LayoutClickListener listener)Deprecated.As of 7.0, replaced byremoveLayoutClickListener(LayoutClickListener)voidreplaceComponent(Component oldComponent, Component newComponent)Replaces one component with another one.voidsetPosition(Component component, AbsoluteLayout.ComponentPosition position)Sets the position of a component in the layout.voidwriteDesign(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 java.lang.Iterable
forEach, spliterator
-
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:AbstractComponentReturns 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:
getStatein 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:
iteratorin interfaceHasComponents- Specified by:
iteratorin 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:
getComponentCountin 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:
replaceComponentin 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:AbstractComponentContainerThis 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:
addComponentin interfaceComponentContainer- Overrides:
addComponentin 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:ClientConnectorCalled 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:
beforeClientResponsein interfaceClientConnector- Overrides:
beforeClientResponsein classAbstractComponent- Parameters:
initial-trueif the client-side connector will be created and initialized after this method has been invoked.falseif there is already an initialized client-side connector.
-
removeComponent
public void removeComponent(Component c)
Description copied from class:AbstractComponentContainerThis 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:
removeComponentin interfaceComponentContainer- Overrides:
removeComponentin 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.ComponentPositionobject.- 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.LayoutClickNotifierAdd 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:
addLayoutClickListenerin 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:
addListenerin interfaceLayoutEvents.LayoutClickNotifier
-
removeLayoutClickListener
public void removeLayoutClickListener(LayoutEvents.LayoutClickListener listener)
Description copied from interface:LayoutEvents.LayoutClickNotifierRemoves an LayoutClickListener.- Specified by:
removeLayoutClickListenerin 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:
removeListenerin interfaceLayoutEvents.LayoutClickNotifier
-
readDesign
public void readDesign(org.jsoup.nodes.Element design, DesignContext designContext)Description copied from interface:ComponentReads 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:
readDesignin interfaceComponent- Overrides:
readDesignin 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:ComponentWrites 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:
writeDesignin interfaceComponent- Overrides:
writeDesignin 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
-
-