GWT StackPanel Limit?

Is there a component like a StackPanel or DecoratedStackPanel that can display more than one panel on the stack at a time? I'd love to be able to expand everything or collapse any number of panels that I want.

+5
source share
1 answer

Well, since I have not received an answer, this is what worked for me. Google does not make it easy to extend existing panels to add or change functionality, so I downloaded the source code, copied it StackPanel.java, DecoratorPanel.javaand DecoratedStackPanel.javainto the package in my gwt project.

The main change I really needed to make was to change the behavior showStack(int index)in the class StackPanel.javafrom

  public void showStack(int index) {
    if ((index >= getWidgetCount()) || (index < 0) || (index == visibleStack)) {
      return;
    }

    if (visibleStack >= 0) {
      setStackVisible(visibleStack, false);
    }

    visibleStack = index;
    setStackVisible(visibleStack, true);    }

like that:

 public void showStack(int index) {

    if ((index >= getWidgetCount()) || index < 0) {
       return;
    }

    visibleStack = index;
    setStackVisible(visibleStack, !getWidget(visibleStack).isVisible());


  }

I'm sure it can be cleaned a bit, but it did the trick. The reason other classes must be copied to the same package is because it StackPanel.javarefers to some of its methods that have only package visibility.

+3
source

All Articles