
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.<AccordionLayoutAppearance> create(AccordionLayoutAppearance.class);
ContentPanel cp = new ContentPanel(appearance);
cp.setHeading("Accordion Item 1");
cp.add(new Label("Accordion Content 1"));
con.add(cp);
con.setActiveWidget(cp);
cp = new ContentPanel(appearance);
cp.setHeading("Accordion Item 2");
cp.add(new Label("Accordion Content 2"));
con.add(cp);
cp = new ContentPanel(appearance);
cp.setHeading("Accordion Item 3");
cp.add(new Label("Accordion Content 3"));
con.add(cp);
Viewport v = new Viewport();
v.add(con);
RootPanel.get().add(v);
| Modifier and Type | Class and Description |
|---|---|
static interface |
AccordionLayoutContainer.AccordionLayoutAppearance
AccordionLayoutContainer appearance.
|
static class |
AccordionLayoutContainer.ExpandMode
Defines the expand modes.
|
forceLayoutCommand, forceLayoutOnResize, hadLayoutRunning, layoutCommand, layoutRequiredThisEventLoop, layoutRunningadjustSize, allowTextSelection, cacheSizes, disableContextMenu, disabled, disabledStyle, ensureVisibilityOnSizing, height, hidden, lastSize, layer, left, mask, maskMessage, monitorWindowResize, pageX, pageY, resizeHandler, shim, tabIndex, toolTip, toolTipConfig, top, width, windowResizeDelay, windowResizeTask| Constructor and Description |
|---|
AccordionLayoutContainer()
Creates a new accordion layout container.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
doLayout() |
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.
|
protected void |
onBeforeExpand(BeforeExpandEvent event) |
protected void |
onExpand(ExpandEvent event) |
protected void |
onInsert(int index,
Widget child) |
protected void |
onRemove(Widget child) |
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).
|
insert, insertapplyLayout, applyLayout, forceLayout, forceLayoutOnChildren, forceLayoutOnChildren, getLeftRightMargins, getParentLayoutWidget, getSideMargins, getTopBottomMargins, isLayoutRunning, isOrWasLayoutRunning, isWidgetVisible, onBeforeDoLayout, onLoad, onResize, onResizeadd, add, addAddHandler, addBeforeAddHandler, addBeforeRemoveHandler, addContainerHandler, addRemoveHandler, adjustIndex, adopt, checkIndexBoundsForInsertion, clear, disable, doAttachChildren, doDetachChildren, doPhysicalAttach, doPhysicalDetach, enable, ensureGroupingHandlerRegistration, findWidget, getChildren, getContainerTarget, getItemByItemId, getWidget, getWidgetCount, getWidgetIndex, getWidgetIndex, iterator, onWidgetHide, onWidgetShow, orphan, remove, remove, removeaddBeforeHideHandler, addBeforeShowContextMenuHandler, addBeforeShowHandler, addBlurHandler, addDisableHandler, addEnableHandler, addFocusHandler, addGestureRecognizer, addHideHandler, addMoveHandler, addResizeHandler, addShowContextMenuHandler, addShowHandler, addStyleDependentName, addStyleOnOver, adjustPosition, adjustSize, applyState, assertAfterRender, assertPreRender, blur, clearSizeCache, disableContextMenu, disableEvents, enableEvents, fireCancellableEvent, fireEvent, focus, getData, getElement, getFocusEl, getFocusSupport, getGestureRecognizer, getGestureRecognizerCount, getHideMode, getId, getItemId, getOffsetHeight, getOffsetWidth, getPositionEl, getShadow, getShadowPosition, getStateId, getTabIndex, getToolTip, hide, hideShadow, hideToolTip, isAllowTextSelection, isAutoHeight, isAutoWidth, isDeferHeight, isEnabled, isMonitorWindowResize, isRendered, isStateful, isVisible, isVisible, mask, mask, notifyHide, notifyShow, onAfterFirstAttach, onAttach, onBlur, onBrowserEvent, onDetach, onDisable, onEnable, onFocus, onHide, onHideContextMenu, onPosition, onRightClick, onShow, onShowContextMenu, onTouch, onUnload, onWindowResize, removeStyleDependentName, removeStyleOnOver, removeToolTip, setAllowTextSelection, setBorders, setBounds, setBounds, setContextMenu, setData, setDeferHeight, setEnabled, setHeight, setHeight, setHideMode, setId, setItemId, setMonitorWindowResize, setPagePosition, setPixelSize, setPosition, setShadow, setShadowPosition, setSize, setStateful, setStateId, setStyleDependentName, setTabIndex, setToolTip, setToolTipConfig, setVisible, setWidth, setWidth, show, sync, syncSize, unmaskpublic AccordionLayoutContainer()
public boolean getActiveOnTop()
public Widget getActiveWidget()
HasActiveWidgetgetActiveWidget in interface HasActiveWidgetpublic AccordionLayoutContainer.ExpandMode getExpandMode()
public boolean isHideCollapseTool()
public boolean isTitleCollapse()
public void setActiveOnTop(boolean activeOnTop)
activeOnTop - true to keep the active item on toppublic void setActiveWidget(Widget widget)
HasActiveWidgetsetActiveWidget in interface HasActiveWidgetwidget - the widgetpublic void setExpandMode(AccordionLayoutContainer.ExpandMode expandMode)
AccordionLayoutContainer.ExpandMode.SINGLE_FILL).expandMode - the modepublic void setHideCollapseTool(boolean hideCollapseTool)
titleCollapse
should be true also.hideCollapseTool - true to hide the collapse toolpublic void setTitleCollapse(boolean titleCollapse)
hideCollapseTool should be false also.titleCollapse - true for title collapseprotected void doLayout()
doLayout in class ResizeContainerprotected void onBeforeExpand(BeforeExpandEvent event)
protected void onExpand(ExpandEvent event)
Copyright © 2018. All rights reserved.