TextParamPanel panel = new TextParamPanel(id, valueModel, labelModel, false); if (Number.class.isAssignableFrom(valueClass)) { panel.getFormComponent().setType(valueClass); panel.getFormComponent().add(RangeValidator.minimum(minimum.doubleValue())); panel.getFormComponent().add(RangeValidator.maximum(maximum.doubleValue())); return new TextParamPanel(id, valueModel, labelModel, false);
private FormComponent addTextPanel(final IModel paramsModel, final String paramName) { final String resourceKey = getClass().getSimpleName() + "." + paramName; final boolean required = true; final TextParamPanel textParamPanel = new TextParamPanel( paramName, new MapModel(paramsModel, paramName), new ResourceModel(resourceKey, paramName), required); textParamPanel.getFormComponent().setType(String.class); String defaultTitle = paramName; ResourceModel titleModel = new ResourceModel(resourceKey + ".title", defaultTitle); String title = String.valueOf(titleModel.getObject()); textParamPanel.add(AttributeModifier.replace("title", title)); add(textParamPanel); return textParamPanel.getFormComponent(); } }
@Override protected void onUpdate(AjaxRequestTarget target) { boolean enabled = useHttpConnectionPoolModel.getObject(); maxConnections.setEnabled(enabled); target.add(maxConnections); } });
final TextParamPanel namePanel = new TextParamPanel("namePanel", nameModel, new ResourceModel("AbstractWMSStorePage.dataSrcName", "Data Source Name"), true); form.add(new TextParamPanel("descriptionPanel", new PropertyModel(model, "description"), new ResourceModel("AbstractWMSStorePage.description", "Description"), false)); form.add(new CheckBoxParamPanel("enabledPanel", new PropertyModel(model, "enabled"), capabilitiesURL = new TextParamPanel("capabilitiesURL", new PropertyModel(model, "capabilitiesURL"), new ParamResourceModel("capabilitiesURL", AbstractWMSStorePage.this), true); form.add(capabilitiesURL); usernamePanel = new TextParamPanel("userNamePanel", userModel, new ResourceModel( "AbstractWMSStorePage.userName"), false); 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); form.add(new TextParamPanel("connectTimeoutPanel", connectTimeoutModel, new ResourceModel( "AbstractWMSStorePage.connectTimeout"), true, new RangeValidator<Integer>(1, 240))); form.add(new TextParamPanel("readTimeoutPanel", readTimeoutModel, new ResourceModel( "AbstractWMSStorePage.readTimeout"), true, new RangeValidator<Integer>(1, 360))); .getFormComponent(), namePanel.getFormComponent(), store.getId()); form.add(storeNameValidator);
new TextParamPanel( "repositoryNamePanel", new PropertyModel(formModel, "repoName"), "RepositoryImportPanel.repositoryName", "Repository Name"), true); repoNamePanel.setOutputMarkupId(true); repoNamePanel.getFormComponent().setOutputMarkupId(true); repoNamePanel.setVisible( DropDownModel.PG_CONFIG.equals(dropDownChoice.getModelObject().toString())); settingsPanel.add(repoNamePanel);
@Override public void convertInput() { PostgresConfigBean bean = new PostgresConfigBean(); // populate the bean String host = hostPanel.getFormComponent().getConvertedInput().toString().trim(); Integer port = Integer.class.cast(portPanel.getFormComponent().getConvertedInput()); String db = dbPanel.getFormComponent().getConvertedInput().toString().trim(); Object schema = schemaPanel.getFormComponent().getConvertedInput(); String username = usernamePanel.getFormComponent().getConvertedInput().toString().trim(); String password = passwordPanel.getFormComponent().getConvertedInput(); bean.setHost(host); bean.setPort(port); bean.setDatabase(db); bean.setUsername(username); bean.setPassword(password); if (schema == null || schema.toString().trim().isEmpty()) { bean.setSchema(null); } else { bean.setSchema(schema.toString().trim()); } setConvertedInput(bean); } }
private Component getInputComponent(String id, IModel paramsModel, String keyName) { if (keyName.contains("Color")) return new ColorPickerPanel(id, new MapModel(paramsModel, keyName), new org.apache.wicket.model.ResourceModel(keyName, keyName), false); else return new TextParamPanel(id, new MapModel(paramsModel, keyName), new org.apache.wicket.model.ResourceModel(keyName, keyName), false); } }
TextParamPanel tp = new TextParamPanel(componentId, model, new ResourceModel(paramLabel, paramLabel), required); tp.setVisible(false); parameterPanel = tp; } else if ("namespace".equals(paramName)) { model, new ResourceModel(paramLabel, paramLabel), required); } else { tp = new TextParamPanel(componentId, model, new ResourceModel(paramLabel, paramLabel), required);
@Override protected void onUpdate(AjaxRequestTarget target) { final String value = dropDownChoice.getModelObject().toString(); repoDirectoryComponent.setVisible( DropDownModel.DIRECTORY_CONFIG.equals(value)); pgPanel.setVisible(DropDownModel.PG_CONFIG.equals(value)); repoNamePanel.setVisible(DropDownModel.PG_CONFIG.equals(value)); target.add(settingsPanel); } });
new TextParamPanel( "namePanel", nameModel, new TextParamPanel( "descriptionPanel", new PropertyModel(model, "description"), new TextParamPanel( "capabilitiesURL", new PropertyModel(model, "capabilitiesURL"), new TextParamPanel( "userNamePanel", userModel, new TextParamPanel( "headerNamePanel", headerNameModel, new TextParamPanel( "headerValuePanel", headerValueModel, new TextParamPanel( "maxConnectionsPanel", connectionsModel, true,
public WMSStoreNewPage() { try { CatalogBuilder builder = new CatalogBuilder(getCatalog()); WMSStoreInfo store = builder.buildWMSStore(null); initUI(store); capabilitiesURL.getFormComponent().add(new WMSCapabilitiesURLValidator()); } catch (IOException e) { throw new RuntimeException("Could not setup the WMS store: " + e.getMessage(), e); } }
public S3InfoPanel(String componentId, Form storeEditForm) { super(componentId, storeEditForm); IModel model = storeEditForm.getModel(); setDefaultModel(model); IModel paramsModel = new PropertyModel(model, "connectionParameters"); TextParamPanel urlPanel = new TextParamPanel( "url", new PropertyModel(model, "URL"), new ResourceModel("url", "URL"), true, null); add(urlPanel); } }
public DefaultCoverageStoreEditPanel(final String componentId, final Form storeEditForm) { super(componentId, storeEditForm); final IModel formModel = storeEditForm.getModel(); // url TextParamPanel url = new TextParamPanel("urlPanel", new PropertyModel(formModel, "URL"), new ResourceModel("url", "URL"), true); url.getFormComponent().add(new FileExistsValidator()); add(url); }
new TextParamPanel( "namePanel", nameModel, new TextParamPanel( "descriptionPanel", new PropertyModel(model, "description"), new TextParamPanel( "capabilitiesURL", new PropertyModel(model, "capabilitiesURL"), new TextParamPanel( "userNamePanel", userModel, new TextParamPanel( "maxConnectionsPanel", connectionsModel, true, new RangeValidator<Integer>(1, 128)); maxConnections.setOutputMarkupId(true); maxConnections.setEnabled(useHttpConnectionPoolModel.getObject()); form.add(maxConnections); new PropertyModel<Integer>(model, "connectTimeout"); form.add( new TextParamPanel(
private FormComponent addTextPanel( final IModel paramsModel, final String paramName, final String paramTitle, final boolean required) { final String resourceKey = getClass().getSimpleName() + "." + paramName; final TextParamPanel textParamPanel = new TextParamPanel( paramName, new MapModel(paramsModel, paramTitle), new ResourceModel(resourceKey, paramName), required); textParamPanel.getFormComponent().setType(String.class /*param.type*/); String defaultTitle = paramTitle; ResourceModel titleModel = new ResourceModel(resourceKey + ".title", defaultTitle); String title = String.valueOf(titleModel.getObject()); textParamPanel.add(AttributeModifier.replace("title", title)); add(textParamPanel); return textParamPanel.getFormComponent(); }
@Override protected void onValidate(IValidatable validatable) { String url = (String) validatable.getValue(); try { HTTPClient client = new SimpleHttpClient(); usernamePanel.getFormComponent().processInput(); String user = usernamePanel.getFormComponent().getInput(); password.getFormComponent().processInput(); String pwd = password.getFormComponent().getInput(); if (user != null && user.length() > 0 && pwd != null && pwd.length() > 0) { client.setUser(user); client.setPassword(pwd); } WebMapServer server = new WebMapServer(new URL(url), client); server.getCapabilities(); } catch(Exception e) { error(validatable, "WMSCapabilitiesValidator.connectionFailure", Collections.singletonMap("error", e.getMessage())); } }
new TextParamPanel( "repositoryNamePanel", nameModel,
@Override protected void onUpdate(AjaxRequestTarget target) { boolean enabled = useHttpConnectionPoolModel.getObject(); maxConnections.setEnabled(enabled); target.add(maxConnections); } });