Class SplitLayoutPanel
- java.lang.Object
-
- com.google.gwt.user.client.ui.UIObject
-
- com.google.gwt.user.client.ui.Widget
-
- com.google.gwt.user.client.ui.Panel
-
- com.google.gwt.user.client.ui.ComplexPanel
-
- com.google.gwt.user.client.ui.DockLayoutPanel
-
- com.google.gwt.user.client.ui.SplitLayoutPanel
-
- All Implemented Interfaces:
HasAttachHandlers,HasHandlers,EventListener,AnimatedLayout,HasVisibility,HasWidgets,HasWidgets.ForIsWidget,IndexedPanel,IndexedPanel.ForIsWidget,IsWidget,ProvidesResize,RequiresResize,java.lang.Iterable<Widget>
public class SplitLayoutPanel extends DockLayoutPanel
A panel that adds user-positioned splitters between each of its child widgets.This panel is used in the same way as
DockLayoutPanel, except that its children's sizes are always specified inStyle.Unit.PXunits, and each pair of child widgets has a splitter between them that the user can drag.This widget will only work in standards mode, which requires that the HTML page in which it is run have an explicit <!DOCTYPE> declaration.
CSS Style Rules
- .gwt-SplitLayoutPanel { the panel itself }
- .gwt-SplitLayoutPanel .gwt-SplitLayoutPanel-HDragger { horizontal dragger }
- .gwt-SplitLayoutPanel .gwt-SplitLayoutPanel-VDragger { vertical dragger }
Example
public class SplitLayoutPanelExample implements EntryPoint { public void onModuleLoad() { // Create a three-pane layout with splitters. SplitLayoutPanel p = new SplitLayoutPanel(); p.addWest(new HTML("navigation"), 128); p.addNorth(new HTML("list"), 384); p.add(new HTML("details")); // Attach the LayoutPanel to the RootLayoutPanel. The latter will listen for // resize events on the window to ensure that its children are informed of // possible size changes. RootLayoutPanel rp = RootLayoutPanel.get(); rp.add(p); } }
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) classSplitLayoutPanel.HSplitter(package private) classSplitLayoutPanel.Splitter(package private) classSplitLayoutPanel.VSplitter-
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.DockLayoutPanel
DockLayoutPanel.Direction, DockLayoutPanel.LayoutData
-
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled
-
Nested classes/interfaces inherited from interface com.google.gwt.user.client.ui.HasWidgets
HasWidgets.ForIsWidget
-
Nested classes/interfaces inherited from interface com.google.gwt.user.client.ui.IndexedPanel
IndexedPanel.ForIsWidget
-
-
Field Summary
-
Fields inherited from class com.google.gwt.user.client.ui.Widget
eventsToSink
-
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX, MISSING_ELEMENT_ERROR, SETELEMENT_TWICE_ERROR
-
-
Constructor Summary
Constructors Constructor Description SplitLayoutPanel()Construct a newSplitLayoutPanelwith the default splitter size of 8px.SplitLayoutPanel(int splitterSize)Construct a newSplitLayoutPanelwith the specified splitter size in pixels.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetSplitterSize()Return the size of the splitter in pixels.voidinsert(Widget child, DockLayoutPanel.Direction direction, double size, Widget before)Adds a widget to the specified edge of the dock.booleanremove(Widget child)Removes a child widget.voidsetWidgetHidden(Widget widget, boolean hidden)Sets whether or not the given widget should be hidden.voidsetWidgetMinSize(Widget child, int minSize)Sets the minimum allowable size for the given widget.voidsetWidgetSnapClosedSize(Widget child, int snapClosedSize)Sets a size below which the slider will close completely.voidsetWidgetToggleDisplayAllowed(Widget child, boolean allowed)Sets whether or not double-clicking on the splitter should toggle the display of the widget.-
Methods inherited from class com.google.gwt.user.client.ui.DockLayoutPanel
add, addEast, addEast, addLineEnd, addLineStart, addNorth, addNorth, addSouth, addSouth, addWest, addWest, animate, animate, assertIsChild, forceLayout, getCenter, getCenterHeight, getCenterWidth, getResolvedDirection, getUnit, getWidgetContainerElement, getWidgetDirection, getWidgetSize, insertEast, insertLineEnd, insertLineStart, insertNorth, insertSouth, insertWest, onAttach, onDetach, onResize, setWidgetSize
-
Methods inherited from class com.google.gwt.user.client.ui.ComplexPanel
add, add, adjustIndex, checkIndexBoundsForAccess, checkIndexBoundsForInsertion, doLogicalClear, getChildren, getWidget, getWidgetCount, getWidgetIndex, getWidgetIndex, insert, insert, iterator, remove
-
Methods inherited from class com.google.gwt.user.client.ui.Panel
add, adopt, clear, doAttachChildren, doDetachChildren, orphan, remove
-
Methods inherited from class com.google.gwt.user.client.ui.Widget
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, ensureHandlers, fireEvent, getHandlerCount, getHandlerManager, getLayoutData, getParent, isAttached, isOrWasAttached, onBrowserEvent, onLoad, onUnload, removeFromParent, replaceElement, setLayoutData, setParent, sinkEvents, unsinkEvents
-
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, resolvePotentialElement, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, toString
-
-
-
-
Constructor Detail
-
SplitLayoutPanel
public SplitLayoutPanel()
Construct a newSplitLayoutPanelwith the default splitter size of 8px.
-
SplitLayoutPanel
public SplitLayoutPanel(int splitterSize)
Construct a newSplitLayoutPanelwith the specified splitter size in pixels.- Parameters:
splitterSize- the size of the splitter in pixels
-
-
Method Detail
-
getSplitterSize
public int getSplitterSize()
Return the size of the splitter in pixels.- Returns:
- the splitter size
-
insert
public void insert(Widget child, DockLayoutPanel.Direction direction, double size, Widget before)
Description copied from class:DockLayoutPanelAdds a widget to the specified edge of the dock. If the widget is already a child of this panel, this method behaves as thoughDockLayoutPanel.remove(Widget)had already been called.- Overrides:
insertin classDockLayoutPanel- Parameters:
child- the widget to be addeddirection- the widget's direction in the dockbefore- the widget before which to insert the new child, ornullto append
-
remove
public boolean remove(Widget child)
Description copied from class:PanelRemoves a child widget.How to Override this Method
There are several important things that must take place in the correct order to properly remove a Widget from a Panel. Not all of these steps will be relevant to every Panel, but all of the steps must be considered.
- Validate: Make sure this Panel is actually the parent of the
child Widget; return
falseif it is not. - Orphan: Call
Panel.orphan(Widget)first while the child Widget is still attached. - Physical Detach: Adjust the DOM to account for the removal of the child Widget. The Widget's Element must be physically removed from the DOM.
- Logical Detach: Update the Panel's state variables to reflect
the removal of the child Widget. Example: the Widget is removed from the
Panel's
WidgetCollection.
- Specified by:
removein interfaceHasWidgets- Overrides:
removein classDockLayoutPanel- Parameters:
child- the widget to be removed- Returns:
trueif the child was present
- Validate: Make sure this Panel is actually the parent of the
child Widget; return
-
setWidgetHidden
public void setWidgetHidden(Widget widget, boolean hidden)
Description copied from class:DockLayoutPanelSets whether or not the given widget should be hidden.- Overrides:
setWidgetHiddenin classDockLayoutPanel- Parameters:
widget- the widget to hide or displayhidden- true to hide the widget, false to display it
-
setWidgetMinSize
public void setWidgetMinSize(Widget child, int minSize)
Sets the minimum allowable size for the given widget.Its associated splitter cannot be dragged to a position that would make it smaller than this size. This method has no effect for the
DockLayoutPanel.Direction.CENTERwidget.- Parameters:
child- the child whose minimum size will be setminSize- the minimum size for this widget
-
setWidgetSnapClosedSize
public void setWidgetSnapClosedSize(Widget child, int snapClosedSize)
Sets a size below which the slider will close completely. This can be used in conjunction withsetWidgetMinSize(com.google.gwt.user.client.ui.Widget, int)to provide a speed-bump effect where the slider will stick to a preferred minimum size before closing completely.This method has no effect for the
DockLayoutPanel.Direction.CENTERwidget.- Parameters:
child- the child whose slider should snap closedsnapClosedSize- the width below which the widget will close or -1 to disable.
-
setWidgetToggleDisplayAllowed
public void setWidgetToggleDisplayAllowed(Widget child, boolean allowed)
Sets whether or not double-clicking on the splitter should toggle the display of the widget.- Parameters:
child- the child whose display toggling will be allowed or not.allowed- whether or not display toggling is allowed for this widget
-
-