Home » GWT DockLayoutPanel

GWT DockLayoutPanel

by Online Tutorials Library

GWT DockLayoutPanel

In this layout panel, all its child widgets lays at corner or edges. The last widget occupies the center space. It works also in standard mode where HTML page is having !DOCTYPE DECLARATION.

GWT DockLayoutPanel Class Declaration

Let’s see the declaration of com.google.gwt.user.client.ui.DockLayoutPanel

DockLayoutPanel Nested Classes

Class Description
DockLayoutPanel.Direction It is used in addEast(Widget, double) et al to specify the direction in which a child widget will be added.
DockLayoutPanel.LayoutData Its layout data is associated with each widget.

GWT DockLayoutPanel Constructors

Constructor Description
DockLayoutPanel(Style.Unit unit) It creates an empty dock panel.

DockLayoutPanel Common Methods

Modifier and Types Method Description
void add(Widget widget) It adds a widget at the center of the dock.
void addEast(IsWidget widget, double size) It is a overloaded version for IsWidget.
void addEast(Widget widget, double size) It adds a widget to the east edge of the dock.
void addLineEnd(Widget widget, double size) It adds a widget to the end of the line.
void addNorth(Widget widget, double size) It adds a widget to the north edge of the dock.
void addSouth(Widget widget, double size) It adds a widget to the south edge of the dock.
Element getWidgetContainerElement(Widget child) It gets the container element wrapping the given child widget.
protected DockLayoutPanel.Direction getResolvedDirection(DockLayoutPanel.Direction direction) It resolves the specified direction based on the current locale.
protected void insert(Widget widget, DockLayoutPanel.Direction direction, double size, Widget before) It adds a widget to the specified edge of the dock.
protected void onAttach() It is called when a widget is attached to the browser’s document.
protected void onDetach() It is called when a widget is detached from the browser’s document.
void setWidgetHidden(Widget widget, boolean hidden) It sets whether or not the given widget should be hidden.
void setWidgetSize(Widget widget, double size) It updates the size of the widget passed in as long as it is not the center widget and updates the layout of the dock.

GWT DockLayoutPanel Example 1

//SampleDockLayoutPanel.java

//SampleDockLayoutPanel.css

Output:

GWT DockLayoutPanel

GWT DockLayoutPanel Example 2

//SampleDockLayoutPanel.java

Output:

GWT DockLayoutPanel

You may also like