コード例 #1
0
    @Override
    public void menuAboutToShow(IMenuManager manager) {
      manager.add(
          new Action(Messages.MenuExportChartData) {
            @Override
            public void run() {
              ScatterChartCSVExporter exporter = new ScatterChartCSVExporter(chart);
              exporter.setValueFormat(new DecimalFormat("0.##########%")); // $NON-NLS-1$
              exporter.export(getTitle() + ".csv"); // $NON-NLS-1$
            }
          });

      Set<Class<?>> exportTypes =
          new HashSet<Class<?>>(
              Arrays.asList(
                  new Class<?>[] { //
                    Client.class,
                    Security.class,
                    Portfolio.class,
                    Account.class,
                    Classification.class
                  }));

      for (DataSeries series : picker.getSelectedDataSeries()) {
        if (exportTypes.contains(series.getType())) addMenu(manager, series);
      }

      manager.add(new Separator());
      chart.exportMenuAboutToShow(manager, getTitle());
    }
コード例 #2
0
  private void setChartSeries() {
    List<Exception> warnings = new ArrayList<Exception>();

    for (DataSeries item : picker.getSelectedDataSeries()) {
      if (item.getType() == Client.class)
        addClient(item, (ClientDataSeries) item.getInstance(), warnings);
      else if (item.getType() == Security.class)
        addSecurity(item, (Security) item.getInstance(), warnings);
      else if (item.getType() == Portfolio.class)
        addPortfolio(item, (Portfolio) item.getInstance(), warnings);
      else if (item.getType() == Account.class)
        addAccount(item, (Account) item.getInstance(), warnings);
      else if (item.getType() == Classification.class)
        addClassification(item, (Classification) item.getInstance(), warnings);
    }

    PortfolioPlugin.log(warnings);
  }