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

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.InsertResizeContainer
                          extended by com.sencha.gxt.widget.core.client.container.AccordionLayoutContainer
All Implemented Interfaces:
HasAttachHandlers, HasResizeHandlers, HasHandlers, EventListener, HasVisibility, HasWidgets, HasWidgets.ForIsWidget, IndexedPanel, IndexedPanel.ForIsWidget, InsertPanel, InsertPanel.ForIsWidget, IsWidget, ProvidesResize, RequiresResize, HasActiveWidget, HasLayout, AddEvent.HasAddHandlers, BeforeAddEvent.HasBeforeAddHandlers, BeforeHideEvent.HasBeforeHideHandlers, BeforeRemoveEvent.HasBeforeRemoveHandlers, BeforeShowContextMenuEvent.HasBeforeShowContextMenuHandler, BeforeShowEvent.HasBeforeShowHandlers, BlurEvent.HasBlurHandlers, ContainerHandler.HasContainerHandlers, DisableEvent.HasDisableHandlers, EnableEvent.HasEnableHandlers, FocusEvent.HasFocusHandlers, HideEvent.HasHideHandlers, MoveEvent.HasMoveHandlers, RemoveEvent.HasRemoveHandlers, ShowContextMenuEvent.HasShowContextMenuHandler, ShowEvent.HasShowHandlers, HasFocusSupport, HasItemId, Iterable<Widget>

public class AccordionLayoutContainer
extends InsertResizeContainer
implements HasActiveWidget

A layout container that manages multiple content panels in an expandable accordion style such that only one panel can be expanded at any given time (by default). Each panel has built-in support for expanding and collapsing. Note: Only ContentPanel's and subclasses may be used in an accordion layout container. Each content panel should be created with AccordionLayoutContainer.AccordionLayoutAppearance to produce the expected accordion panel look and feel. The AccordionLayoutAppearance must be created using the GWT.create(Class) method to enable GWT class substitution, as illustrated in the following code snippet.

Code snippet:

    AccordionLayoutContainer con = new AccordionLayoutContainer();
    AccordionLayoutAppearance appearance = GWT. create(AccordionLayoutAppearance.class);

    ContentPanel cp = new ContentPanel(appearance);
    cp.setHeadingText("Accordion Item 1");
    cp.add(new Label("Accordion Content 1"));
    con.add(cp);
    con.setActiveWidget(cp);

    cp = new ContentPanel(appearance);
    cp.setHeadingText("Accordion Item 2");
    cp.add(new Label("Accordion Content 2"));
    con.add(cp);

    cp = new ContentPanel(appearance);
    cp.setHeadingText("Accordion Item 3");
    cp.add(new Label("Accordion Content 3"));
    con.add(cp);

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


Nested Class Summary
static interface AccordionLayoutContainer.AccordionLayoutAppearance
          AccordionLayoutContainer appearance.
static class AccordionLayoutContainer.ExpandMode
          Defines the expand modes.
 
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.InsertPanel
InsertPanel.ForIsWidget
 
Nested classes/interfaces inherited from interface com.google.gwt.user.client.ui.HasWidgets
HasWidgets.ForIsWidget
 
Field Summary
 
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
 
Constructor Summary
AccordionLayoutContainer()
          Creates a new accordion layout container.
 
Method Summary
 boolean getActiveOnTop()
          Returns true if the active item if first.
 Widget getActiveWidget()
          Returns the active widget.
 AccordionLayoutContainer.ExpandMode getExpandMode()
          Returns the expand mode.
 boolean isHideCollapseTool()
          Returns true if the collapse tool is hidden.
 boolean isTitleCollapse()
          Returns true if title collapse is enabled.
 void setActiveOnTop(boolean activeOnTop)
          True to swap the position of each panel as it is expanded so that it becomes the first item in the container, false to keep the panels in the rendered order (defaults to false).
 void setActiveWidget(Widget widget)
          Sets the active widget.
 void setExpandMode(AccordionLayoutContainer.ExpandMode expandMode)
          Sets the expand mode (defaults to AccordionLayoutContainer.ExpandMode.SINGLE_FILL).
 void setHideCollapseTool(boolean hideCollapseTool)
          True to hide the contained panels' collapse/expand toggle buttons, false to display them (defaults to false).
 void setTitleCollapse(boolean titleCollapse)
          True to allow expand/collapse of each contained panel by clicking anywhere on the title bar, false to allow expand/collapse only when the toggle tool button is clicked (defaults to true).
 
Methods inherited from class com.sencha.gxt.widget.core.client.container.InsertResizeContainer
insert, insert
 
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, 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
 
Methods inherited from interface com.google.gwt.user.client.ui.InsertPanel.ForIsWidget
add
 
Methods inherited from interface com.google.gwt.user.client.ui.InsertPanel
add
 
Methods inherited from interface com.google.gwt.user.client.ui.IndexedPanel.ForIsWidget
getWidgetIndex
 
Methods inherited from interface com.google.gwt.user.client.ui.IndexedPanel
getWidget, getWidgetCount, getWidgetIndex, remove
 

Constructor Detail

AccordionLayoutContainer

public AccordionLayoutContainer()
Creates a new accordion layout container.

Method Detail

getActiveOnTop

public boolean getActiveOnTop()
Returns true if the active item if first.

Returns:
the active on top state

getActiveWidget

public Widget getActiveWidget()
Description copied from interface: HasActiveWidget
Returns the active widget.

Specified by:
getActiveWidget in interface HasActiveWidget
Returns:
the active widget

getExpandMode

public AccordionLayoutContainer.ExpandMode getExpandMode()
Returns the expand mode.

Returns:
the expand mode

isHideCollapseTool

public boolean isHideCollapseTool()
Returns true if the collapse tool is hidden.

Returns:
the hide collapse tool state

isTitleCollapse

public boolean isTitleCollapse()
Returns true if title collapse is enabled.

Returns:
the title collapse state

setActiveOnTop

public void setActiveOnTop(boolean activeOnTop)
True to swap the position of each panel as it is expanded so that it becomes the first item in the container, false to keep the panels in the rendered order (defaults to false).

Parameters:
activeOnTop - true to keep the active item on top

setActiveWidget

public void setActiveWidget(Widget widget)
Description copied from interface: HasActiveWidget
Sets the active widget.

Specified by:
setActiveWidget in interface HasActiveWidget
Parameters:
widget - the widget

setExpandMode

public void setExpandMode(AccordionLayoutContainer.ExpandMode expandMode)
Sets the expand mode (defaults to AccordionLayoutContainer.ExpandMode.SINGLE_FILL).

Parameters:
expandMode - the mode

setHideCollapseTool

public void setHideCollapseTool(boolean hideCollapseTool)
True to hide the contained panels' collapse/expand toggle buttons, false to display them (defaults to false). When set to true, titleCollapse should be true also.

Parameters:
hideCollapseTool - true to hide the collapse tool

setTitleCollapse

public void setTitleCollapse(boolean titleCollapse)
True to allow expand/collapse of each contained panel by clicking anywhere on the title bar, false to allow expand/collapse only when the toggle tool button is clicked (defaults to true). When set to false, hideCollapseTool should be false also.

Parameters:
titleCollapse - true for title collapse


Copyright © 2012. All Rights Reserved.