use of org.activityinfo.ui.client.analysis.model.MeasureModel in project activityinfo by bedatadriven.
the class MeasurePane method showMenu.
private void showMenu(Element element, MeasureListItem item) {
MeasureModel measure = item.getModel();
Menu contextMenu = new Menu();
// Edit the alias
MenuItem editLabel = new MenuItem();
editLabel.setText("Edit Label...");
editLabel.addSelectionHandler(event -> editLabel(measure));
contextMenu.add(editLabel);
// Edit the formula...
MenuItem editFormula = new MenuItem();
editFormula.setText("Edit Formula...");
editFormula.addSelectionHandler(event -> editFormula(measure));
contextMenu.add(editFormula);
contextMenu.add(new SeparatorMenuItem());
// Choose the aggregation
for (Statistic statistic : Statistic.values()) {
CheckMenuItem aggregationItem = new CheckMenuItem(statistic.getLabel());
aggregationItem.setChecked(measure.getStatistics().contains(statistic));
aggregationItem.addCheckChangeHandler(event -> updateStatistic(measure, statistic, event.getChecked()));
contextMenu.add(aggregationItem);
}
contextMenu.add(new SeparatorMenuItem());
// Remove the dimension
MenuItem remove = new MenuItem();
remove.setText(I18N.CONSTANTS.remove());
remove.addSelectionHandler(event -> removeMeasure(measure.getId()));
contextMenu.add(remove);
contextMenu.show(element, new Style.AnchorAlignment(Style.Anchor.BOTTOM, Style.Anchor.BOTTOM, true));
}
Aggregations