示例#1
0
  @Override
  public void add(
      final WorkbenchPanelPresenter.View newPanel,
      final WorkbenchPanelPresenter.View targetPanel,
      final Integer preferredSize,
      final Integer preferredMinSize) {

    final Widget parent = targetPanel.asWidget().getParent();

    if (parent instanceof SimplePanel) {

      final SimplePanel sp = (SimplePanel) parent;
      final HorizontalSplitterPanel hsp =
          factory.newHorizontalSplitterPanel(
              newPanel, targetPanel, Position.EAST, preferredSize, preferredMinSize);

      sp.clear();
      sp.setWidget(hsp);

      // Adding an additional embedded ScrollPanel can cause scroll-bars to disappear
      // so ensure we set the sizes of the new Panel and it's children after the
      // browser has added the new DIVs to the HTML tree. This does occasionally
      // add slight flicker when adding a new Panel.
      scheduleResize(hsp);
    }
  }
示例#2
0
  @Override
  public void remove(WorkbenchPanelPresenter.View panel) {
    final HorizontalSplitterPanel vsp =
        (HorizontalSplitterPanel) panel.asWidget().getParent().getParent().getParent();
    final Widget parent = vsp.getParent();
    final Widget westWidget = vsp.getWidget(Position.WEST);

    vsp.clear();

    // Set parent's content to the WEST widget
    if (parent instanceof SimplePanel) {
      ((SimplePanel) parent).setWidget(westWidget);
    }

    if (westWidget instanceof RequiresResize) {
      scheduleResize((RequiresResize) westWidget);
    }
  }