private static final Logger LOGGER = Logging.getLogger(GWCSettingsPage.class);
public GWCSettingsPage() {
setHeaderPanel(headerPanel());
GWC gwc = GWC.get();
// use a detached copy of gwc config to support the tabbed pane
final GWCConfig gwcConfig = gwc.getConfig().clone();
IModel<GWCConfig> formModel = new Model<GWCConfig>(gwcConfig);
final Form<GWCConfig> form = new Form<GWCConfig>("form", formModel);
add(form);
final GWCServicesPanel gwcServicesPanel = new GWCServicesPanel("gwcServicesPanel",
formModel);
final CachingOptionsPanel defaultCachingOptionsPanel = new CachingOptionsPanel(
"cachingOptionsPanel", formModel);
form.add(gwcServicesPanel);
form.add(defaultCachingOptionsPanel);
form.add(new Button("submit") {
private static final long serialVersionUID = 1L;
@Override
public void onSubmit() {
GWC gwc = GWC.get();
final IModel<GWCConfig> gwcConfigModel = form.getModel();
GWCConfig gwcConfig = gwcConfigModel.getObject();
try {
gwc.saveConfig(gwcConfig);
} catch (IOException e) {
LOGGER.log(Level.WARNING, "Error saving GWC config", e);
form.error("Error saving GWC config: " + e.getMessage());
return;
}