Class StackPanel

public class StackPanel
extends ComplexPanel
A panel that stacks its children vertically, displaying only one at a time, with a header for each that the user can click to display it.

CSS Style Rules

Example

public class StackPanelExample implements EntryPoint {

  public void onModuleLoad() {
    // Create a stack panel containing three labels.
    StackPanel panel = new StackPanel();
    panel.add(new Label("Foo"), "foo");
    panel.add(new Label("Bar"), "bar");
    panel.add(new Label("Baz"), "baz");

    // Add it to the root panel.
    RootPanel.get().add(panel);
  }
}

Constructors

StackPanel()Creates an empty stack panel.

Methods

add(Widget)
add(Widget, String)Adds a widget to the panel, along with its header.
add(Widget, String, boolean)Adds a widget to the panel, along with its header, optionally interpreting the header as HTML.
onBrowserEvent(Event)
remove(Widget)
setStackText(int, String)Sets the text associated with a widget, by its index.
setStackText(int, String, boolean)Sets the text associated with a widget, by its index.
showStack(int)Shows the widget at the specified index.

Constructor Detail

StackPanel

public StackPanel()
Creates an empty stack panel.

Method Detail

add

public boolean add(Widget w)

Parameters

w

add

public boolean add(Widget w, String stackText)
Adds a widget to the panel, along with its header.

Parameters

w
the widget to be added
stackText
the header text associated with this widget

Return Value

true if successful

add

public boolean add(Widget w, String stackText, boolean asHTML)
Adds a widget to the panel, along with its header, optionally interpreting the header as HTML.

Parameters

w
the widget to be added
stackText
the header text associated with this widget
asHTML
true to treat the specified text as HTML

Return Value

true if successful

onBrowserEvent

public void onBrowserEvent(Event event)

Parameters

event

remove

public boolean remove(Widget w)

Parameters

w

setStackText

public void setStackText(int index, String text)
Sets the text associated with a widget, by its index.

Parameters

index
the index of the widget whose text is to be set
text
the text to be associated with it

setStackText

public void setStackText(int index, String text, boolean asHTML)
Sets the text associated with a widget, by its index.

Parameters

index
the index of the widget whose text is to be set
text
the text to be associated with it
asHTML
true to treat the specified text as HTML

showStack

public void showStack(int index)
Shows the widget at the specified index.

Parameters

index
the widget index to be shown