@Override
public void onClick(AjaxRequestTarget target) {
ModalWindow modal = findParent(PivotAreaPanel.class).getModal();
modal.setTitle("Aggregator");
final AggregatorPanel panel = new AggregatorPanel(modal.getContentId(), Model.of(field));
panel.add(AttributeModifier.append("style", "padding: 10px;"));
modal.setContent(panel);
modal.setAutoSize(true);
modal.setResizable(false);
modal.show(target);
modal.setWindowClosedCallback(new WindowClosedCallback() {
private static final long serialVersionUID = 1L;
@Override
public void onClose(AjaxRequestTarget target) {
if (!panel.isOkPressed()) {
return;
}
target.add(findParent(PivotAreaPanel.class));
PivotModel pivotModel = getPivotModel();
pivotModel.getField(field.getName()).setAggregator(panel.getAggregator());
if (pivotModel.isAutoCalculate()) {
findParent(PivotPanel.class).compute(target);
}
}