public class

DockPanel

extends CellPanel
implements HasAlignment
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.CellPanel
             ↳ com.google.gwt.user.client.ui.DockPanel

This class is deprecated.
Use DockLayoutPanel instead, but understand that it is not a drop in replacement for this class. It requires standards mode, and is most easily used under a RootLayoutPanel (as opposed to a RootPanel

Class Overview

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 quirks mode. If your application is in Standards Mode, use DockLayoutPanel instead.

See Also

Summary

Nested Classes
class DockPanel.DockLayoutConstant DockPanel layout constant, used in add(Widget, DockPanel.DockLayoutConstant)
[Expand]
Inherited Constants
From class com.google.gwt.user.client.ui.UIObject
Fields
public static final DockPanel.DockLayoutConstant CENTER Specifies that a widget be added at the center of the dock.
public static final DockPanel.DockLayoutConstant EAST Specifies that a widget be added at the east edge of the dock.
public static final DockPanel.DockLayoutConstant LINE_END Specifies that a widget be added at the end of the line direction for the layout.
public static final DockPanel.DockLayoutConstant LINE_START Specifies that a widget be added at the beginning of the line direction for the layout.
public static final DockPanel.DockLayoutConstant NORTH Specifies that a widget be added at the north edge of the dock.
public static final DockPanel.DockLayoutConstant SOUTH Specifies that a widget be added at the south edge of the dock.
public static final DockPanel.DockLayoutConstant WEST Specifies that a widget be added at the west edge of the dock.
[Expand]
Inherited Fields
From interface com.google.gwt.user.client.ui.HasHorizontalAlignment
From interface com.google.gwt.user.client.ui.HasVerticalAlignment
Public Constructors
DockPanel()
Creates an empty dock panel.
Public Methods
void add(Widget widget, DockPanel.DockLayoutConstant direction)
Adds a widget to the specified edge of the dock.
HasHorizontalAlignment.HorizontalAlignmentConstant getHorizontalAlignment()
Gets the horizontal alignment.
HasVerticalAlignment.VerticalAlignmentConstant getVerticalAlignment()
Gets the vertical alignment.
DockPanel.DockLayoutConstant getWidgetDirection(Widget w)
Gets the layout direction of the given child widget.
boolean remove(Widget w)
Removes a child widget.
void setCellHeight(Widget w, String height)
Sets the height of the cell associated with the given widget, related to the panel as a whole.
void setCellHorizontalAlignment(Widget w, HasHorizontalAlignment.HorizontalAlignmentConstant align)
Sets the horizontal alignment of the given widget within its cell.
void setCellVerticalAlignment(Widget w, HasVerticalAlignment.VerticalAlignmentConstant align)
Sets the vertical alignment of the given widget within its cell.
void setCellWidth(Widget w, String width)
Sets the width of the cell associated with the given widget, related to the panel as a whole.
void setHorizontalAlignment(HasHorizontalAlignment.HorizontalAlignmentConstant align)
Sets the default horizontal alignment to be used for widgets added to this panel.
void setVerticalAlignment(HasVerticalAlignment.VerticalAlignmentConstant align)
Sets the default vertical alignment to be used for widgets added to this panel.
Protected Methods
void onEnsureDebugId(String baseID)
DockPanel supports adding more than one cell in a direction, so an integer will be appended to the end of the debug id.
[Expand]
Inherited Methods
From class com.google.gwt.user.client.ui.CellPanel
From class com.google.gwt.user.client.ui.ComplexPanel
From class com.google.gwt.user.client.ui.Panel
From class com.google.gwt.user.client.ui.Widget
From class com.google.gwt.user.client.ui.UIObject
From class java.lang.Object
From interface com.google.gwt.event.logical.shared.HasAttachHandlers
From interface com.google.gwt.event.shared.HasHandlers
From interface com.google.gwt.user.client.EventListener
From interface com.google.gwt.user.client.ui.HasHorizontalAlignment
From interface com.google.gwt.user.client.ui.HasVerticalAlignment
From interface com.google.gwt.user.client.ui.HasWidgets
From interface com.google.gwt.user.client.ui.HasWidgets.ForIsWidget
From interface com.google.gwt.user.client.ui.IndexedPanel
From interface com.google.gwt.user.client.ui.IndexedPanel.ForIsWidget
From interface com.google.gwt.user.client.ui.IsWidget
From interface java.lang.Iterable

Fields

public static final DockPanel.DockLayoutConstant CENTER

Specifies that a widget be added at the center of the dock.

public static final DockPanel.DockLayoutConstant EAST

Specifies that a widget be added at the east edge of the dock.

public static final DockPanel.DockLayoutConstant LINE_END

Specifies that a widget be added at the end of the line direction for the layout.

public static final DockPanel.DockLayoutConstant LINE_START

Specifies that a widget be added at the beginning of the line direction for the layout.

public static final DockPanel.DockLayoutConstant NORTH

Specifies that a widget be added at the north edge of the dock.

public static final DockPanel.DockLayoutConstant SOUTH

Specifies that a widget be added at the south edge of the dock.

public static final DockPanel.DockLayoutConstant WEST

Specifies that a widget be added at the west edge of the dock.

Public Constructors

public DockPanel ()

Creates an empty dock panel.

Public Methods

public void add (Widget widget, DockPanel.DockLayoutConstant direction)

Adds a widget to the specified edge of the dock. If the widget is already a child of this panel, this method behaves as though remove(Widget) had already been called.

Parameters
widget the widget to be added
direction the widget's direction in the dock
Throws
IllegalArgumentException when adding to the CENTER and there is already a different widget there

public HasHorizontalAlignment.HorizontalAlignmentConstant getHorizontalAlignment ()

Gets the horizontal alignment.

Returns

public HasVerticalAlignment.VerticalAlignmentConstant getVerticalAlignment ()

Gets the vertical alignment.

Returns
  • the current vertical alignment.

public DockPanel.DockLayoutConstant getWidgetDirection (Widget w)

Gets the layout direction of the given child widget.

Parameters
w the widget to be queried
Returns
  • the widget's layout direction, or null if it is not a child of this panel

public boolean remove (Widget w)

Removes 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.

  1. Validate: Make sure this Panel is actually the parent of the child Widget; return false if it is not.
  2. Orphan: Call orphan(Widget) first while the child Widget is still attached.
  3. 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.
  4. 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.

Parameters
w the widget to be removed
Returns
  • true if the child was present

public void setCellHeight (Widget w, String height)

Sets the height of the cell associated with the given widget, related to the panel as a whole.

Parameters
w the widget whose cell height is to be set
height the cell's height, in CSS units

public void setCellHorizontalAlignment (Widget w, HasHorizontalAlignment.HorizontalAlignmentConstant align)

Sets the horizontal alignment of the given widget within its cell.

Parameters
w the widget whose horizontal alignment is to be set
align the widget's horizontal alignment, as defined in HasHorizontalAlignment.

public void setCellVerticalAlignment (Widget w, HasVerticalAlignment.VerticalAlignmentConstant align)

Sets the vertical alignment of the given widget within its cell.

Parameters
w the widget whose vertical alignment is to be set
align the widget's vertical alignment, as defined in HasVerticalAlignment.

public void setCellWidth (Widget w, String width)

Sets the width of the cell associated with the given widget, related to the panel as a whole.

Parameters
w the widget whose cell width is to be set
width the cell's width, in CSS units

public void setHorizontalAlignment (HasHorizontalAlignment.HorizontalAlignmentConstant align)

Sets the default horizontal alignment to be used for widgets added to this panel. It only applies to widgets added after this property is set.

Parameters
align the horizontal alignment ( ALIGN_LEFT, ALIGN_CENTER, ALIGN_RIGHT, ALIGN_JUSTIFY, ALIGN_LOCALE_START, or ALIGN_LOCALE_END).

public void setVerticalAlignment (HasVerticalAlignment.VerticalAlignmentConstant align)

Sets the default vertical alignment to be used for widgets added to this panel. It only applies to widgets added after this property is set.

Parameters
align the vertical alignment ( ALIGN_TOP, ALIGN_MIDDLE, or ALIGN_BOTTOM).

Protected Methods

protected void onEnsureDebugId (String baseID)

DockPanel supports adding more than one cell in a direction, so an integer will be appended to the end of the debug id. For example, the first north cell is labeled "north1", the second is "north2", and the third is "north3". This widget recreates its structure every time a Widget is added, so you must call this method after adding a new Widget or all debug IDs will be lost.

Affected Elements:

  • -center = the center cell.
  • -north# = the northern cell.
  • -south# = the southern cell.
  • -east# = the eastern cell.
  • -west# = the western cell.

Parameters
baseID the base ID used by the main element