private static final long serialVersionUID = 1L;
@Override
protected void populateItem(ListItem<PivotField> item) {
final IModel<PivotField> itemModel = item.getModel();
final PivotField pivotField = itemModel.getObject();
final PivotField.Area area = PivotAreaPanel.this.area;
Label fieldLabel = new Label("field", new AbstractReadOnlyModel<String>() {
private static final long serialVersionUID = 1L;
@Override
public String getObject() {
String title = pivotField.getTitle();
if (area.equals(PivotField.Area.DATA)) {
title += " (" + pivotField.getCalculationDescription() + ")";
}
return title;
}
});
if (pivotField.isNumber()) {
item.add(AttributeModifier.append("class", "field-number"));
}
// add field actions panel
if (!area.equals(PivotField.Area.UNUSED)) {
PivotFieldActionsPanel pivotFieldActionsPanel = new PivotFieldActionsPanel("dropDownPanel", Model.of(pivotField), Model.of(getPivotModel()));
pivotFieldActionsPanel.setRenderBodyOnly(true);
item.add(pivotFieldActionsPanel);
String markupId = "dropdown-" + pivotField.getIndex();
pivotFieldActionsPanel.get("dropdown").setMarkupId(markupId);
fieldLabel.add(AttributeModifier.append("data-dropdown", "#" + markupId));
} else {
item.add(new EmptyPanel("dropDownPanel").setVisible(false));
}
item.add(fieldLabel);
item.setOutputMarkupId(true);
item.setMarkupId("field-" + pivotField.getIndex());
}
};
fieldsView.setOutputMarkupPlaceholderTag(true);
fieldsContainer.add(fieldsView);