All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.tapestry.contrib.valid.NumericField Maven / Gradle / Ivy

There is a newer version: 4.1.6
Show newest version
// Copyright 2004, 2005 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package org.apache.tapestry.contrib.valid;

import org.apache.tapestry.valid.IValidator;
import org.apache.tapestry.valid.NumberValidator;
import org.apache.tapestry.valid.ValidField;

/**
 * Backwards compatible version of the 1.0.7 NumericField component. 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
ParameterTypeRead / WriteRequiredDefaultDescription
value{@link Number}R / Wyes The value to be updated. *

* When the form is submitted, this parameter is only updated if the value is * valid. *

* When rendering, a null value will render as the empty string. A value of zero * will render normally. *

* When the form is submitted, the type of the binding is used to determine what * kind of object to convert the string to.

minimum{@link Number}Rno The minimum value accepted for the field.
maximum{@link Number}Rno The maximum value accepted for the field.
requiredbooleanRnofalseIf true, then a non-null value must be provided. If the field is not * required, and a null (all whitespace) value is supplied in the field, then * the value parameter is not updated.
displayNameStringRyes A textual name for the field that is used when formulating error * messages.
typeStringRyes The class name used to convert the value entered. See * {@link NumberValidator#setValueType(String)}
*

* May not contain a body. May have informal parameters. * * @author Howard Lewis Ship * @since 1.0.8 * @see ValidField */ public abstract class NumericField extends ValidField { public abstract Number getMinimum(); public abstract Number getMaximum(); public abstract boolean isRequired(); public abstract String getType(); /** * Overrides {@link ValidField#getValidator()}to construct a validator on * the fly. */ public IValidator getValidator() { NumberValidator validator = new NumberValidator(); if (isParameterBound("minimum")) validator.setMinimum(getMinimum()); if (isParameterBound("maximum")) validator.setMaximum(getMaximum()); if (isParameterBound("required")) validator.setRequired(isRequired()); if (isParameterBound("type")) validator.setValueType(getType()); return validator; } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy