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 {@link ContentPanel}'s and subclasses may be used in an accordion layout container. Each content panel should be created with {@link AccordionLayoutAppearance} to produce the expected accordion panellook and feel. The
AccordionLayoutAppearance
must be created using the {@link 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);