cellItem.add(panel);
}
});
final AjaxFallbackDefaultDataTable confTable = new AjaxFallbackDefaultDataTable("syncopeconf", confColumns,
new SyncopeConfProvider(), confPaginatorRows);
confContainer = new WebMarkupContainer("confContainer");
confContainer.add(confTable);
confContainer.setOutputMarkupId(true);
add(confContainer);
createConfigWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
createConfigWin.setInitialHeight(CONFIG_WIN_HEIGHT);
createConfigWin.setInitialWidth(CONFIG_WIN_WIDTH);
createConfigWin.setCookieName("create-configuration-modal");
editConfigWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
editConfigWin.setInitialHeight(CONFIG_WIN_HEIGHT);
editConfigWin.setInitialWidth(CONFIG_WIN_WIDTH);
editConfigWin.setCookieName("edit-configuration-modal");
setWindowClosedCallback(createConfigWin, confContainer);
setWindowClosedCallback(editConfigWin, confContainer);
AjaxLink createConfigurationLink = new AjaxLink("createConfigurationLink") {
private static final long serialVersionUID = -7978723352517770644L;
@Override
public void onClick(final AjaxRequestTarget target) {
createConfigWin.setPageCreator(new ModalWindow.PageCreator() {
private static final long serialVersionUID = -7834632442532690940L;
@Override
public Page createPage() {
return new ConfigurationModalPage(Configuration.this.getPageReference(), createConfigWin,
new ConfigurationTO(), true);
}
});
createConfigWin.show(target);
}
};
MetaDataRoleAuthorizationStrategy.authorize(createConfigurationLink, ENABLE, xmlRolesReader.getAllAllowedRoles(
"Configuration", "create"));
add(createConfigurationLink);
Link dbExportLink = new Link<Void>("dbExportLink") {
private static final long serialVersionUID = -4331619903296515985L;
@Override
public void onClick() {
try {
HttpResourceStream stream = new HttpResourceStream(baseURL + "configuration/dbexport", restTemplate);
ResourceStreamRequestHandler rsrh = new ResourceStreamRequestHandler(stream);
rsrh.setFileName(stream.getFilename() == null
? "content.xml"
: stream.getFilename());
rsrh.setContentDisposition(ContentDisposition.ATTACHMENT);
getRequestCycle().scheduleRequestHandlerAfterCurrent(rsrh);
} catch (Exception e) {
error(getString("error") + ": " + e.getMessage());
}
}
};
MetaDataRoleAuthorizationStrategy.authorize(dbExportLink, ENABLE, xmlRolesReader.getAllAllowedRoles(
"Configuration", "read"));
add(dbExportLink);
Form confPaginatorForm = new Form("confPaginatorForm");
final DropDownChoice rowsChooser = new DropDownChoice("rowsChooser", new PropertyModel(this,
"confPaginatorRows"), prefMan.getPaginatorChoices());
rowsChooser.add(new AjaxFormComponentUpdatingBehavior("onchange") {
private static final long serialVersionUID = -1107858522700306810L;
@Override
protected void onUpdate(final AjaxRequestTarget target) {
prefMan.set(getRequest(), getResponse(), Constants.PREF_CONFIGURATION_PAGINATOR_ROWS, String.valueOf(
confPaginatorRows));
confTable.setItemsPerPage(confPaginatorRows);
target.add(confContainer);
}
});