コード例 #1
0
 @Override
 public JComponent getPrintableComponent() {
   if (saveGraphToFile == true) {
     saveGraphToFile = false;
     graphPanel.setBounds(
         graphPanel.getLocation().x,
         graphPanel.getLocation().y,
         graphPanel.width,
         graphPanel.height);
     return graphPanel;
   }
   return this;
 }
コード例 #2
0
  public void makeGraph() {
    nbColToGraph = getNbColumns();
    Dimension size = graphPanel.getSize();
    String lstr = maxLengthXAxisLabel.getText();
    // canvas size
    int width = (int) size.getWidth();
    int height = (int) size.getHeight();
    if (!dynamicGraphSize.isSelected()) {
      String wstr = graphWidth.getText();
      String hstr = graphHeight.getText();
      if (wstr.length() != 0) {
        width = Integer.parseInt(wstr);
      }
      if (hstr.length() != 0) {
        height = Integer.parseInt(hstr);
      }
    }

    if (lstr.length() == 0) {
      lstr = "20"; // $NON-NLS-1$
    }
    int maxLength = Integer.parseInt(lstr);
    String yAxisStr = maxValueYAxisLabel.getText();
    int maxYAxisScale = yAxisStr.length() == 0 ? 0 : Integer.parseInt(yAxisStr);

    graphPanel.setData(this.getData());
    graphPanel.setTitle(graphTitle.getText());
    graphPanel.setMaxLength(maxLength);
    graphPanel.setMaxYAxisScale(maxYAxisScale);
    graphPanel.setXAxisLabels(getAxisLabels());
    graphPanel.setXAxisTitle((String) columnsList.getSelectedItem());
    graphPanel.setYAxisLabels(this.yAxisLabel);
    graphPanel.setYAxisTitle(this.yAxisTitle);
    graphPanel.setLegendLabels(getLegendLabels());
    graphPanel.setColor(getBackColors());
    graphPanel.setForeColor(colorForeGraph);
    graphPanel.setOutlinesBarFlag(drawOutlinesBar.isSelected());
    graphPanel.setShowGrouping(numberShowGrouping.isSelected());
    graphPanel.setValueOrientation(valueLabelsVertical.isSelected());
    graphPanel.setLegendPlacement(
        StatGraphProperties.getPlacementNameMap()
            .get(legendPlacementList.getSelectedItem())
            .intValue());

    graphPanel.setTitleFont(
        new Font(
            StatGraphProperties.getFontNameMap().get(titleFontNameList.getSelectedItem()),
            StatGraphProperties.getFontStyleMap()
                .get(titleFontStyleList.getSelectedItem())
                .intValue(),
            Integer.parseInt((String) titleFontSizeList.getSelectedItem())));
    graphPanel.setLegendFont(
        new Font(
            StatGraphProperties.getFontNameMap().get(fontNameList.getSelectedItem()),
            StatGraphProperties.getFontStyleMap().get(fontStyleList.getSelectedItem()).intValue(),
            Integer.parseInt((String) fontSizeList.getSelectedItem())));
    graphPanel.setValueFont(
        new Font(
            StatGraphProperties.getFontNameMap().get(valueFontNameList.getSelectedItem()),
            StatGraphProperties.getFontStyleMap()
                .get(valueFontStyleList.getSelectedItem())
                .intValue(),
            Integer.parseInt((String) valueFontSizeList.getSelectedItem())));

    graphPanel.setHeight(height);
    graphPanel.setWidth(width);
    spane.repaint();
  }
コード例 #3
0
  /** Main visualizer setup. */
  private void init() {
    this.setLayout(new BorderLayout());

    // MAIN PANEL
    JPanel mainPanel = new JPanel();
    Border margin = new EmptyBorder(10, 10, 5, 10);
    Border margin2 = new EmptyBorder(10, 10, 5, 10);

    mainPanel.setBorder(margin);
    mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
    mainPanel.add(makeTitlePanel());

    myJTable = new JTable(model);
    myJTable.setPreferredScrollableViewportSize(new Dimension(500, 80));
    RendererUtils.applyRenderers(myJTable, RENDERERS);
    myScrollPane = new JScrollPane(myJTable);

    settingsPane = new VerticalPanel();
    settingsPane.setBorder(margin2);

    graphPanel = new AxisGraph();
    graphPanel.setPreferredSize(new Dimension(defaultWidth, defaultHeight));

    settingsPane.add(createGraphActionsPane());
    settingsPane.add(createGraphColumnPane());
    settingsPane.add(createGraphTitlePane());
    settingsPane.add(createGraphDimensionPane());
    JPanel axisPane = new JPanel(new BorderLayout());
    axisPane.add(createGraphXAxisPane(), BorderLayout.WEST);
    axisPane.add(createGraphYAxisPane(), BorderLayout.CENTER);
    settingsPane.add(axisPane);
    settingsPane.add(createLegendPane());

    tabbedGraph.addTab(
        JMeterUtils.getResString("aggregate_graph_tab_settings"), settingsPane); // $NON-NLS-1$
    tabbedGraph.addTab(
        JMeterUtils.getResString("aggregate_graph_tab_graph"), graphPanel); // $NON-NLS-1$

    // If clic on the Graph tab, make the graph (without apply interval or filter)
    ChangeListener changeListener =
        new ChangeListener() {
          @Override
          public void stateChanged(ChangeEvent changeEvent) {
            JTabbedPane srcTab = (JTabbedPane) changeEvent.getSource();
            int index = srcTab.getSelectedIndex();
            if (srcTab
                .getTitleAt(index)
                .equals(JMeterUtils.getResString("aggregate_graph_tab_graph"))) { // $NON-NLS-1$
              actionMakeGraph();
            }
          }
        };
    tabbedGraph.addChangeListener(changeListener);

    spane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
    spane.setLeftComponent(myScrollPane);
    spane.setRightComponent(tabbedGraph);
    spane.setResizeWeight(.2);
    spane.setBorder(null); // see bug jdk 4131528
    spane.setContinuousLayout(true);

    this.add(mainPanel, BorderLayout.NORTH);
    this.add(spane, BorderLayout.CENTER);
  }