开发者

GWT StackPanel limitation?

Is there a component like the StackPanel or DecoratedStackPanel that has the ability of showing more than one panel i开发者_StackOverflown the stack at a time? Id like to have the option of expanding all or collapsing any number of the panels I want.


Ok, since I got no answer, this is what has worked for me. Google doesn't make it real easy to extend existing panels to add or modify functionality, so what I did was I downloaded the source, copied StackPanel.java, DecoratorPanel.java and DecoratedStackPanel.java into a package in my gwt project.

The main change I really needed to do was to change the behavior of the showStack(int index) in the StackPanel.java class from

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

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

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

to something like this:

 public void showStack(int index) {

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

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


  }

I'm sure it's possible to clean this up a bit, but this did the trick. The reason the other classes need to be copied over to the same package is because StackPanel.java references some of their methods that only have package visibility.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