|
GWT 2.0.3 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.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
public class DockLayoutPanel
A panel that lays its child widgets out "docked" at its outer edges, and allows its last widget to take up the remaining space in its center.
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 DockLayoutPanelExample implements EntryPoint { public void onModuleLoad() { // Attach five widgets to a DockLayoutPanel, one in each direction. Lay // them out in 'em' units. DockLayoutPanel p = new DockLayoutPanel(Unit.EM); p.addNorth(new HTML("north"), 2); p.addSouth(new HTML("south"), 2); p.addEast(new HTML("east"), 2); p.addWest(new HTML("west"), 2); p.add(new HTML("center")); // 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); } }
DockLayoutPanel elements in
UiBinder
templates
lay out their children in elements tagged with the cardinal directions,
and center:
Each child can hold only widget, and there can be only one <g:center>. However, there can be any number of the directional children.
(Note that the tags of the child elements are not
capitalized. This is meant to signal that they are not runtime objects,
and so cannot have a ui:field
attribute.)
For example:
<g:DockLayoutPanel unit='EM'> <g:north size='5'> <g:Label>Top</g:Label> </g:north> <g:center> <g:Label>Body</g:Label> </g:center> <g:west size='192'> <g:HTML> <ul> <li>Sidebar</li> <li>Sidebar</li> <li>Sidebar</li> </ul> </g:HTML> </g:west> </g:DockLayoutPanel>
Nested Class Summary | |
---|---|
static class |
DockLayoutPanel.Direction
Used in addEast(Widget, double) et al to specify
the direction in which a child widget will be added. |
protected static class |
DockLayoutPanel.LayoutData
Layout data associated with each widget. |
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject |
---|
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled |
Field Summary |
---|
Fields inherited from class com.google.gwt.user.client.ui.UIObject |
---|
DEBUG_ID_PREFIX |
Constructor Summary | |
---|---|
DockLayoutPanel(Style.Unit unit)
Creates an empty dock panel. |
Method Summary | |
---|---|
void |
add(Widget widget)
Adds a widget at the center of the dock. |
void |
addEast(Widget widget,
double size)
Adds a widget to the east edge of the dock. |
void |
addNorth(Widget widget,
double size)
Adds a widget to the north edge of the dock. |
void |
addSouth(Widget widget,
double size)
Adds a widget to the south edge of the dock. |
void |
addWest(Widget widget,
double size)
Adds a widget to the west edge of the dock. |
void |
animate(int duration)
Layout children, animating over the specified period of time. |
void |
animate(int duration,
com.google.gwt.layout.client.Layout.AnimationCallback callback)
Layout children, animating over the specified period of time. |
void |
forceLayout()
Layout children immediately. |
protected Widget |
getCenter()
|
protected Style.Unit |
getUnit()
|
Element |
getWidgetContainerElement(Widget child)
Gets the container element wrapping the given child widget. |
DockLayoutPanel.Direction |
getWidgetDirection(Widget child)
Gets the layout direction of the given child widget. |
protected void |
insert(Widget widget,
DockLayoutPanel.Direction direction,
double size,
Widget before)
Adds a widget to the specified edge of the dock. |
void |
insertEast(Widget widget,
double size,
Widget before)
Adds a widget to the east edge of the dock, inserting it before an existing widget. |
void |
insertNorth(Widget widget,
double size,
Widget before)
Adds a widget to the north edge of the dock, inserting it before an existing widget. |
void |
insertSouth(Widget widget,
double size,
Widget before)
Adds a widget to the south edge of the dock, inserting it before an existing widget. |
void |
insertWest(Widget widget,
double size,
Widget before)
Adds a widget to the west edge of the dock, inserting it before an existing widget. |
protected void |
onLoad()
A Panel's onLoad method will be called after all of its children are attached. |
void |
onResize()
This method must be called whenever the implementor's size has been modified. |
protected void |
onUnload()
A Panel's onUnload method will be called before its children become detached themselves. |
boolean |
remove(Widget w)
Removes a child widget. |
Methods inherited from class com.google.gwt.user.client.ui.ComplexPanel |
---|
add, adjustIndex, checkIndexBoundsForAccess, checkIndexBoundsForInsertion, getChildren, getWidget, getWidgetCount, getWidgetIndex, insert, insert, iterator, remove |
Methods inherited from class com.google.gwt.user.client.ui.Panel |
---|
adopt, adopt, clear, disown, doAttachChildren, doDetachChildren, orphan |
Methods inherited from class com.google.gwt.user.client.ui.Widget |
---|
addDomHandler, addHandler, delegateEvent, fireEvent, getHandlerCount, getLayoutData, getParent, isAttached, isOrWasAttached, onAttach, onBrowserEvent, onDetach, removeFromParent, setLayoutData, sinkEvents |
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, setElement, setElement, setHeight, setPixelSize, setSize, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, toString, unsinkEvents |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public DockLayoutPanel(Style.Unit unit)
unit
- the unit to be used for layoutMethod Detail |
---|
public void add(Widget widget)
add
in interface HasWidgets
add
in class Panel
widget
- the widget to be addedHasWidgets.add(Widget)
public void addEast(Widget widget, double size)
widget
- the widget to be addedsize
- the child widget's sizepublic void addNorth(Widget widget, double size)
widget
- the widget to be addedsize
- the child widget's sizepublic void addSouth(Widget widget, double size)
widget
- the widget to be addedsize
- the child widget's sizepublic void addWest(Widget widget, double size)
widget
- the widget to be addedsize
- the child widget's sizepublic void animate(int duration)
AnimatedLayout
animate
in interface AnimatedLayout
duration
- the animation duration, in millisecondspublic void animate(int duration, com.google.gwt.layout.client.Layout.AnimationCallback callback)
AnimatedLayout
This method provides a callback that will be informed of animation updates. This can be used to create more complex animation effects.
animate
in interface AnimatedLayout
duration
- the animation duration, in millisecondscallback
- the animation callbackpublic void forceLayout()
AnimatedLayout
This is not normally necessary, unless you want to update child widgets'
positions explicitly to create a starting point for a subsequent call to
AnimatedLayout.animate(int)
.
forceLayout
in interface AnimatedLayout
AnimatedLayout.animate(int)
,
#animate(int, AnimationCallback)
public Element getWidgetContainerElement(Widget child)
child
-
public DockLayoutPanel.Direction getWidgetDirection(Widget child)
child
- the widget to be queried
null
if it is not a
child of this panelpublic void insertEast(Widget widget, double size, Widget before)
widget
- the widget to be addedsize
- the child widget's sizebefore
- the widget before which to insert the new child, or
null
to appendpublic void insertNorth(Widget widget, double size, Widget before)
widget
- the widget to be addedsize
- the child widget's sizebefore
- the widget before which to insert the new child, or
null
to appendpublic void insertSouth(Widget widget, double size, Widget before)
widget
- the widget to be addedsize
- the child widget's sizebefore
- the widget before which to insert the new child, or
null
to appendpublic void insertWest(Widget widget, double size, Widget before)
widget
- the widget to be addedsize
- the child widget's sizebefore
- the widget before which to insert the new child, or
null
to appendpublic void onResize()
RequiresResize
onResize
in interface RequiresResize
public boolean remove(Widget w)
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 ComplexPanel
w
- the widget to be removed
true
if the child was presentprotected Widget getCenter()
protected Style.Unit getUnit()
protected void insert(Widget widget, DockLayoutPanel.Direction direction, double size, Widget before)
remove(Widget)
had already been called.
widget
- the widget to be addeddirection
- the widget's direction in the dockbefore
- the widget before which to insert the new child, or
null
to appendprotected void onLoad()
Panel
onLoad
in class Panel
Widget.onLoad()
protected void onUnload()
Panel
onUnload
in class Panel
Widget.onLoad()
|
GWT 2.0.3 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |