Class AbstractSplitPanel
- java.lang.Object
-
- com.vaadin.server.AbstractClientConnector
-
- com.vaadin.ui.AbstractComponent
-
- com.vaadin.ui.AbstractComponentContainer
-
- com.vaadin.ui.AbstractSplitPanel
-
- All Implemented Interfaces:
ContextClickEvent.ContextClickNotifier
,MethodEventSource
,ClientConnector
,Sizeable
,Connector
,Component
,ComponentContainer
,HasComponents
,HasComponents.ComponentAttachDetachNotifier
,Serializable
,Iterable<Component>
- Direct Known Subclasses:
HorizontalSplitPanel
,VerticalSplitPanel
public abstract class AbstractSplitPanel extends AbstractComponentContainer
AbstractSplitPanel.AbstractSplitPanel
is base class for a component container that can contain two components. The components are split by a divider element.- Since:
- 6.5
- Author:
- Vaadin Ltd.
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AbstractSplitPanel.SplitPositionChangeEvent
Event that indicates a change in SplitPanel's splitter position.static interface
AbstractSplitPanel.SplitPositionChangeListener
Interface for listening forAbstractSplitPanel.SplitPositionChangeEvent
s fired by a SplitPanel.static class
AbstractSplitPanel.SplitterClickEvent
static interface
AbstractSplitPanel.SplitterClickListener
SplitterClickListener
interface for listening forSplitterClickEvent
fired by aSplitPanel
.-
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.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 AbstractSplitPanel()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addComponent(Component c)
Add a component into this container.void
addListener(AbstractSplitPanel.SplitterClickListener listener)
Deprecated.As of 7.0, replaced byaddSplitterClickListener(SplitterClickListener)
void
addSplitPositionChangeListener(AbstractSplitPanel.SplitPositionChangeListener listener)
Register a listener to handleAbstractSplitPanel.SplitPositionChangeEvent
s.void
addSplitterClickListener(AbstractSplitPanel.SplitterClickListener listener)
int
getComponentCount()
Gets the number of contained components.protected Collection<String>
getCustomAttributes()
Returns a collection of attributes that should not be handled by the basic implementation of theAbstractComponent.readDesign(org.jsoup.nodes.Element,com.vaadin.ui.declarative.DesignContext)
andAbstractComponent.writeDesign(org.jsoup.nodes.Element,com.vaadin.ui.declarative.DesignContext)
methods.Component
getFirstComponent()
Gets the first component of this split panel.float
getMaxSplitPosition()
Returns the current maximum position of the splitter, ingetMaxSplitPositionUnit()
units.Sizeable.Unit
getMaxSplitPositionUnit()
Returns the unit of the maximum position of the splitterfloat
getMinSplitPosition()
Returns the current minimum position of the splitter, ingetMinSplitPositionUnit()
units.Sizeable.Unit
getMinSplitPositionUnit()
Returns the unit of the minimum position of the splitter.Component
getSecondComponent()
Gets the second component of this split panel.float
getSplitPosition()
Returns the current position of the splitter, ingetSplitPositionUnit()
units.Sizeable.Unit
getSplitPositionUnit()
Returns the unit of position of the splitterprotected AbstractSplitPanelState
getState()
Returns the shared state bean with information to be sent from the server to the client.protected AbstractSplitPanelState
getState(boolean markAsDirty)
Returns the shared state for this connector.boolean
isLocked()
Is the SplitPanel handle locked (user not allowed to change split position by dragging).boolean
isSplitPositionReversed()
Is the split position reversed.Iterator<Component>
iterator()
Gets an iterator to the collection of contained components.void
readDesign(org.jsoup.nodes.Element design, DesignContext designContext)
Reads the component state from the given design.void
removeComponent(Component c)
Removes the component from this container.void
removeListener(AbstractSplitPanel.SplitterClickListener listener)
Deprecated.As of 7.0, replaced byremoveSplitterClickListener(SplitterClickListener)
void
removeSplitPositionChangeListener(AbstractSplitPanel.SplitPositionChangeListener listener)
void
removeSplitterClickListener(AbstractSplitPanel.SplitterClickListener listener)
void
replaceComponent(Component oldComponent, Component newComponent)
Replaces the component in the container with another one without changing position.void
setFirstComponent(Component c)
Sets the first component of this split panel.void
setLocked(boolean locked)
Lock the SplitPanels position, disabling the user from dragging the split handle.void
setMaxSplitPosition(float pos, Sizeable.Unit unit)
Sets the maximum split position to the given position and unit.void
setMinSplitPosition(float pos, Sizeable.Unit unit)
Sets the minimum split position to the given position and unit.void
setSecondComponent(Component c)
Sets the second component of this split panel.void
setSplitPosition(float pos)
Moves the position of the splitter.void
setSplitPosition(float pos, boolean reverse)
Moves the position of the splitter.void
setSplitPosition(float pos, Sizeable.Unit unit)
Moves the position of the splitter with given position and unit.void
setSplitPosition(float pos, Sizeable.Unit unit, boolean reverse)
Moves the position of the splitter with given position and unit.void
writeDesign(org.jsoup.nodes.Element design, DesignContext designContext)
Writes the component state to the given design.-
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, beforeClientResponse, detach, findAncestor, fireComponentErrorEvent, fireComponentEvent, focus, getActionManager, getCaption, getComponentError, getData, getDebugId, getDescription, getErrorMessage, getExplicitImmediateValue, getHeight, getHeightUnits, getIcon, getId, getLocale, getParent, getPrimaryStyleName, 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, beforeClientResponse, 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.shared.Connector
getConnectorId
-
Methods inherited from interface com.vaadin.server.Sizeable
getHeight, getHeightUnits, getWidth, getWidthUnits, setHeight, setHeightUndefined, setSizeFull, setSizeUndefined, setWidth, setWidthUndefined
-
-
-
-
Method Detail
-
addComponent
public void addComponent(Component c)
Add a component into this container. The component is added to the right or under the previous component.- Specified by:
addComponent
in interfaceComponentContainer
- Overrides:
addComponent
in classAbstractComponentContainer
- Parameters:
c
- the component to be added.- See Also:
ComponentContainer.addComponent(Component)
-
setFirstComponent
public void setFirstComponent(Component c)
Sets the first component of this split panel. Depending on the direction the first component is shown at the top or to the left.- Parameters:
c
- The component to use as first component
-
setSecondComponent
public void setSecondComponent(Component c)
Sets the second component of this split panel. Depending on the direction the second component is shown at the bottom or to the right.- Parameters:
c
- The component to use as second component
-
getFirstComponent
public Component getFirstComponent()
Gets the first component of this split panel. Depending on the direction this is either the component shown at the top or to the left.- Returns:
- the first component of this split panel
-
getSecondComponent
public Component getSecondComponent()
Gets the second component of this split panel. Depending on the direction this is either the component shown at the top or to the left.- Returns:
- the second component of this split panel
-
removeComponent
public void removeComponent(Component c)
Removes the component from this container.- Specified by:
removeComponent
in interfaceComponentContainer
- Overrides:
removeComponent
in classAbstractComponentContainer
- Parameters:
c
- the component to be removed.- See Also:
ComponentContainer.removeComponent(Component)
-
iterator
public 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.- Returns:
- the component iterator.
-
getComponentCount
public int getComponentCount()
Gets the number of contained components. Consistent with the iterator returned byAbstractComponentContainer.getComponentIterator()
.- Returns:
- the number of contained components (zero, one or two)
-
replaceComponent
public void replaceComponent(Component oldComponent, Component newComponent)
Description copied from interface:ComponentContainer
Replaces the component in the container with another one without changing position.This method replaces component with another one is such way that the new component overtakes the position of the old component. If the old component is not in the container, the new component is added to the container. If the both component are already in the container, their positions are swapped. Component attach and detach events should be taken care as with add and remove.
- Parameters:
oldComponent
- the old component that will be replaced.newComponent
- the new component to be replaced.
-
setSplitPosition
public void setSplitPosition(float pos)
Moves the position of the splitter.- Parameters:
pos
- the new size of the first region in the unit that was last used (default is percentage). Fractions are only allowed when unit is percentage.
-
setSplitPosition
public void setSplitPosition(float pos, boolean reverse)
Moves the position of the splitter.- Parameters:
pos
- the new size of the region in the unit that was last used (default is percentage). Fractions are only allowed when unit is percentage.reverse
- if set to true the split splitter position is measured by the second region else it is measured by the first region
-
setSplitPosition
public void setSplitPosition(float pos, Sizeable.Unit unit)
Moves the position of the splitter with given position and unit.- Parameters:
pos
- the new size of the first region. Fractions are only allowed when unit is percentage.unit
- the unit (fromSizeable
) in which the size is given.
-
setSplitPosition
public void setSplitPosition(float pos, Sizeable.Unit unit, boolean reverse)
Moves the position of the splitter with given position and unit.- Parameters:
pos
- the new size of the first region. Fractions are only allowed when unit is percentage.unit
- the unit (fromSizeable
) in which the size is given.reverse
- if set to true the split splitter position is measured by the second region else it is measured by the first region
-
getSplitPosition
public float getSplitPosition()
Returns the current position of the splitter, ingetSplitPositionUnit()
units.- Returns:
- position of the splitter
-
getSplitPositionUnit
public Sizeable.Unit getSplitPositionUnit()
Returns the unit of position of the splitter- Returns:
- unit of position of the splitter
- See Also:
setSplitPosition(float, Unit)
-
isSplitPositionReversed
public boolean isSplitPositionReversed()
Is the split position reversed. By default the split position is measured by the first region, but if split position is reversed the measuring is done by the second region instead.- Returns:
true
if reversed,false
otherwise.- Since:
- 7.3.6
- See Also:
setSplitPosition(float, boolean)
-
setMinSplitPosition
public void setMinSplitPosition(float pos, Sizeable.Unit unit)
Sets the minimum split position to the given position and unit. If the split position is reversed, maximum and minimum are also reversed.- Parameters:
pos
- the minimum position of the splitunit
- the unit (fromSizeable
) in which the size is given. Allowed units are UNITS_PERCENTAGE and UNITS_PIXELS
-
getMinSplitPosition
public float getMinSplitPosition()
Returns the current minimum position of the splitter, ingetMinSplitPositionUnit()
units.- Returns:
- the minimum position of the splitter
-
getMinSplitPositionUnit
public Sizeable.Unit getMinSplitPositionUnit()
Returns the unit of the minimum position of the splitter.- Returns:
- the unit of the minimum position of the splitter
-
setMaxSplitPosition
public void setMaxSplitPosition(float pos, Sizeable.Unit unit)
Sets the maximum split position to the given position and unit. If the split position is reversed, maximum and minimum are also reversed.- Parameters:
pos
- the maximum position of the splitunit
- the unit (fromSizeable
) in which the size is given. Allowed units are UNITS_PERCENTAGE and UNITS_PIXELS
-
getMaxSplitPosition
public float getMaxSplitPosition()
Returns the current maximum position of the splitter, ingetMaxSplitPositionUnit()
units.- Returns:
- the maximum position of the splitter
-
getMaxSplitPositionUnit
public Sizeable.Unit getMaxSplitPositionUnit()
Returns the unit of the maximum position of the splitter- Returns:
- the unit of the maximum position of the splitter
-
setLocked
public void setLocked(boolean locked)
Lock the SplitPanels position, disabling the user from dragging the split handle.- Parameters:
locked
- Settrue
if locked,false
otherwise.
-
isLocked
public boolean isLocked()
Is the SplitPanel handle locked (user not allowed to change split position by dragging).- Returns:
true
if locked,false
otherwise.
-
addSplitterClickListener
public void addSplitterClickListener(AbstractSplitPanel.SplitterClickListener listener)
-
addListener
@Deprecated public void addListener(AbstractSplitPanel.SplitterClickListener listener)
Deprecated.As of 7.0, replaced byaddSplitterClickListener(SplitterClickListener)
-
removeSplitterClickListener
public void removeSplitterClickListener(AbstractSplitPanel.SplitterClickListener listener)
-
removeListener
@Deprecated public void removeListener(AbstractSplitPanel.SplitterClickListener listener)
Deprecated.As of 7.0, replaced byremoveSplitterClickListener(SplitterClickListener)
-
addSplitPositionChangeListener
public void addSplitPositionChangeListener(AbstractSplitPanel.SplitPositionChangeListener listener)
Register a listener to handleAbstractSplitPanel.SplitPositionChangeEvent
s.- Parameters:
listener
-AbstractSplitPanel.SplitPositionChangeListener
to be registered.- Since:
- 7.5.0
-
removeSplitPositionChangeListener
public void removeSplitPositionChangeListener(AbstractSplitPanel.SplitPositionChangeListener listener)
- Parameters:
listener
- SplitPositionChangeListener to be removed.- Since:
- 7.5.0
-
getState
protected AbstractSplitPanelState 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 classAbstractComponent
- Returns:
- updated component shared state
-
getState
protected AbstractSplitPanelState getState(boolean markAsDirty)
Description copied from class:AbstractClientConnector
Returns the shared state for this connector.- Overrides:
getState
in classAbstractComponent
- Parameters:
markAsDirty
- true if the connector should automatically be marked dirty, false otherwise- Returns:
- The shared state for this connector. Never null.
- See Also:
AbstractClientConnector.getState()
-
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
-
getCustomAttributes
protected Collection<String> getCustomAttributes()
Description copied from class:AbstractComponent
Returns a collection of attributes that should not be handled by the basic implementation of theAbstractComponent.readDesign(org.jsoup.nodes.Element,com.vaadin.ui.declarative.DesignContext)
andAbstractComponent.writeDesign(org.jsoup.nodes.Element,com.vaadin.ui.declarative.DesignContext)
methods. Typically these are handled in a custom way in the overridden versions of the above methods- Overrides:
getCustomAttributes
in classAbstractComponent
- Returns:
- the collection of attributes that are not handled by the basic implementation
-
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
-
-