コード例 #1
0
 public EventResult action() throws EventExecutionException {
   logger.debug(
       "Processing a chart creation event - id: "
           + getId()
           + " - collector name: "
           + getCollector().getName());
   HashMap<String, String> params = new HashMap<String, String>();
   for (Object o : getCollector().getParam()) {
     Param param = (Param) o;
     params.put(param.getName(), param.getValue());
   }
   Chart chart = null;
   try {
     chart = new Chart(getCollector().getName(), params);
     ChartManager.getInstance().addChart(getId(), chart);
   } catch (ChartParameterException e) {
     logger.error("Exception in chart parameters.");
     throw new EventExecutionException(e);
   }
   logger.info("Chart created.");
   return new EventResult(chart);
 }
コード例 #2
0
    public void actionPerformed(ActionEvent e) {
      // stop cell editing
      if (params.getCellEditor() != null && !params.getCellEditor().stopCellEditing()) return;

      String cTitle = title.getText().equals("") ? null : title.getText();
      String cXTitle = xAxisTitle.getText().equals("") ? null : xAxisTitle.getText();
      String cYTitle = yAxisTitle.getText().equals("") ? null : yAxisTitle.getText();

      Chart chart = null;
      try {
        chart = ChartManager.getInstance().getChart(chartName);
        chart.plot(
            (String) plotters.getSelectedItem(), cTitle, cXTitle, cYTitle, params.toHashMap());
        // close the dialog window on success
        ((JDialog) getRootPane().getParent()).dispose();
        MainWindow.getInstance().showDialog(new ChartPanel(chart.getPlot()), "Chart: " + chartName);
        MainWindow.getInstance().updateChartMenu();
      } catch (NoSuchChartException e1) {
        e1.printStackTrace();
        return;
      } catch (ChartParameterException e1) {
        e1.printStackTrace();
      }
    }