/*
 * See the NOTICE file distributed with this work for additional
 * information regarding copyright ownership.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 */
package org.xwiki.gwt.user.client;

import com.google.gwt.event.dom.client.KeyCodes;
import com.google.gwt.event.dom.client.KeyPressEvent;
import com.google.gwt.event.dom.client.KeyPressHandler;
import com.google.gwt.user.client.ui.TextBox;

/**
 * @version $Id$
 */
public class TextBoxNumberFilter implements KeyPressHandler
{
    /**
     * List of forbidden keys in the TextBox.
     */
    private static final char[] AUTHORIZED_KEYS = {
        KeyCodes.KEY_BACKSPACE, KeyCodes.KEY_DELETE, KeyCodes.KEY_HOME, KeyCodes.KEY_END, KeyCodes.KEY_LEFT,
        KeyCodes.KEY_UP, KeyCodes.KEY_RIGHT, KeyCodes.KEY_DOWN, KeyCodes.KEY_TAB, KeyCodes.KEY_ENTER,
        KeyCodes.KEY_ESCAPE
    };

    /**
     * Determine if a char must be filtered.
     * 
     * @param keyCode char to inspect.
     * @return true if the char needs to be filtered.
     */
    private boolean isFilteredKey(int keyCode)
    {
        if (Character.isDigit((char) keyCode)) {
            return false;
        }
        for (char c : AUTHORIZED_KEYS) {
            if (keyCode == c) {
                return false;
            }
        }
        return true;
    }

    /**
     * {@inheritDoc}
     * 
     * @see KeyPressHandler#onKeyPress(KeyPressEvent)
     */
    public void onKeyPress(KeyPressEvent event)
    {
        if (isFilteredKey(event.getNativeEvent().getKeyCode())) {
            // Suppress the current keyboard event.
            ((TextBox) event.getSource()).cancelKey();
        }
    }
}

@@ -923,16 +923,65 @@
 lient;%0A%0A
+import java.util.Arrays;%0Aimport java.util.List;%0A%0A
 import c
@@ -1284,45 +1284,69 @@
   * 
-List of forbidden
+Opera handles these keys as character
  keys
+,
  i
-n the TextBox
+.e. charCode %3E 0
 .%0A  
@@ -1380,735 +1380,98 @@
 nal 
-char%5B%5D AUTHORIZED_KEYS = %7B%0A        KeyCodes.KEY_BACKSPACE, KeyCodes.KEY_DELETE, KeyCodes.KEY_HOME, KeyCodes.KEY_END, KeyCodes.KEY_LEFT,%0A        KeyCodes.KEY_UP, KeyCodes.KEY_RIGHT, KeyCodes.KEY_DOWN, KeyCodes.KEY_TAB, KeyCodes.KEY_ENTER,%0A        KeyCodes.KEY_ESCAPE%0A    %7D;%0A%0A    /**%0A     * Determine if a char must be filtered.%0A     * %0A     * @param keyCode char to inspect.%0A     * @return true if the char needs to be filtered.%0A     */%0A    private boolean isFilteredKey(int keyCode)%0A    %7B%0A        if (Character.isDigit((char) keyCode)) %7B%0A            return false;%0A        %7D%0A        for (char c : AUTHORIZED_KEYS) %7B%0A            if (keyCode == c) %7B%0A                return false;%0A            %7D%0A        %7D%0A        return true;%0A    %7D
+List%3CInteger%3E SPECIAL_KEY_CODES = Arrays.asList(KeyCodes.KEY_BACKSPACE, KeyCodes.KEY_TAB);
 %0A%0A  
@@ -1634,25 +1634,21 @@
    i
-f (isFilteredKey(
+nt keyCode = 
 even
@@ -1678,16 +1678,174 @@
 eyCode()
+;%0A        int codePoint = event.getUnicodeCharCode();%0A        if (codePoint %3E 0 && !Character.isDigit((char) codePoint) && !SPECIAL_KEY_CODES.contains(keyCode
 )) %7B%0A   

Upgrade to GWT 2.1.1 and GWT Maven Plugin 2.1.0-1 * TextBoxNumberFilter started to filter all the characters (including digits) in Firefox after the upgrade.