com.sencha.gxt.widget.core.client.container
Class BorderLayoutContainer

java.lang.Object
  extended by com.google.gwt.user.client.ui.UIObject
      extended by com.google.gwt.user.client.ui.Widget
          extended by com.sencha.gxt.widget.core.client.Component
              extended by com.sencha.gxt.widget.core.client.container.Container
                  extended by com.sencha.gxt.widget.core.client.container.ResizeContainer
                      extended by com.sencha.gxt.widget.core.client.container.SimpleContainer
                          extended by com.sencha.gxt.widget.core.client.container.BorderLayoutContainer
All Implemented Interfaces:
HasAttachHandlers, HasResizeHandlers, HasHandlers, EventListener, AcceptsOneWidget, HasEnabled, HasOneWidget, HasVisibility, HasWidgets, HasWidgets.ForIsWidget, IndexedPanel, IndexedPanel.ForIsWidget, IsWidget, ProvidesResize, RequiresResize, HasCenterWidget, HasEastWidget, HasLayout, HasNorthWidget, HasSouthWidget, HasWestWidget, AddEvent.HasAddHandlers, BeforeAddEvent.HasBeforeAddHandlers, BeforeHideEvent.HasBeforeHideHandlers, BeforeRemoveEvent.HasBeforeRemoveHandlers, BeforeShowContextMenuEvent.HasBeforeShowContextMenuHandler, BeforeShowEvent.HasBeforeShowHandlers, BlurEvent.HasBlurHandlers, CollapseItemEvent.HasCollapseItemHandlers<ContentPanel>, ContainerHandler.HasContainerHandlers, DisableEvent.HasDisableHandlers, EnableEvent.HasEnableHandlers, ExpandItemEvent.HasExpandItemHandlers<ContentPanel>, FocusEvent.HasFocusHandlers, HideEvent.HasHideHandlers, MoveEvent.HasMoveHandlers, RemoveEvent.HasRemoveHandlers, ShowContextMenuEvent.HasShowContextMenuHandler, ShowEvent.HasShowHandlers, HasFocusSupport, HasItemId, java.lang.Iterable<Widget>

public class BorderLayoutContainer
extends SimpleContainer
implements HasCenterWidget, HasNorthWidget, HasSouthWidget, HasEastWidget, HasWestWidget, CollapseItemEvent.HasCollapseItemHandlers<ContentPanel>, ExpandItemEvent.HasExpandItemHandlers<ContentPanel>

A multi-pane, application-oriented layout container that supports multiple regions, automatic split bars between regions and built-in expanding and collapsing of regions.

Region positions are specified using compass points (e.g. north for top, west for left, east for right, south for bottom) and center. The center region is a privileged position that receives the remaining space not allocated to other regions. Border layout containers should generally specify a center region and one or more other regions.

Region layout parameters are specified using BorderLayoutContainer.BorderLayoutData which controls the margin between the regions, the size of the region, the minimum and maximum size, whether the region has a split bar, whether the region is collapsible and other details.

Region size may be specified as a percent of the parent container size or a fixed number of pixels. The region size is specified as a single value that describes the orientation associated with the region (height for north and south, width for west and east).

The size, split bar and collapsible attributes are specified in the BorderLayoutData for the region adjacent to the center region.

Code Snippet:

    BorderLayoutContainer con = new BorderLayoutContainer();

    ContentPanel cp = new ContentPanel();
    cp.setHeadingText("North");
    cp.add(new Label("North Content"));
    BorderLayoutData d = new BorderLayoutData(.20);
    d.setMargins(new Margins(5));
    d.setCollapsible(true);
    d.setSplit(true);
    con.setNorthWidget(cp, d);

    cp = new ContentPanel();
    cp.setHeadingText("West");
    cp.add(new Label("West Content"));
    d = new BorderLayoutData(.20);
    d.setMargins(new Margins(0, 5, 5, 5));
    d.setCollapsible(true);
    d.setSplit(true);
    d.setCollapseMini(true);
    con.setWestWidget(cp, d);

    cp = new ContentPanel();
    cp.setHeadingText("Center");
    cp.add(new Label("Center Content"));
    d = new BorderLayoutData();
    d.setMargins(new Margins(0, 5, 5, 0));
    con.setCenterWidget(cp, d);

    Viewport v = new Viewport();
    v.add(con);
    RootPanel.get().add(v);
 


