Exemple #1
0
  public void addPanel(final WPanel panel) {
    panel.setCollapsible(true);
    panel.collapse();

    panel
        .expanded()
        .addListener(
            this,
            new Signal.Listener() {
              public void trigger() {
                onExpand(true, panel);
              }
            });

    panel
        .collapsed()
        .addListener(
            this,
            new Signal.Listener() {
              public void trigger() {
                onExpand(false, panel);
              }
            });

    super.addWidget(panel);
  }
Exemple #2
0
  public WPanel addWidget(String text, WWidget w) {
    WPanel p = new WPanel();
    p.setTitle(text);
    p.setCentralWidget(w);

    addPanel(p);

    return p;
  }
Exemple #3
0
  private void onExpand(boolean notUndo, WPanel sender) {
    WPanel panel = sender;

    if (notUndo) {
      wasExpanded_ = -1;

      for (int i = 0; i < getChildren().size(); ++i) {
        WPanel p = (WPanel) getChildren().get(i);
        if (p != panel) {
          if (!p.isCollapsed()) wasExpanded_ = i;
          p.collapse();
        }
      }
    } else {
      if (wasExpanded_ != -1) {
        WPanel p = (WPanel) getChildren().get(wasExpanded_);
        p.expand();
      }
    }
  }