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

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


        });
      }
    }

    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;
        case WEST:
        case CENTER:
          // do nothing
      }

      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) {
View Full Code Here


      BorderLayoutData data = getLayoutData(w);
      if (data.isHidden()) {
        return;
      }
      CollapsePanel collapse = (CollapsePanel) w;
      ContentPanel cp = (ContentPanel) collapse.getData("panel");
      onExpand(cp);
    }
  }
View Full Code Here

    fireEvent(new ExpandItemEvent<ContentPanel>(panel));
  }

  protected void onExpandClick(CollapsePanel collapse) {
    ContentPanel panel = collapse.getContentPanel();
    onExpand(panel);
  }
View Full Code Here

        });
      }
    }

    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) {
View Full Code Here

      switch (expandMode) {
        case MULTI:
        case SINGLE:
          for (int i = 0, len = getWidgetCount(); i < len; i++) {
            ContentPanel c = (ContentPanel) getWidget(i);
            if (expandMode == ExpandMode.SINGLE && c != activeWidget) {
              c.collapse();
            }
            applyLayout(c, size.getWidth(), -1);
          }
          break;
        case SINGLE_FILL:
          if (activeWidget.isExpanded()) {
            int hh = 0;
            for (int i = 0, len = getWidgetCount(); i < len; i++) {
              ContentPanel c = (ContentPanel) getWidget(i);

              if (c != activeWidget) {
                c.collapse();
                hh += (c.getHeader().getOffsetHeight());
                applyLayout(c, size.getWidth(), -1);
              }
            }
            activeWidget.setPixelSize(size.getWidth(), size.getHeight() - hh);
          } else {
            for (int i = 0, len = getWidgetCount(); i < len; i++) {
              ContentPanel c = (ContentPanel) getWidget(i);
              if (c != activeWidget) {
                c.collapse();
              }
              applyLayout(c, size.getWidth(), -1);
            }
          }

      }

    } else {
      for (int i = 0, len = getWidgetCount(); i < len; i++) {
        ContentPanel c = (ContentPanel) getWidget(i);
        if (c != activeWidget) {
          c.collapse();
        }
      }
    }
  }
View Full Code Here

  @Override
  protected void onInsert(int index, Widget child) {
    super.onInsert(index, child);
    assert child instanceof ContentPanel : "AccordionLayoutContainer must be ContentPanels";

    ContentPanel cp = (ContentPanel) child;
    cp.addBeforeExpandHandler(handler);
    cp.addExpandHandler(handler);
    cp.setCollapsible(true);
    cp.setHideCollapseTool(hideCollapseTool);
    cp.setAnimCollapse(false);
    cp.setTitleCollapse(titleCollapse);
  }
View Full Code Here

  }

  protected void onRemove(Widget child) {
    super.onRemove(child);

    ContentPanel cp = (ContentPanel) child;
    ComponentHelper.removeHandler(cp, BeforeExpandEvent.getType(), handler);
    ComponentHelper.removeHandler(cp, ExpandEvent.getType(), handler);
  }
View Full Code Here

  }
  public void debug(String msg) {
    debugLog.setText(msg + "\n" + debugLog.getText());
  }
  public Widget asWidget() {
    final ContentPanel panel = new FramedPanel();
    panel.setCollapsible(true);
    new Resizable(panel);

    panel.getElement().getStyle().setMargin(2, Unit.PX);
    // set a header of the panel
    panel.setHeadingText("Debug Messages");
    panel.setBodyBorder(true);
    panel.setBodyStyleName("white-bg");
    debugLog.setVisibleLines(10);
    debugLog.setWidth("100%");
    debugLog.setHeight("10%");
    // debugLog.setVisibleLines(40);
    debugLog.setReadOnly(true);
    ScrollPanel debugScrollable = new ScrollPanel(debugLog);
    panel.add(debugScrollable);
    return debugScrollable;
  }
