Package com.sencha.gxt.widget.core.client

Examples of com.sencha.gxt.widget.core.client.SplitBar


  @Override
  protected void applyLayout(Widget component, Rectangle box) {
    super.applyLayout(component, box);
    if (component instanceof Component) {
      final SplitBar bar = ((Component) component).getData("splitBar");
      if (bar != null) {
        Scheduler.get().scheduleDeferred(new ScheduledCommand() {
          @Override
          public void execute() {
            bar.getElement().getStyle().setVisibility(Visibility.VISIBLE);
          }
        });
      }
    }
  }
View Full Code Here


    return cp;
  }

  protected SplitBar createSplitBar(Component component) {
    if (component == north) {
      return new SplitBar(LayoutRegion.SOUTH, component);
    } else if (component == south) {
      return new SplitBar(LayoutRegion.NORTH, component);
    } else if (component == west) {
      return new SplitBar(LayoutRegion.EAST, component);
    } else if (component == east) {
      return new SplitBar(LayoutRegion.WEST, component);
    }
    return null;
  }
View Full Code Here

    panel.clearSizeCache();

    doLayout();

    SplitBar bar = cp.getSplitBar();
    if (bar != null) {
      bar.sync();
    }

    fireEvent(new CollapseItemEvent<ContentPanel>(panel));
  }
View Full Code Here

    final BorderLayoutData data = getLayoutData(c);

    if (c instanceof CollapsePanel) {
      final CollapsePanel collapse = (CollapsePanel) c;
      final BorderLayoutData panelData = (BorderLayoutData) collapse.getContentPanel().getLayoutData();
      SplitBar bar = collapse.getData("splitBar");
      if (bar == null || bar.getTargetWidget() != c) {

        bar = collapse.getSplitBar();
        bar.setCollapsible(true);
        c.setData("splitBar", bar);

        if (panelData.isCollapseHidden()) {
          collapse.collapseHidden();
        }

        bar.addSelectHandler(new SelectHandler() {
          @Override
          public void onSelect(SelectEvent event) {
            onExpandClick((CollapsePanel) c);
          }
        });
      }
    }

    if (data.isCollapsible() && c instanceof ContentPanel && !c.isRendered()) {
      final ContentPanel cp = (ContentPanel) c;
      cp.setCollapsible(true);
      cp.setHideCollapseTool(true);

      IconConfig config = ToolButton.DOUBLELEFT;

      switch (getRegion(cp)) {
        case NORTH:
          config = ToolButton.DOUBLEUP;
          break;
        case SOUTH:
          config = ToolButton.DOUBLEDOWN;
          break;
        case EAST:
          config = ToolButton.DOUBLERIGHT;
          break;
      }

      cp.getHeader().addTool(new ToolButton(config, new SelectHandler() {

        @Override
        public void onSelect(SelectEvent event) {
          cp.collapse();
        }
      }));
      cp.addBeforeCollapseHandler(collapseHandler);
      cp.addBeforeExpandHandler(collapseHandler);
    }

    if (data.isSplit()) {
      SplitBar bar = c.getData("splitBar");
      if (bar == null || bar.getTargetWidget() != c) {
        bar = createSplitBar(c);
        final SplitBar fbar = bar;

        if (data.isCollapseMini()) {
          bar.setCollapsible(true);
          switch (getRegion(c)) {
            case EAST:
              bar.updateMini(Direction.RIGHT);
              break;
            case WEST:
              bar.updateMini(Direction.LEFT);
              break;
            case NORTH:
              bar.updateMini(Direction.UP);
              break;
            case SOUTH:
              bar.updateMini(Direction.DOWN);
              break;
          }
        }
        if (data.isCollapseMini()) {
          bar.addSelectHandler(new SelectHandler() {
            @Override
            public void onSelect(SelectEvent event) {
              ((ContentPanel) c).collapse();
            }
          });
        }
        bar.addSplitBarDragHandler(new SplitBarDragHandler() {

          @Override
          public void onDragEvent(SplitBarDragEvent event) {
            LayoutRegion region = getRegion(c);
            if (event.isStart()) {
              boolean side = region == LayoutRegion.WEST || region == LayoutRegion.EAST;
              int size = side ? c.getOffsetWidth() : c.getOffsetHeight();
              int centerSize = side ? lastCenter.getWidth() : lastCenter.getHeight();

              fbar.setMinSize(data.getMinSize());
              fbar.setMaxSize(Math.min(size + centerSize, data.getMaxSize()));

            } else {
              if (event.getSize() < 1) {
                return;
              }
View Full Code Here

TOP

Related Classes of com.sencha.gxt.widget.core.client.SplitBar

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.