List of usage examples for org.apache.wicket.validation.validator StringValidator maximumLength
public static StringValidator maximumLength(int length)
From source file:at.ac.tuwien.ifs.tita.ui.controls.panel.AdministrationPanelEffort.java
License:Apache License
/** * Displays all effort textfields.//w ww . j a v a 2s. co m */ private void displayTextFields() { teDescription = new ValidationTextField<String>("tedescription", new Model<String>("")); teDescription.add(StringValidator.maximumLength(IntegerConstants.FIFTY)); teDescription.setOutputMarkupId(true); form.add(teDescription); teDate = new ValidationDateTextField("tedate", new PropertyModel<Date>(this, "date"), new StyleDateConverter("S-", true)); teDate.add(new DatePicker()); teDate.setOutputMarkupId(true); form.add(teDate); teTimeLength = new ValidationTextField<String>("tetimelength", new Model<String>("")); teTimeLength.setType(String.class); teTimeLength.add(new AjaxFormComponentUpdatingBehavior("onchange") { @Override protected void onUpdate(AjaxRequestTarget target) { } }); teTimeLength.setOutputMarkupId(true); form.add(teTimeLength); teStartTime = new ValidationTextField<String>("testarttime", new Model<String>("")); teStartTime.setType(String.class); teStartTime.add(new AjaxFormComponentUpdatingBehavior("onchange") { @Override protected void onUpdate(AjaxRequestTarget target) { } }); teStartTime.setOutputMarkupId(true); form.add(teStartTime); teEndTime = new ValidationTextField<String>("teendtime", new Model<String>("")); teEndTime.setType(String.class); teEndTime.add(new AjaxFormComponentUpdatingBehavior("onchange") { @Override protected void onUpdate(AjaxRequestTarget target) { } }); teEndTime.setOutputMarkupId(true); form.add(teEndTime); teCostCenter = new ValidationTextField<String>("tecostcenter", new Model<String>("")); teCostCenter.setType(String.class); teCostCenter.add(new AjaxFormComponentUpdatingBehavior("onchange") { @Override protected void onUpdate(AjaxRequestTarget target) { } }); teCostCenter.setOutputMarkupId(true); form.add(teCostCenter); }
From source file:at.ac.tuwien.ifs.tita.ui.controls.panel.AdministrationPanelEffort.java
License:Apache License
/** * Display all FilterFields.//from w ww . j a v a2s . c om */ private void displayFilterFields() { teFilterDescription = new TextField<String>("filterdescription", new Model<String>("")) { }; teFilterDescription.add(StringValidator.maximumLength(IntegerConstants.FIFTY)); teFilterDescription.setType(String.class); teFilterDescription.add(new OnChangeAjaxBehavior() { @Override protected void onUpdate(AjaxRequestTarget target) { filterList(target); } }); form.add(teFilterDescription); teFilterDateFrom = new DateTextField("filterdatefrom", new PropertyModel<Date>(this, "dateFrom"), new StyleDateConverter("S-", true)); teFilterDateFrom.add(new DatePicker()); teFilterDateFrom.add(new AjaxFormComponentUpdatingBehavior("onchange") { @Override protected void onUpdate(AjaxRequestTarget target) { filterList(target); } }); form.add(teFilterDateFrom); form.add(new AjaxButton("buttonCancelDateFrom", form) { @Override protected void onSubmit(AjaxRequestTarget target, Form<?> form1) { dateFrom = null; target.addComponent(teFilterDateFrom); filterList(target); } }); form.add(new AjaxButton("buttonCancelDateUntil", form) { @Override protected void onSubmit(AjaxRequestTarget target, Form<?> form1) { dateUntil = null; target.addComponent(teFilterDateUntil); filterList(target); } }); teFilterDateUntil = new DateTextField("filterdateuntil", new PropertyModel<Date>(this, "dateUntil"), new StyleDateConverter("S-", true)); teFilterDateUntil.add(new DatePicker()); teFilterDateUntil.add(new AjaxFormComponentUpdatingBehavior("onchange") { @Override protected void onUpdate(AjaxRequestTarget target) { filterList(target); } }); form.add(teFilterDateUntil); teFilterCostCenter = new TextField<String>("filtercostcenter", new Model<String>("")) { }; teFilterCostCenter.add(StringValidator.maximumLength(IntegerConstants.FIFTY)); teFilterCostCenter.setType(String.class); teFilterCostCenter.add(new OnChangeAjaxBehavior() { @Override protected void onUpdate(AjaxRequestTarget target) { filterList(target); } }); form.add(teFilterCostCenter); }
From source file:au.org.theark.core.web.component.customfield.form.DetailForm.java
License:Open Source License
protected void attachValidators() { fieldNameTxtFld.setRequired(true).setLabel((new StringResourceModel("customField.name.required", this, new Model<String>("Custom Field Name")))); // Enforce particular characters for fieldName fieldNameTxtFld.add(new PatternValidator("[a-zA-Z0-9_-]+")); //Ark-1591 error fixing . fieldNameTxtFld/*from www. j av a2 s.c o m*/ .add(StringValidator.maximumLength(au.org.theark.core.Constants.GENERAL_FIELD_NAME_MAX_LENGTH_50)); fieldDescriptionTxtAreaFld.add(StringValidator .maximumLength(au.org.theark.core.Constants.GENERAL_FIELD_DESCRIPTIVE_MAX_LENGTH_255)); fieldTypeDdc.setRequired(true).setLabel( (new StringResourceModel("customField.fieldType.required", this, new Model<String>("Field Type")))); fieldLabelTxtAreaFld.add(StringValidator .maximumLength(au.org.theark.core.Constants.GENERAL_FIELD_DESCRIPTIVE_MAX_LENGTH_255)); fieldUnitTypeTxtFld .add(StringValidator.maximumLength(au.org.theark.core.Constants.GENERAL_FIELD_NAME_MAX_LENGTH_50)); //defaultValueTextArea.add(StringValidator.maximumLength(au.org.theark.core.Constants.GENERAL_FIELD_DESCRIPTIVE_MAX_LENGTH_255)); // TODO: Add correct validator, possibly custom with better validation message fieldEncodedValuesTxtFld.add(new PatternValidator(au.org.theark.core.Constants.ENCODED_VALUES_PATTERN)) .setLabel(new StringResourceModel("customField.encodedValues.validation", this, new Model<String>("Encoded Value definition"))); customFieldTypeDdc.setRequired(true) .setLabel((new StringResourceModel("customField.customtfieldType.required", this, new Model<String>("Custom Field Type")))); }
From source file:au.org.theark.core.web.component.customfieldcategory.form.DetailForm.java
License:Open Source License
protected void attachValidators() { categoryNameTxtFld.setRequired(true); categoryNameTxtFld.add(new PatternValidator("[a-zA-Z0-9_-]+")); categoryNameTxtFld//from ww w . j ava 2s. c om .add(StringValidator.maximumLength(au.org.theark.core.Constants.GENERAL_FIELD_NAME_MAX_LENGTH_50)); categoryDescriptionTxtAreaFld.add(StringValidator .maximumLength(au.org.theark.core.Constants.GENERAL_FIELD_DESCRIPTIVE_MAX_LENGTH_255)); customFieldTypeDdc.setRequired(true); categoryOrderNoTxtFld.setRequired(true); categoryOrderNoTxtFld.add(new RangeValidator<Long>( new Long(au.org.theark.core.Constants.GENERAL_FIELD_WHOLE_NUMBER_MIN_QUANTITY_1), new Long(au.org.theark.core.Constants.GENERAL_FIELD_WHOLE_NUMBER_MAX_QUANTITY_100))); }
From source file:au.org.theark.lims.web.component.inventory.form.BoxDetailForm.java
License:Open Source License
protected void attachValidators() { nameTxtFld.setRequired(true)/* w w w. j a v a 2 s .co m*/ .setLabel(new StringResourceModel("error.name.required", this, new Model<String>("Name"))); nameTxtFld .add(StringValidator.maximumLength(au.org.theark.core.Constants.GENERAL_FIELD_NAME_MAX_LENGTH_50)); invTrayDdc.setRequired(true) .setLabel(new StringResourceModel("error.rack.required", this, new Model<String>("Rack"))); noOfColTxtFld.setRequired(true); MinimumValidator<Integer> minValue = new MinimumValidator<Integer>(new Integer(0)); noOfColTxtFld.add(minValue); noOfRowTxtFld.setRequired(true); noOfRowTxtFld.add(minValue); colNoTypeDdc.setRequired(true); rowNoTypeDdc.setRequired(true); }
From source file:au.org.theark.lims.web.component.inventory.form.FreezerDetailForm.java
License:Open Source License
protected void attachValidators() { nameTxtFld.setRequired(true)// w w w .j a v a 2s.c o m .setLabel(new StringResourceModel("error.name.required", this, new Model<String>("Name"))); nameTxtFld .add(StringValidator.maximumLength(au.org.theark.core.Constants.GENERAL_FIELD_NAME_MAX_LENGTH_50)); invSiteDdc.setRequired(true) .setLabel(new StringResourceModel("error.site.required", this, new Model<String>("Site"))); capacityTxtFld.setRequired(true) .setLabel(new StringResourceModel("error.capacity.required", this, new Model<String>("Capacity"))); MinimumValidator<Integer> minValue = new MinimumValidator<Integer>(new Integer(0)); capacityTxtFld.add(minValue); descriptionTxtAreaFld.add(StringValidator .maximumLength(au.org.theark.core.Constants.GENERAL_FIELD_DESCRIPTIVE_MAX_LENGTH_255)); }
From source file:au.org.theark.lims.web.component.inventory.form.RackDetailForm.java
License:Open Source License
protected void attachValidators() { nameTxtFld.setRequired(true)//ww w .ja v a 2 s .c om .setLabel(new StringResourceModel("error.name.required", this, new Model<String>("Name"))); nameTxtFld .add(StringValidator.maximumLength(au.org.theark.core.Constants.GENERAL_FIELD_NAME_MAX_LENGTH_50)); invTankDdc.setRequired(true) .setLabel(new StringResourceModel("error.freezer.required", this, new Model<String>("Freezer"))); capacityTxtFld.setRequired(true) .setLabel(new StringResourceModel("error.capacity.required", this, new Model<String>("Capacity"))); MinimumValidator<Integer> minValue = new MinimumValidator<Integer>(new Integer(0)); capacityTxtFld.add(minValue); descriptionTxtAreaFld.add(StringValidator .maximumLength(au.org.theark.core.Constants.GENERAL_FIELD_DESCRIPTIVE_MAX_LENGTH_255)); }
From source file:au.org.theark.lims.web.component.inventory.form.SiteDetailForm.java
License:Open Source License
protected void attachValidators() { nameTxtFld.setRequired(true)/*from w ww.jav a 2 s .c om*/ .setLabel(new StringResourceModel("error.invSite.name.required", this, new Model<String>("Name"))); nameTxtFld .add(StringValidator.maximumLength(au.org.theark.core.Constants.GENERAL_FIELD_NAME_MAX_LENGTH_50)); contactTxtFld .add(StringValidator.maximumLength(au.org.theark.core.Constants.GENERAL_FIELD_NAME_MAX_LENGTH_50)); addressTxtAreaFld.add(StringValidator .maximumLength(au.org.theark.core.Constants.GENERAL_FIELD_DESCRIPTIVE_MAX_LENGTH_255)); phoneTxtFld .add(StringValidator.maximumLength(au.org.theark.core.Constants.GENERAL_FIELD_NAME_MAX_LENGTH_50)); }
From source file:au.org.theark.lims.web.component.subjectlims.lims.biocollection.form.BioCollectionModalDetailForm.java
License:Open Source License
protected void attachValidators() { idTxtFld.setRequired(true);//from w w w . j a v a 2s . c om biocollectionUidTxtFld.setRequired(true).setLabel(new StringResourceModel( "error.bioCollection.biocollectionUid.required", this, new Model<String>("BioCollectionUid"))); nameTxtFld .add(StringValidator.maximumLength(au.org.theark.core.Constants.GENERAL_FIELD_NAME_MAX_LENGTH_50)); }
From source file:au.org.theark.phenotypic.web.component.phenodatacategory.form.DetailForm.java
License:Open Source License
protected void attachValidators() { categoryNameTxtFld.setRequired(true); categoryNameTxtFld.add(new PatternValidator("[a-zA-Z0-9_-]+")); categoryNameTxtFld/*w ww .j a v a2 s .c o m*/ .add(StringValidator.maximumLength(au.org.theark.core.Constants.GENERAL_FIELD_NAME_MAX_LENGTH_50)); categoryDescriptionTxtAreaFld.add(StringValidator .maximumLength(au.org.theark.core.Constants.GENERAL_FIELD_DESCRIPTIVE_MAX_LENGTH_255)); }