Nested Class Summary
static interface BorderLayoutContainer.BorderLayoutAppearance
           
static class BorderLayoutContainer.BorderLayoutData
          Specifies region layout parameters which control the margin between the regions, the size of the region, the minimum and maximum size, whether the region has a split bar, whether the region is collapsible and other details.
 
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.UIObject
DEBUG_ID_PREFIX
 
Constructor Summary
BorderLayoutContainer()
          Creates a border layout container with the default appearance.
BorderLayoutContainer(BorderLayoutContainer.BorderLayoutAppearance appearance)
          Creates a border layout container with the specified appearance.
 
Method Summary
 HandlerRegistration addCollapseHandler(CollapseItemEvent.CollapseItemHandler<ContentPanel> handler)
          Adds a CollapseItemEvent.CollapseItemHandler handler for CollapseItemEvent events.
 HandlerRegistration addExpandHandler(ExpandItemEvent.ExpandItemHandler<ContentPanel> handler)
          Adds a ExpandItemEvent.ExpandItemHandler handler for ExpandItemEvent events.
 void collapse(Style.LayoutRegion region)
          Collapses the panel in the given region.
 void expand(Style.LayoutRegion region)
          Expands the panel in the given region.
 Widget getCenterWidget()
          Returns the center widget or null if one has not been set.
 Widget getEastWidget()
          Returns the east widget or null if one has not been set.
 Widget getNorthWidget()
          Returns the north widget or null if one has not been set.
 Widget getRegionWidget(Style.LayoutRegion region)
          Returns the widget in the specified region, or null if there is no widget for that region.
 Widget getSouthWidget()
          Returns the south widget or null if one has not been set.
 Widget getWestWidget()
          Returns the west widget or null if one has not been set.
 void hide(Style.LayoutRegion region)
          Hides the component in the given region.
 void setCenterWidget(IsWidget child)
          Sets the center widget, replacing any existing center widget.
 void setCenterWidget(IsWidget child, MarginData layoutData)
          Sets the widget in the center region of the border layout container.
 void setEastWidget(IsWidget child)
          Sets the east widget, replacing any existing east widget.
 void setEastWidget(IsWidget child, BorderLayoutContainer.BorderLayoutData layoutData)
          Sets the widget in the east (right) region of the border layout container.
 void setNorthWidget(IsWidget child)
          Sets the north widget, replacing any existing north widget.
 void setNorthWidget(IsWidget child, BorderLayoutContainer.BorderLayoutData layoutData)
          Sets the widget in the north (top) region of the border layout container.
 void setSouthWidget(IsWidget child)
          Sets the south widget, replacing any existing south widget.
 void setSouthWidget(IsWidget child, BorderLayoutContainer.BorderLayoutData layoutData)
          Sets the widget in the south (bottom) region of the border layout container.
 void setWestWidget(IsWidget child)
          Sets the west widget, replacing any existing est widget.
 void setWestWidget(IsWidget child, BorderLayoutContainer.BorderLayoutData layoutData)
          Sets the widget in the west (left) region of the border layout container.
 void show(Style.LayoutRegion region)
          Shows the component in the given region.
 
Methods inherited from class com.sencha.gxt.widget.core.client.container.SimpleContainer
add, add, getWidget, isResize, setResize, setWidget, setWidget
 
Methods inherited from class com.sencha.gxt.widget.core.client.container.ResizeContainer
forceLayout, isLayoutRunning, isOrWasLayoutRunning, onResize
 
Methods inherited from class com.sencha.gxt.widget.core.client.container.Container
add, addAddHandler, addBeforeAddHandler, addBeforeRemoveHandler, addContainerHandler, addRemoveHandler, clear, disable, enable, findWidget, getItemByItemId, getWidget, getWidgetCount, getWidgetIndex, getWidgetIndex, iterator, remove, remove, remove
 
