form = new Form("form", model);
add(form);
// name
PropertyModel nameModel = new PropertyModel(model, "name");
final TextParamPanel namePanel = new TextParamPanel("namePanel", nameModel,
new ResourceModel("AbstractWMSStorePage.dataSrcName", "Data Source Name"), true);
form.add(namePanel);
// description and enabled
form.add(new TextParamPanel("descriptionPanel", new PropertyModel(model,
"description"), new ResourceModel("AbstractWMSStorePage.description", "Description"), false));
form.add(new CheckBoxParamPanel("enabledPanel", new PropertyModel(model, "enabled"),
new ResourceModel("enabled", "Enabled")));
// a custom converter will turn this into a namespace url
workspacePanel = new WorkspacePanel("workspacePanel",
new PropertyModel(model, "workspace"), new ResourceModel("workspace", "Workspace"),
true);
form.add(workspacePanel);
capabilitiesURL = new TextParamPanel("capabilitiesURL", new PropertyModel(model, "capabilitiesURL"),
new ParamResourceModel("capabilitiesURL", AbstractWMSStorePage.this), true);
form.add(capabilitiesURL);
// user name
PropertyModel userModel = new PropertyModel(model, "username");
usernamePanel = new TextParamPanel("userNamePanel", userModel, new ResourceModel(
"AbstractWMSStorePage.userName"), false);
form.add(usernamePanel);
// password
PropertyModel passwordModel = new PropertyModel(model, "password");
form.add(password = new PasswordParamPanel("passwordPanel", passwordModel, new ResourceModel(
"AbstractWMSStorePage.password"), false));
// max concurrent connections
final PropertyModel<Boolean> useHttpConnectionPoolModel = new PropertyModel<Boolean>(model,
"useConnectionPooling");
CheckBoxParamPanel useConnectionPooling = new CheckBoxParamPanel(
"useConnectionPoolingPanel", useHttpConnectionPoolModel, new ResourceModel(
"AbstractWMSStorePage.useHttpConnectionPooling"));
form.add(useConnectionPooling);
PropertyModel<String> connectionsModel = new PropertyModel<String>(model, "maxConnections");
final TextParamPanel maxConnections = new TextParamPanel("maxConnectionsPanel",
connectionsModel, new ResourceModel("AbstractWMSStorePage.maxConnections"), true,
new RangeValidator<Integer>(1, 128));
maxConnections.setOutputMarkupId(true);
maxConnections.setEnabled(useHttpConnectionPoolModel.getObject());
form.add(maxConnections);
useConnectionPooling.getFormComponent().add(new OnChangeAjaxBehavior() {
@Override
protected void onUpdate(AjaxRequestTarget target) {
boolean enabled = useHttpConnectionPoolModel.getObject();
maxConnections.setEnabled(enabled);
target.addComponent(maxConnections);
}
});
// connect timeout
PropertyModel<Integer> connectTimeoutModel = new PropertyModel<Integer>(model, "connectTimeout");
form.add(new TextParamPanel("connectTimeoutPanel", connectTimeoutModel, new ResourceModel(
"AbstractWMSStorePage.connectTimeout"), true, new RangeValidator<Integer>(1, 240)));
// read timeout
PropertyModel<Integer> readTimeoutModel = new PropertyModel<Integer>(model, "readTimeout");
form.add(new TextParamPanel("readTimeoutPanel", readTimeoutModel, new ResourceModel(
"AbstractWMSStorePage.readTimeout"), true, new RangeValidator<Integer>(1, 360)));
// cancel/submit buttons
form.add(new BookmarkablePageLink("cancel", StorePage.class));
form.add(saveLink());