@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
String value = configStoreName.getValue();
if (value == null || value.isEmpty())
return;
PivotConfig config = new PivotConfig();
config.setName(value);
config.storeModelState(pivotModel);
pivotConfigStorage.saveConfig(config);
ModalWindow.closeCurrent(target);
}
};
form.add(saveButton);
add(form);
configNameModel = new Model<ArrayList<String>>();
configListView = new ListView<String>("configs", configNameModel) {
private static final long serialVersionUID = 1L;
@Override
protected void populateItem(final ListItem<String> item) {
item.add(new Label("name", new Model<String>(item.getModelObject())));
item.add(new AjaxLink<Void>("load") {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
PivotConfig config = pivotConfigStorage.loadConfig(item.getModelObject());
if (config == null) {
refreshList(target);
return;
}
config.restoreModelState(pivotModel);
ModalWindow.closeCurrent(target);
}
});
item.add(new AjaxLink<Void>("delete") {
private static final long serialVersionUID = 1L;