public ContentPanel getNewContentPanel() {
   ContentPanel contentPanel = new ContentPanel();
   contentPanel.setLayout(new FitLayout());
   contentPanel.setHeading(getPanelTitle());
   IconSupplier.setIcon(contentPanel, IconSupplier.getReportIconName());
   return contentPanel;
 }
Exemple #2
0
 @Override
 public void onRender(Element parent, int index) {
   //	setForceHeight(500);
   setAdditionalWidthPadding(14);
   //	setForceWidth(600);
   //	setAutoExpandColumn("spacer");
   setLayout(new CenterLayout());
   //	setLayout(new FillLayout(Orientation.VERTICAL));
   setPanelHeading("Users");
   IconSupplier.setIcon(this.panel, IconSupplier.getUsersIconName());
   super.onRender(parent, index);
 }
  @Override
  public void addPanelContent() {
    //		contentPanel = new ContentPanel();
    contentPanel.setLayout(new FitLayout());
    //		contentPanel.setHeading("Snapshot Terms Chart View");
    IconSupplier.setIcon(contentPanel, IconSupplier.getPieChartIconName());

    if (store == null) store = getNewStore();

    if (chart == null) createChart();

    addHelpTool(contentPanel);
    contentPanel.getHeader().addTool(getParametersTool());

    contentPanel.setTopComponent(getButtonsBar());

    contentPanel.add(chart, new MarginData(20));

    add(contentPanel);

    if (snapshot != null && localStore) store.getLoader().load();
  }
  /**
   * Set up and get a button bar with buttons to expand or collapse the tree.
   *
   * @return
   */
  public ToolBar getButtonsBar() {
    ButtonBar toolbar = new ButtonBar();
    toolbar.setAlignment(HorizontalAlignment.CENTER);

    pieButton = new ToggleButton("Pie Chart");
    pieButton.setToggleGroup("chartType");
    IconSupplier.forceIcon(pieButton, IconSupplier.getPieChartIconName());
    pieButton.addSelectionListener(
        new SelectionListener<ButtonEvent>() {

          @Override
          public void componentSelected(ButtonEvent ce) {
            chartType = PIE_CHART;
            redoChart();
          }
        });

    barButton = new ToggleButton("Bar Graph");
    barButton.setToggleGroup("chartType");
    IconSupplier.forceIcon(barButton, IconSupplier.getBarChartIconName());
    barButton.addSelectionListener(
        new SelectionListener<ButtonEvent>() {

          @Override
          public void componentSelected(ButtonEvent ce) {
            chartType = BAR_CHART;
            redoChart();
          }
        });

    if (chartType == BAR_CHART) barButton.toggle(true);
    else pieButton.toggle(true);

    valueCombo =
        FieldFactory.getModelDataComboField(
            "valueBox",
            "",
            100,
            "Select the value to chart.",
            getValueComboStore(),
            "value",
            "description");
    valueCombo.enable();
    setValueCombo();
    valueCombo.addSelectionChangedListener(
        new SelectionChangedListener<ModelData>() {

          @Override
          public void selectionChanged(SelectionChangedEvent<ModelData> se) {
            if (se.getSelectedItem() != null && se.getSelectedItem().get("value") != null) {
              valueCol = se.getSelectedItem().get("value").toString();
              valueLabel = se.getSelectedItem().get("description").toString();
              redoChart();
            }
          }
        });

    groupCombo =
        FieldFactory.getModelDataComboField(
            "valueBox",
            "",
            100,
            "Select the value to chart.",
            getGroupComboStore(),
            "value",
            "description");
    groupCombo.enable();
    setGroupCombo();
    groupCombo.addSelectionChangedListener(
        new SelectionChangedListener<ModelData>() {

          @Override
          public void selectionChanged(SelectionChangedEvent<ModelData> se) {
            if (se.getSelectedItem() != null && se.getSelectedItem().get("value") != null) {
              groupCol = se.getSelectedItem().get("value").toString();
              groupLabel = se.getSelectedItem().get("description").toString();
              labelCol = groupCol;
              textCol = groupCol;
              redoChart();
            }
          }
        });

    toolbar.add(pieButton);
    toolbar.add(barButton);
    toolbar.add(new SeparatorToolItem());
    toolbar.add(new Html("Chart"));
    toolbar.add(valueCombo);
    toolbar.add(new Html("By"));
    toolbar.add(groupCombo);

    return toolbar;
  }