Methods inherited from class com.sencha.gxt.widget.core.client.Component
addBeforeHideHandler, addBeforeShowContextMenuHandler, addBeforeShowHandler, addBlurHandler, addDisableHandler, addEnableHandler, addFocusHandler, addHideHandler, addMoveHandler, addResizeHandler, addShowContextMenuHandler, addShowHandler, addStyleOnOver, clearSizeCache, disableEvents, enableEvents, fireEvent, focus, getData, getElement, getFocusSupport, getHideMode, getId, getItemId, getOffsetHeight, getOffsetWidth, getShadow, getStateId, getToolTip, hide, hideToolTip, isAllowTextSelection, isAutoHeight, isAutoWidth, isDeferHeight, isEnabled, isRendered, isStateful, isVisible, isVisible, mask, mask, onBrowserEvent, removeToolTip, setAllowTextSelection, setBorders, setBounds, setBounds, setContextMenu, setData, setDeferHeight, setEnabled, setHeight, setHeight, setHideMode, setId, setItemId, setPagePosition, setPixelSize, setPosition, setShadow, setSize, setStateful, setStateId, setTabIndex, setToolTip, setToolTipConfig, setVisible, setWidth, setWidth, show, sync, syncSize, unmask
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, getLayoutData, getParent, isAttached, removeFromParent, setLayoutData, sinkEvents
 
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getOffsetHeight, getOffsetWidth, getStyleName, getStylePrimaryName, getTitle, isVisible, removeStyleDependentName, removeStyleName, setStyleDependentName, setStyleName, setStyleName, setStylePrimaryName, setTitle, setVisible, sinkBitlessEvent, toString, unsinkEvents
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BorderLayoutContainer

public BorderLayoutContainer()
Creates a border layout container with the default appearance.


BorderLayoutContainer

public BorderLayoutContainer(BorderLayoutContainer.BorderLayoutAppearance appearance)
Creates a border layout container with the specified appearance.

Parameters:
appearance - the appearance of the border layout container
Method Detail

addCollapseHandler

public HandlerRegistration addCollapseHandler(CollapseItemEvent.CollapseItemHandler<ContentPanel> handler)
Description copied from interface: CollapseItemEvent.HasCollapseItemHandlers
Adds a CollapseItemEvent.CollapseItemHandler handler for CollapseItemEvent events.

Specified by:
addCollapseHandler in interface CollapseItemEvent.HasCollapseItemHandlers<ContentPanel>
Parameters:
handler - the handler
Returns:
the registration for the event

addExpandHandler

public HandlerRegistration addExpandHandler(ExpandItemEvent.ExpandItemHandler<ContentPanel> handler)
Description copied from interface: ExpandItemEvent.HasExpandItemHandlers
Adds a ExpandItemEvent.ExpandItemHandler handler for ExpandItemEvent events.

Specified by:
addExpandHandler in interface ExpandItemEvent.HasExpandItemHandlers<ContentPanel>
Parameters:
handler - the handler
Returns:
the registration for the event

collapse

public void collapse(Style.LayoutRegion region)
Collapses the panel in the given region. If the target widget is hidden no action will be performed.

Parameters:
region - the region to be collapsed

expand

public void expand(Style.LayoutRegion region)
Expands the panel in the given region. If the target widget is hidden no action will be performed.

Parameters:
region - the region to expand

getCenterWidget

public Widget getCenterWidget()
Description copied from interface: HasCenterWidget
Returns the center widget or null if one has not been set.

Specified by:
getCenterWidget in interface HasCenterWidget
Returns:
the center widget or null if one has not been set

getEastWidget

public Widget getEastWidget()
Description copied from interface: HasEastWidget
Returns the east widget or null if one has not been set.

Specified by:
getEastWidget in interface HasEastWidget
Returns:
the east widget or null if one has not been set

getNorthWidget

public Widget getNorthWidget()
Description copied from interface: HasNorthWidget
Returns the north widget or null if one has not been set.

Specified by:
getNorthWidget in interface HasNorthWidget
Returns:
the north widget or null if one has not been set

getRegionWidget

public Widget getRegionWidget(Style.LayoutRegion region)
Returns the widget in the specified region, or null if there is no widget for that region.

Parameters:
region - the region
Returns:
the widget in the specified region, or null if there is no widget for that region

getSouthWidget

public Widget getSouthWidget()
Description copied from interface: HasSouthWidget
Returns the south widget or null if one has not been set.

Specified by:
getSouthWidget in interface HasSouthWidget
Returns:
the south widget or null if one has not been set

getWestWidget

public Widget getWestWidget()
Description copied from interface: HasWestWidget
Returns the west widget or null if one has not been set.

Specified by:
getWestWidget in interface HasWestWidget
Returns:
the west widget or null if one has not been set

hide

public void hide(Style.LayoutRegion region)
Hides the component in the given region.

Parameters:
region - the layout region

setCenterWidget

public void setCenterWidget(IsWidget child)
Description copied from interface: HasCenterWidget
Sets the center widget, replacing any existing center widget.

Specified by:
setCenterWidget in interface HasCenterWidget
Parameters:
child - the new widget to place in the center position of the container

setCenterWidget

@UiChild(limit=1,
         tagname="center")
public void setCenterWidget(IsWidget child,
                                                MarginData layoutData)
Sets the widget in the center region of the border layout container. The center region is a privileged position that receives the remaining space not allocated to other regions. Border layout containers should generally specify a center region and one or more other regions.

Parameters:
child - the widget to put in the center region
layoutData - the layout data for the widget

setEastWidget

public void setEastWidget(IsWidget child)
Description copied from interface: HasEastWidget
Sets the east widget, replacing any existing east widget.

Specified by:
setEastWidget in interface HasEastWidget
Parameters:
child - the new widget to place in the east position of the container

setEastWidget

@UiChild(limit=1,
         tagname="east")
public void setEastWidget(IsWidget child,
                                              BorderLayoutContainer.BorderLayoutData layoutData)
Sets the widget in the east (right) region of the border layout container.

Parameters:
child - the widget to put in the east region
layoutData - the layout data for the widget

setNorthWidget

public void setNorthWidget(IsWidget child)
Description copied from interface: HasNorthWidget
Sets the north widget, replacing any existing north widget.

Specified by:
setNorthWidget in interface HasNorthWidget
Parameters:
child - the new widget to place in the north position of the container

setNorthWidget

@UiChild(limit=1,
         tagname="north")
public void setNorthWidget(IsWidget child,
                                               BorderLayoutContainer.BorderLayoutData layoutData)
Sets the widget in the north (top) region of the border layout container.

Parameters:
child - the widget to put in the north region
layoutData - the layout data for the widget

setSouthWidget

public void setSouthWidget(IsWidget child)
Description copied from interface: HasSouthWidget
Sets the south widget, replacing any existing south widget.

Specified by:
setSouthWidget in interface HasSouthWidget
Parameters:
child - the new widget to place in the south position of the container

setSouthWidget

@UiChild(limit=1,
         tagname="south")
public void setSouthWidget(IsWidget child,
                                               BorderLayoutContainer.BorderLayoutData layoutData)
Sets the widget in the south (bottom) region of the border layout container.

Parameters:
child - the widget to put in the south region
layoutData - the layout data for the widget

setWestWidget

public void setWestWidget(IsWidget child)
Description copied from interface: HasWestWidget
Sets the west widget, replacing any existing est widget.

Specified by:
setWestWidget in interface HasWestWidget
Parameters:
child - the new widget to place in the west position of the container

setWestWidget

@UiChild(limit=1,
         tagname="west")
public void setWestWidget(IsWidget child,
                                              BorderLayoutContainer.BorderLayoutData layoutData)
Sets the widget in the west (left) region of the border layout container.

Parameters:
child - the widget to put in the west region
layoutData - the layout data for the widget

show

public void show(Style.LayoutRegion region)
Shows the component in the given region.

Parameters:
region - the layout region


Copyright © 2012. All Rights Reserved.