public abstract class AbstractSplitPanel extends AbstractComponentContainer
AbstractSplitPanel
is base class for a component container that
can contain two components. The components are split by a divider element.Modifier and Type | Class and Description |
---|---|
static class |
AbstractSplitPanel.SplitPositionChangeEvent
Event that indicates a change in SplitPanel's splitter position.
|
static interface |
AbstractSplitPanel.SplitPositionChangeListener
Interface for listening for
AbstractSplitPanel.SplitPositionChangeEvent s fired by a
SplitPanel. |
static class |
AbstractSplitPanel.SplitterClickEvent |
static interface |
AbstractSplitPanel.SplitterClickListener
SplitterClickListener interface for listening for
SplitterClickEvent fired by a SplitPanel . |
HasComponents.ComponentAttachDetachNotifier, HasComponents.ComponentAttachEvent, HasComponents.ComponentAttachListener, HasComponents.ComponentDetachEvent, HasComponents.ComponentDetachListener
Component.ErrorEvent, Component.Event, Component.Focusable, Component.Listener
ClientConnector.AttachEvent, ClientConnector.AttachListener, ClientConnector.ConnectorErrorEvent, ClientConnector.DetachEvent, ClientConnector.DetachListener
Sizeable.Unit
DESIGN_ATTR_PLAIN_TEXT
SIZE_UNDEFINED, UNITS_CM, UNITS_EM, UNITS_EX, UNITS_INCH, UNITS_MM, UNITS_PERCENTAGE, UNITS_PICAS, UNITS_PIXELS, UNITS_POINTS
Constructor and Description |
---|
AbstractSplitPanel() |
Modifier and Type | Method and Description |
---|---|
void |
addComponent(Component c)
Add a component into this container.
|
Registration |
addSplitPositionChangeListener(AbstractSplitPanel.SplitPositionChangeListener listener)
Register a listener to handle
AbstractSplitPanel.SplitPositionChangeEvent s. |
Registration |
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 the
AbstractComponent.readDesign(Element, DesignContext)
and AbstractComponent.writeDesign(Element, DesignContext) methods. |
Component |
getFirstComponent()
Gets the first component of this split panel.
|
float |
getMaxSplitPosition()
Returns the current maximum position of the splitter, in
getMaxSplitPositionUnit() units. |
Sizeable.Unit |
getMaxSplitPositionUnit()
Returns the unit of the maximum position of the splitter.
|
float |
getMinSplitPosition()
Returns the current minimum position of the splitter, in
getMinSplitPositionUnit() 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, in
getSplitPositionUnit() units. |
Sizeable.Unit |
getSplitPositionUnit()
Returns the unit of position of the splitter.
|
protected 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 |
removeSplitPositionChangeListener(AbstractSplitPanel.SplitPositionChangeListener listener)
Deprecated.
|
void |
removeSplitterClickListener(AbstractSplitPanel.SplitterClickListener listener)
Deprecated.
|
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.
|
addComponentAttachListener, addComponentDetachListener, addComponents, fireComponentAttachEvent, fireComponentDetachEvent, getComponentIterator, moveComponentsFrom, removeAllComponents, removeComponentAttachListener, removeComponentDetachListener, setHeight, setWidth
addContextClickListener, addListener, addShortcutListener, addStyleName, attach, beforeClientResponse, detach, findAncestor, fireComponentErrorEvent, fireComponentEvent, focus, getActionManager, getCaption, getComponentError, getData, getDebugId, getDescription, getErrorMessage, getHeight, getHeightUnits, getIcon, getId, getLocale, getParent, getPrimaryStyleName, getStyleName, getWidth, getWidthUnits, isCaptionAsHtml, isConnectorEnabled, isEnabled, isOrHasAncestor, isReadOnly, isRequiredIndicatorVisible, isResponsive, isVisible, removeContextClickListener, removeListener, removeShortcutListener, removeStyleName, setCaption, setCaptionAsHtml, setComponentError, setData, setDebugId, setDescription, setDescription, setEnabled, setHeight, setHeightUndefined, setIcon, setId, setLocale, setParent, setPrimaryStyleName, setReadOnly, setRequiredIndicatorVisible, setResponsive, setSizeFull, setSizeUndefined, setStyleName, setVisible, setWidth, setWidthUndefined
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, updateDiffstate
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
addListener, addStyleName, addStyleNames, attach, getCaption, getDescription, getIcon, getId, getLocale, getParent, getPrimaryStyleName, getStyleName, getUI, isEnabled, isVisible, removeListener, removeStyleName, removeStyleNames, setCaption, setEnabled, setIcon, setId, setParent, setPrimaryStyleName, setStyleName, setStyleName, setVisible
addAttachListener, addDetachListener, beforeClientResponse, detach, encodeState, getErrorHandler, getExtensions, getRpcManager, getStateType, handleConnectorRequest, isAttached, isConnectorEnabled, markAsDirty, markAsDirtyRecursive, removeAttachListener, removeDetachListener, removeExtension, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler
getConnectorId
getHeight, getHeightUnits, getWidth, getWidthUnits, setHeight, setHeightUndefined, setSizeFull, setSizeUndefined, setWidth, setWidthUndefined
forEach, spliterator
public void addComponent(Component c)
addComponent
in interface ComponentContainer
addComponent
in class AbstractComponentContainer
c
- the component to be added.ComponentContainer.addComponent(Component)
public void setFirstComponent(Component c)
c
- The component to use as first componentpublic void setSecondComponent(Component c)
c
- The component to use as second componentpublic Component getFirstComponent()
public Component getSecondComponent()
public void removeComponent(Component c)
removeComponent
in interface ComponentContainer
removeComponent
in class AbstractComponentContainer
c
- the component to be removed.ComponentContainer.removeComponent(Component)
public Iterator<Component> iterator()
public int getComponentCount()
AbstractComponentContainer.getComponentIterator()
.public void replaceComponent(Component oldComponent, Component newComponent)
ComponentContainer
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.
oldComponent
- the old component that will be replaced.newComponent
- the new component to be replaced.public void setSplitPosition(float pos)
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.public void setSplitPosition(float pos, boolean reverse)
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 regionpublic void setSplitPosition(float pos, Sizeable.Unit unit)
pos
- the new size of the first region. Fractions are only allowed
when unit is percentage.unit
- the unit (from Sizeable
) in which the size is given.public void setSplitPosition(float pos, Sizeable.Unit unit, boolean reverse)
pos
- the new size of the first region. Fractions are only allowed
when unit is percentage.unit
- the unit (from Sizeable
) 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 regionpublic float getSplitPosition()
getSplitPositionUnit()
units.public Sizeable.Unit getSplitPositionUnit()
#setSplitPosition(float, Unit)
public boolean isSplitPositionReversed()
true
if reversed, false
otherwise.setSplitPosition(float, boolean)
public void setMinSplitPosition(float pos, Sizeable.Unit unit)
pos
- the minimum position of the splitunit
- the unit (from Sizeable
) in which the size is given.
Allowed units are UNITS_PERCENTAGE and UNITS_PIXELSpublic float getMinSplitPosition()
getMinSplitPositionUnit()
units.public Sizeable.Unit getMinSplitPositionUnit()
public void setMaxSplitPosition(float pos, Sizeable.Unit unit)
pos
- the maximum position of the splitunit
- the unit (from Sizeable
) in which the size is given.
Allowed units are UNITS_PERCENTAGE and UNITS_PIXELSpublic float getMaxSplitPosition()
getMaxSplitPositionUnit()
units.public Sizeable.Unit getMaxSplitPositionUnit()
public void setLocked(boolean locked)
locked
- Set true
if locked, false
otherwise.public boolean isLocked()
true
if locked, false
otherwise.public Registration addSplitterClickListener(AbstractSplitPanel.SplitterClickListener listener)
@Deprecated public void removeSplitterClickListener(AbstractSplitPanel.SplitterClickListener listener)
public Registration addSplitPositionChangeListener(AbstractSplitPanel.SplitPositionChangeListener listener)
AbstractSplitPanel.SplitPositionChangeEvent
s.listener
- AbstractSplitPanel.SplitPositionChangeListener
to be registered.@Deprecated public void removeSplitPositionChangeListener(AbstractSplitPanel.SplitPositionChangeListener listener)
listener
- SplitPositionChangeListener to be removed.protected AbstractSplitPanelState getState()
AbstractComponent
getState
in class AbstractComponentContainer
protected AbstractSplitPanelState getState(boolean markAsDirty)
AbstractClientConnector
getState
in class AbstractComponentContainer
markAsDirty
- true if the connector should automatically be marked dirty,
false otherwiseAbstractClientConnector.getState()
public void readDesign(org.jsoup.nodes.Element design, DesignContext designContext)
Component
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.
readDesign
in interface Component
readDesign
in class AbstractComponent
design
- The element to obtain the state fromdesignContext
- The DesignContext instance used for parsing the designprotected Collection<String> getCustomAttributes()
AbstractComponent
AbstractComponent.readDesign(Element, DesignContext)
and AbstractComponent.writeDesign(Element, DesignContext)
methods. Typically these
are handled in a custom way in the overridden versions of the above
methodsgetCustomAttributes
in class AbstractComponent
public void writeDesign(org.jsoup.nodes.Element design, DesignContext designContext)
Component
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.
writeDesign
in interface Component
writeDesign
in class AbstractComponent
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 designCopyright © 2018 Vaadin Ltd. All rights reserved.