public CharsetPanel(final String id, final IModel charsetModel, final IModel paramLabelModel, final boolean required) { // make the value of the combo field the model of this panel, for easy // value retriaval super(id, charsetModel); // the label String requiredMark = required ? " *" : ""; Label label = new Label("paramName", paramLabelModel.getObject() + requiredMark); add(label); // the drop down field, with a decorator for validations final ArrayList charsets = new ArrayList(Charset.availableCharsets().keySet()); choice = new DropDownChoice("paramValue", charsetModel, charsets); choice.setRequired(required); // set the label to be the paramLabelModel otherwise a validation error would look like // "Parameter 'paramValue' is required" choice.setLabel(paramLabelModel); FormComponentFeedbackBorder feedback = new FormComponentFeedbackBorder("border"); feedback.add(choice); add(feedback); }
public ShapefileStoreEditPanel(final String componentId, final Form storeEditForm) { super(componentId, storeEditForm); final IModel model = storeEditForm.getModel(); setDefaultModel(model); final IModel paramsModel = new PropertyModel(model, "connectionParameters"); FileParamPanel file = buildFileParamPanel(paramsModel); add(file); add(new CharsetPanel("charset", new MapModel(paramsModel, DBFCHARSET.key), new ParamResourceModel("charset", this), false)); add(new CheckBoxParamPanel("memoryMapped", new MapModel(paramsModel, MEMORY_MAPPED.key), new ParamResourceModel("memoryMapped", this))); add(new CheckBoxParamPanel("cacheMemoryMaps", new MapModel(paramsModel, CACHE_MEMORY_MAPS.key), new ParamResourceModel("cacheMemoryMaps", this))); add(new CheckBoxParamPanel("spatialIndex", new MapModel(paramsModel, CREATE_SPATIAL_INDEX.key), new ParamResourceModel("spatialIndex", this))); }
public ShapefileStoreEditPanel(final String componentId, final Form storeEditForm) { super(componentId, storeEditForm); final IModel model = storeEditForm.getModel(); setDefaultModel(model); final IModel paramsModel = new PropertyModel(model, "connectionParameters"); FileParamPanel file = buildFileParamPanel(paramsModel); add(file); add( new CharsetPanel( "charset", new MapModel(paramsModel, DBFCHARSET.key), new ParamResourceModel("charset", this), false)); add( new CheckBoxParamPanel( "memoryMapped", new MapModel(paramsModel, MEMORY_MAPPED.key), new ParamResourceModel("memoryMapped", this))); add( new CheckBoxParamPanel( "cacheMemoryMaps", new MapModel(paramsModel, CACHE_MEMORY_MAPS.key), new ParamResourceModel("cacheMemoryMaps", this))); add( new CheckBoxParamPanel( "spatialIndex", new MapModel(paramsModel, CREATE_SPATIAL_INDEX.key), new ParamResourceModel("spatialIndex", this))); }
public CharsetPanel( final String id, final IModel<String> charsetModel, final IModel<String> paramLabelModel, final boolean required) { // make the value of the combo field the model of this panel, for easy // value retriaval super(id, charsetModel); // the label String requiredMark = required ? " *" : ""; Label label = new Label("paramName", paramLabelModel.getObject() + requiredMark); add(label); // the drop down field, with a decorator for validations final ArrayList<String> charsets = new ArrayList<String>(Charset.availableCharsets().keySet()); choice = new DropDownChoice<String>("paramValue", charsetModel, charsets); choice.setRequired(required); // set the label to be the paramLabelModel otherwise a validation error would look like // "Parameter 'paramValue' is required" choice.setLabel(paramLabelModel); FormComponentFeedbackBorder feedback = new FormComponentFeedbackBorder("border"); feedback.add(choice); add(feedback); }