View Full Code Here

    this.width = width;
    this.height = height;
    flexTable = createInfoTable(dsConfig.getPublisherID(), dsConfig.getDsName(), dsConfig.getDsTimeoutInterval());
  }
  private Widget createChart(final DataSourceConfiguration dsConfig, final int width, final int height) {
    final ContentPanel panel = new FramedPanel();
    dashboardService.getDataUpdate(dsConfig.getDsID(), "1", dsConfig.getSeriesCount(), 50, new AsyncCallback<ArrayList<DataVO>>() {

      public void onFailure(Throwable caught) {
        dbg.debug("Failed in getDataUpdate " + caught);
      }

      public void onSuccess(ArrayList<DataVO> result) {
        // the panel that will hold the chart

        //panel.setCollapsible(true);
        dbg.debug("seriesSetCount=" + result.size());

        new Draggable(panel, panel.getHeader()).setUseProxy(false);
        final Resizable resize = new Resizable(panel, Dir.E, Dir.SE, Dir.S);
        resize.setMinHeight(400);
        resize.setMinWidth(400);
        panel.setLayoutData(HasHorizontalAlignment.ALIGN_LEFT);
        panel.getElement().getStyle().setMargin(2, Unit.PX);
        // set a header of the panel
        panel.setHeadingText(dsConfig.getDsName());
        panel.setPixelSize(width, height);
        panel.setBodyBorder(true);
        panel.setBodyStyleName("white-bg");

        try {
          chart = ChartFactory.getChart(dsConfig,result,ChartType.VERTICAL_BAR);

          final ToggleButton toggleLive = new ToggleButton("Live");
          toggleLive.setValue(true,false);
//          toggleLive.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
//           
//            public void onValueChange(ValueChangeEvent<Boolean> event) {
//              if (event.getValue()) {
//                enableLive();
//              } else {
//                disableLive();
//              }
//             
//            }
//          });
          toggleLive.addSelectHandler(new SelectHandler() {
            public void onSelect(SelectEvent event) {             
              if (pushListener == null){
                enableLive();
                toggleLive.setValue(true, false, true);
              } else {
                disableLive();
                toggleLive.setValue(false, false, true);
              }
            }
          });

//          final ComboBox<LineSeries<TimeSeriesDataVO>> box = new ComboBox<LineSeries<TimeSeriesDataVO>>(fieldStore,
//              new LabelProvider<LineSeries<TimeSeriesDataVO>>() {
//                public String getLabel(LineSeries<TimeSeriesDataVO> item) {
//                  return item.getYField().getPath();
//                }
//              });

          final TextField fieldInput = new TextField();
          fieldInput.setValue("first");
          fieldInput.setAllowBlank(false);
          fieldInput.addValidator(new MaxLengthValidator(20));
          final RegExp regex = RegExp.compile("\\s");
          fieldInput.addValidator(new Validator<String>() {
            public List<EditorError> validate(Editor<String> editor, String value) {
              if (regex.test(value)) {
                List<EditorError> errors = new ArrayList<EditorError>();
                errors.add(new DefaultEditorError(editor, "Field name cannot contain spaces.", ""));
                return errors;
              }
              return null;
            }
          });

          TextButton add = new TextButton("Add");
          add.addSelectHandler(new SelectHandler() {
            public void onSelect(SelectEvent event) {
//              String field = fieldInput.getValue();
//              if (fieldInput.isCurrentValid() && field.length() > 0 && fieldStore.findModelWithKey(field) == null && fieldStore.size() < 10) {
//                for (int i = 0; i < store.size(); i++) {
//                  TimeSeriesDataVO item = store.get(i);
//                  item.put(field, Math.random() * 100);
//                }
//                LineSeries<TimeSeriesDataVO> series = createLine(field);
//                fieldStore.add(series);
//                axis.addField(series.getYField());
//                chart.addSeries(series);
//                chart.redrawChart();
//              }
            }
          });

          TextButton remove = new TextButton("Remove");
          remove.addSelectHandler(new SelectHandler() {
            public void onSelect(SelectEvent event) {
//              String field = box.getText();
//              LineSeries<TimeSeriesDataVO> series = fieldStore.findModelWithKey(field);
//              if (field.length() > 0 && series != null && fieldStore.size() > 0) {
//                for (int i = 0; i < store.size(); i++) {
//                  TimeSeriesDataVO item = store.get(i);
//                  item.remove(field);
//                }
//                fieldStore.remove(series);
//                axis.removeField(series.getYField());
//                chart.removeSeries(series);
//                chart.redrawChart();
//              }
//              box.clear();
            }
          });

          ToolBar toolBar = new ToolBar();
          toolBar.add(toggleLive);
          toolBar.add(new SeparatorToolItem());
          toolBar.add(add);
          toolBar.add(fieldInput);
          toolBar.add(new SeparatorToolItem());
          toolBar.add(remove);
//          toolBar.add(box);

          VerticalLayoutContainer layout2 = new VerticalLayoutContainer();

          toolBar.setLayoutData(new VerticalLayoutData(1, -1));
          layout2.add(toolBar);

//          chart.setLayoutData(new VerticalLayoutData(1, 1));
          layout2.add(chart.asWidget());
          final VerticalLayoutContainer layout = new VerticalLayoutContainer();

          layout.setBorders(true);
          // table that provide the data source information
          layout.add(flexTable, new VerticalLayoutData(1, height / 10));
          errorLabel.setHeight("20px");
          errorLabel.setText("");

          layout.add(layout2,new VerticalLayoutData(1, 1));
          layout.add(errorLabel);
          enableLive();
          panel.add(layout);
         

        } catch (ChartSettingsNotValidException e) {
          errorLabel.setText(e.getMessage());
          dbg.debug("Failed in createChart " + e);
View Full Code Here

      west.setMargins(new Margins(3));
      west.setSplit(true);
      west.setSize(300);
      west.setCollapsible(true);
      west.setCollapseMini(true);
      ContentPanel sc=new ContentPanel();
      sc.setHeaderVisible(false);
      SimpleContainer sc2=new SimpleContainer();
      border.setWestWidget(sc, west);
      border.setCenterWidget(sc2, new MarginData(3));
      presenter.getJobManagerPresenter().go(sc);
      presenter.getJobDisplayPresenter().go(sc2);
View Full Code Here

TOP

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

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.