public class SplitLayoutPanel extends DockLayoutPanel
This panel is used in the same way as DockLayoutPanel
, except that
its children's sizes are always specified in Style.Unit.PX
units, 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.
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); } }
Modifier and Type | Class and Description |
---|---|
(package private) class |
SplitLayoutPanel.HSplitter |
(package private) class |
SplitLayoutPanel.Splitter |
(package private) class |
SplitLayoutPanel.VSplitter |
DockLayoutPanel.Direction, DockLayoutPanel.LayoutData
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled
IndexedPanel.ForIsWidget
HasWidgets.ForIsWidget
eventsToSink
DEBUG_ID_PREFIX, MISSING_ELEMENT_ERROR, SETELEMENT_TWICE_ERROR
Constructor and Description |
---|
SplitLayoutPanel()
Construct a new
SplitLayoutPanel with the default splitter size of
8px. |
SplitLayoutPanel(int splitterSize)
Construct a new
SplitLayoutPanel with the specified splitter size
in pixels. |
Modifier and Type | Method and Description |
---|---|
int |
getSplitterSize()
Return the size of the splitter in pixels.
|
void |
insert(Widget child,
DockLayoutPanel.Direction direction,
double size,
Widget before)
Adds a widget to the specified edge of the dock.
|
boolean |
remove(Widget child)
Removes a child widget.
|
void |
setWidgetHidden(Widget widget,
boolean hidden)
Sets whether or not the given widget should be hidden.
|
void |
setWidgetMinSize(Widget child,
int minSize)
Sets the minimum allowable size for the given widget.
|
void |
setWidgetSnapClosedSize(Widget child,
int snapClosedSize)
Sets a size below which the slider will close completely.
|
void |
setWidgetToggleDisplayAllowed(Widget child,
boolean allowed)
Sets whether or not double-clicking on the splitter should toggle the
display of the widget.
|
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
add, add, adjustIndex, checkIndexBoundsForAccess, checkIndexBoundsForInsertion, doLogicalClear, getChildren, getWidget, getWidgetCount, getWidgetIndex, getWidgetIndex, insert, insert, iterator, remove
add, adopt, clear, doAttachChildren, doDetachChildren, orphan, remove
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
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
public SplitLayoutPanel()
SplitLayoutPanel
with the default splitter size of
8px.public SplitLayoutPanel(int splitterSize)
SplitLayoutPanel
with the specified splitter size
in pixels.splitterSize
- the size of the splitter in pixelspublic int getSplitterSize()
public void insert(Widget child, DockLayoutPanel.Direction direction, double size, Widget before)
DockLayoutPanel
DockLayoutPanel.remove(Widget)
had already been called.insert
in class DockLayoutPanel
child
- the widget to be addeddirection
- the widget's direction in the dockbefore
- the widget before which to insert the new child, or
null
to appendpublic boolean remove(Widget child)
Panel
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.
false
if it is not.Panel.orphan(Widget)
first while the child
Widget is still attached.WidgetCollection
.remove
in interface HasWidgets
remove
in class DockLayoutPanel
child
- the widget to be removedtrue
if the child was presentpublic void setWidgetHidden(Widget widget, boolean hidden)
DockLayoutPanel
setWidgetHidden
in class DockLayoutPanel
widget
- the widget to hide or displayhidden
- true to hide the widget, false to display itpublic void setWidgetMinSize(Widget child, int minSize)
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.CENTER
widget.
child
- the child whose minimum size will be setminSize
- the minimum size for this widgetpublic void setWidgetSnapClosedSize(Widget child, int snapClosedSize)
setWidgetMinSize(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.CENTER
widget.
child
- the child whose slider should snap closedsnapClosedSize
- the width below which the widget will close or
-1 to disable.public void setWidgetToggleDisplayAllowed(Widget child, boolean allowed)
child
- the child whose display toggling will be allowed or not.allowed
- whether or not display toggling is allowed for this widget