use of name.abuchen.portfolio.ui.views.dataseries.DataSeriesLabelProvider in project portfolio by buchen.
the class DataSeriesConfig method doAddSeries.
private void doAddSeries(boolean showOnlyBenchmark) {
List<DataSeries> list = delegate.getDashboardData().getDataSeriesSet().getAvailableSeries().stream().filter(ds -> ds.isBenchmark() == showOnlyBenchmark).collect(Collectors.toList());
ListSelectionDialog dialog = new ListSelectionDialog(Display.getDefault().getActiveShell(), new DataSeriesLabelProvider());
dialog.setTitle(Messages.ChartSeriesPickerTitle);
dialog.setMessage(Messages.ChartSeriesPickerTitle);
dialog.setElements(list);
dialog.setMultiSelection(false);
if (dialog.open() != ListSelectionDialog.OK)
return;
Object[] result = dialog.getResult();
if (result == null || result.length == 0)
return;
dataSeries = (DataSeries) result[0];
delegate.getWidget().getConfiguration().put(Dashboard.Config.DATA_SERIES.name(), dataSeries.getUUID());
// construct label to indicate the data series (user can manually change
// the label later)
// $NON-NLS-1$
String label = WidgetFactory.valueOf(delegate.getWidget().getType()).getLabel() + ", " + dataSeries.getLabel();
delegate.getWidget().setLabel(label);
delegate.getClient().markDirty();
}
Aggregations