001    /*
002     * This file is part of the Echo Point Project.  This project is a
003     * collection of Components that have extended the Echo Web Application
004     * Framework Version 3.
005     *
006     * Version: MPL 1.1
007     *
008     * The contents of this file are subject to the Mozilla Public License Version
009     * 1.1 (the "License"); you may not use this file except in compliance with
010     * the License. You may obtain a copy of the License at
011     * http://www.mozilla.org/MPL/
012     *
013     * Software distributed under the License is distributed on an "AS IS" basis,
014     * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
015     * for the specific language governing rights and limitations under the
016     * License.
017     */
018    
019    package echopoint;
020    
021    /**
022     * A simple regex text field that limits input to integer values only.  Note
023     * that no bounds checking is performed on the input value.
024     * 
025     * @author perxi 2009-12-03
026     * @version $Id: IntegerTextField.java 258 2009-12-07 16:18:24Z sptrakesh $
027     */
028    public class IntegerTextField extends RegexTextField
029    {
030      private static final long serialVersionUID = 1L;
031    
032      /**
033       * The standard integer regular expression to use.  Note that this cannot
034       * be modified.
035       *
036       * {@value}
037       */
038      public static final String EXP = "^[0-9]*$";
039    
040      public IntegerTextField() { super.setRegex(EXP); }
041    
042      /**
043        * Over-ridden to do nothing.  This component does not allow custom
044        * regular expressions.
045        *
046        * @param regex The regular expression to use.
047        */
048      @Override
049      public void setRegex( final String regex )
050      {
051        // No-op
052      }
053    }