com.extjs.gxt.ui.client.widget.layout
Class BorderLayout

java.lang.Object
  extended by com.extjs.gxt.ui.client.event.BaseObservable
      extended by com.extjs.gxt.ui.client.widget.Layout
          extended by com.extjs.gxt.ui.client.widget.layout.BorderLayout
All Implemented Interfaces:
Observable

public class BorderLayout
extends Layout

This is a multi-pane, application-oriented UI layout style that supports multiple regions, automatic split bars between regions and built-in expanding and collapsing of regions.

The children of the container using a border layout positions it's children absolutely. Because of this, a specific height and width must be set on any container using a border layout. The size can be set directly, or by a parent layout.

Rather then act on the child components directly, expanding, collapsing, hiding, and showing use the methods provided by border layout ( expand(com.extjs.gxt.ui.client.Style.LayoutRegion), collapse(com.extjs.gxt.ui.client.Style.LayoutRegion), hide(com.extjs.gxt.ui.client.Style.LayoutRegion), and collapse(com.extjs.gxt.ui.client.Style.LayoutRegion).

Be default, this layout adds a CSS style to the parent container (defaults to 'x-border-layout-ct') which gives the container a background color.

Code snippet:

 public class BorderLayoutExample extends LayoutContainer {
 
   public BorderLayoutExample() {
     setLayout(new BorderLayout());
 
     ContentPanel west = new ContentPanel();
     ContentPanel center = new ContentPanel();
 
     BorderLayoutData westData = new BorderLayoutData(LayoutRegion.WEST, 200);
     westData.setSplit(true);
     westData.setCollapsible(true);
     westData.setMargins(new Margins(5));
 
     BorderLayoutData centerData = new BorderLayoutData(LayoutRegion.CENTER);
     centerData.setMargins(new Margins(5, 0, 5, 0));
 
     add(west, westData);
     add(center, centerData);
   }
 }
 


Field Summary
protected  java.util.Map<java.lang.String,SplitBar> splitBars
           
 
Fields inherited from class com.extjs.gxt.ui.client.widget.Layout
activeItem, componentStyleName, container, monitorResize, renderHidden, target, targetStyleName
 
Constructor Summary
BorderLayout()
           
 
Method Summary
 void collapse(Style.LayoutRegion region)
          Collapses the panel in the given region.
protected  CollapsePanel createCollapsePanel(ContentPanel panel, BorderLayoutData data)
           
protected  SplitBar createSplitBar(Style.LayoutRegion region, BoxComponent component)
           
 void expand(Style.LayoutRegion region)
          Expands the panel in the given region.
 boolean getEnableState()
          Returns true if state is enabled.
 void hide(Style.LayoutRegion region)
          Hides the component in the given region.
protected  void onComponentHide(Component component)
           
protected  void onComponentShow(Component component)
           
protected  void onLayout(Container<?> container, El target)
           
protected  void onRemove(Component component)
           
 void setContainer(Container<?> ct)
          Sets the layout's container.
 void setContainerStyle(java.lang.String style)
          Sets the CSS style name to be added to the layout's container (defaults to 'x-border-layout-ct').
 void setEnableState(boolean enableState)
          True to enabled state (defaults to true).
 void show(Style.LayoutRegion region)
          Shows the component in the given region.
 
Methods inherited from class com.extjs.gxt.ui.client.widget.Layout
applyMargins, applyPadding, callLayout, fly, fly, getExtraStyle, getLayoutData, getResizeDelay, getSideMargins, initTarget, isLayoutExecuted, isLayoutNeeded, isRenderHidden, isRunning, isValidParent, layout, layoutContainer, onAdd, onResize, renderAll, renderComponent, setBounds, setExtraStyle, setLayoutData, setLayoutNeeded, setLayoutOnChange, setPosition, setRenderHidden, setResizeDelay, setSize
 
Methods inherited from class com.extjs.gxt.ui.client.event.BaseObservable
addListener, callListener, fireEvent, fireEvent, getFiresEvents, getListeners, hasActiveEvent, hasListeners, hasListeners, removeAllListeners, removeListener, setFiresEvents
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

splitBars

protected java.util.Map<java.lang.String,SplitBar> splitBars
Constructor Detail

BorderLayout

public BorderLayout()
Method Detail

collapse

public void collapse(Style.LayoutRegion region)
Collapses the panel in the given region.

Parameters:
region - the region to be collapsed

expand

public void expand(Style.LayoutRegion region)
Expands the panel in the given region.

Parameters:
region - the region to expand

getEnableState

public boolean getEnableState()
Returns true if state is enabled.

Returns:
the enabled state flag

hide

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

Parameters:
region - the layout region

setContainer

public void setContainer(Container<?> ct)
Description copied from class: Layout
Sets the layout's container.

Overrides:
setContainer in class Layout
Parameters:
ct - the container

setContainerStyle

public void setContainerStyle(java.lang.String style)
Sets the CSS style name to be added to the layout's container (defaults to 'x-border-layout-ct').

Parameters:
style - the style name

setEnableState

public void setEnableState(boolean enableState)
True to enabled state (defaults to true). When true, expand / collapse and size state is persisted across user sessions.

Parameters:
enableState - true to enable state

show

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

Parameters:
region - the layout region

createCollapsePanel

protected CollapsePanel createCollapsePanel(ContentPanel panel,
                                            BorderLayoutData data)

createSplitBar

protected SplitBar createSplitBar(Style.LayoutRegion region,
                                  BoxComponent component)

onComponentHide

protected void onComponentHide(Component component)
Overrides:
onComponentHide in class Layout

onComponentShow

protected void onComponentShow(Component component)
Overrides:
onComponentShow in class Layout

onLayout

protected void onLayout(Container<?> container,
                        El target)
Overrides:
onLayout in class Layout

onRemove

protected void onRemove(Component component)
Overrides:
onRemove in class Layout