You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by gb...@apache.org on 2010/06/28 20:17:10 UTC

svn commit: r958668 - in /pivot/trunk: demos/src/org/apache/pivot/demos/suggest/ tests/src/org/apache/pivot/tests/ tutorials/src/org/apache/pivot/tutorials/menus/ tutorials/src/org/apache/pivot/tutorials/stocktracker/ tutorials/src/org/apache/pivot/tut...

Author: gbrown
Date: Mon Jun 28 18:17:09 2010
New Revision: 958668

URL: http://svn.apache.org/viewvc?rev=958668&view=rev
Log:
Consolidate TextInputCharacterListener and TextInputTextListener.

Removed:
    pivot/trunk/wtk/src/org/apache/pivot/wtk/TextInputCharacterListener.java
Modified:
    pivot/trunk/demos/src/org/apache/pivot/demos/suggest/SuggestionDemo.java
    pivot/trunk/tests/src/org/apache/pivot/tests/SuggestionPopupTest.java
    pivot/trunk/tutorials/src/org/apache/pivot/tutorials/menus/MenuBars.java
    pivot/trunk/tutorials/src/org/apache/pivot/tutorials/stocktracker/StockTrackerWindow.java
    pivot/trunk/tutorials/src/org/apache/pivot/tutorials/text/SuggestionPopups.java
    pivot/trunk/tutorials/src/org/apache/pivot/tutorials/text/TextInputs.java
    pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraFileBrowserSheetSkin.java
    pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraFileBrowserSkin.java
    pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTextInputSkin.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/TextInput.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/TextInputTextListener.java

Modified: pivot/trunk/demos/src/org/apache/pivot/demos/suggest/SuggestionDemo.java
URL: http://svn.apache.org/viewvc/pivot/trunk/demos/src/org/apache/pivot/demos/suggest/SuggestionDemo.java?rev=958668&r1=958667&r2=958668&view=diff
==============================================================================
--- pivot/trunk/demos/src/org/apache/pivot/demos/suggest/SuggestionDemo.java (original)
+++ pivot/trunk/demos/src/org/apache/pivot/demos/suggest/SuggestionDemo.java Mon Jun 28 18:17:09 2010
@@ -37,7 +37,7 @@ import org.apache.pivot.wtk.SuggestionPo
 import org.apache.pivot.wtk.SuggestionPopupCloseListener;
 import org.apache.pivot.wtk.TaskAdapter;
 import org.apache.pivot.wtk.TextInput;
-import org.apache.pivot.wtk.TextInputCharacterListener;
+import org.apache.pivot.wtk.TextInputTextListener;
 import org.apache.pivot.wtk.Window;
 
 public class SuggestionDemo extends Window implements Bindable {
@@ -52,7 +52,7 @@ public class SuggestionDemo extends Wind
         textInput = (TextInput)context.get("textInput");
         activityIndicator = (ActivityIndicator)context.get("activityIndicator");
 
-        textInput.getTextInputCharacterListeners().add(new TextInputCharacterListener() {
+        textInput.getTextInputTextListeners().add(new TextInputTextListener.Adapter() {
             @Override
             public void charactersInserted(TextInput textInput, int index, int count) {
                 getSuggestions();

Modified: pivot/trunk/tests/src/org/apache/pivot/tests/SuggestionPopupTest.java
URL: http://svn.apache.org/viewvc/pivot/trunk/tests/src/org/apache/pivot/tests/SuggestionPopupTest.java?rev=958668&r1=958667&r2=958668&view=diff
==============================================================================
--- pivot/trunk/tests/src/org/apache/pivot/tests/SuggestionPopupTest.java (original)
+++ pivot/trunk/tests/src/org/apache/pivot/tests/SuggestionPopupTest.java Mon Jun 28 18:17:09 2010
@@ -27,7 +27,7 @@ import org.apache.pivot.wtk.Label;
 import org.apache.pivot.wtk.SuggestionPopup;
 import org.apache.pivot.wtk.SuggestionPopupCloseListener;
 import org.apache.pivot.wtk.TextInput;
-import org.apache.pivot.wtk.TextInputCharacterListener;
+import org.apache.pivot.wtk.TextInputTextListener;
 import org.apache.pivot.wtk.Window;
 
 public class SuggestionPopupTest implements Application {
@@ -44,7 +44,7 @@ public class SuggestionPopupTest impleme
         window = (Window)beanSerializer.readObject(this, "suggestion_popup_test.bxml");
         beanSerializer.bind(this);
 
-        textInput.getTextInputCharacterListeners().add(new TextInputCharacterListener() {
+        textInput.getTextInputTextListeners().add(new TextInputTextListener.Adapter() {
             @Override
             public void charactersInserted(TextInput textInput, int index, int count) {
                 ArrayList<String> suggestions = new ArrayList<String>("One", "Two", "Three", "Four", "Five");

Modified: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/menus/MenuBars.java
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/menus/MenuBars.java?rev=958668&r1=958667&r2=958668&view=diff
==============================================================================
--- pivot/trunk/tutorials/src/org/apache/pivot/tutorials/menus/MenuBars.java (original)
+++ pivot/trunk/tutorials/src/org/apache/pivot/tutorials/menus/MenuBars.java Mon Jun 28 18:17:09 2010
@@ -41,9 +41,9 @@ public class MenuBars extends Frame impl
     @BXML private TabPane tabPane = null;
 
     private MenuHandler menuHandler = new MenuHandler.Adapter() {
-        TextInputTextListener textInputTextListener = new TextInputTextListener() {
+        TextInputTextListener textInputTextListener = new TextInputTextListener.Adapter() {
             @Override
-            public void textChanged(TextInput textInput) {
+            public void textChanged(TextInput textInput, String previousText) {
                 updateActionState(textInput);
             }
         };

Modified: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/stocktracker/StockTrackerWindow.java
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/stocktracker/StockTrackerWindow.java?rev=958668&r1=958667&r2=958668&view=diff
==============================================================================
--- pivot/trunk/tutorials/src/org/apache/pivot/tutorials/stocktracker/StockTrackerWindow.java (original)
+++ pivot/trunk/tutorials/src/org/apache/pivot/tutorials/stocktracker/StockTrackerWindow.java Mon Jun 28 18:17:09 2010
@@ -209,9 +209,9 @@ public class StockTrackerWindow extends 
         });
 
         // Add symbol text input event handlers
-        symbolTextInput.getTextInputTextListeners().add(new TextInputTextListener() {
+        symbolTextInput.getTextInputTextListeners().add(new TextInputTextListener.Adapter() {
             @Override
-            public void textChanged(TextInput textInput) {
+            public void textChanged(TextInput textInput, String previousText) {
                 addSymbolAction.setEnabled(textInput.getTextLength() > 0);
             }
         });

Modified: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/text/SuggestionPopups.java
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/text/SuggestionPopups.java?rev=958668&r1=958667&r2=958668&view=diff
==============================================================================
--- pivot/trunk/tutorials/src/org/apache/pivot/tutorials/text/SuggestionPopups.java (original)
+++ pivot/trunk/tutorials/src/org/apache/pivot/tutorials/text/SuggestionPopups.java Mon Jun 28 18:17:09 2010
@@ -23,7 +23,7 @@ import org.apache.pivot.util.Resources;
 import org.apache.pivot.wtk.Display;
 import org.apache.pivot.wtk.SuggestionPopup;
 import org.apache.pivot.wtk.TextInput;
-import org.apache.pivot.wtk.TextInputCharacterListener;
+import org.apache.pivot.wtk.TextInputTextListener;
 import org.apache.pivot.wtk.Window;
 
 public class SuggestionPopups extends Window implements Bindable {
@@ -32,31 +32,6 @@ public class SuggestionPopups extends Wi
     private ArrayList<String> states;
     private SuggestionPopup suggestionPopup = new SuggestionPopup();
 
-    private TextInputCharacterListener textInputCharacterListener =
-        new TextInputCharacterListener() {
-        @Override
-        public void charactersInserted(TextInput textInput, int index, int count) {
-            String text = textInput.getText();
-            ArrayList<String> suggestions = new ArrayList<String>();
-
-            for (String state : states) {
-                if (state.toUpperCase().startsWith(text.toUpperCase())) {
-                    suggestions.add(state);
-                }
-            }
-
-            if (suggestions.getLength() > 0) {
-                suggestionPopup.setSuggestions(suggestions);
-                suggestionPopup.open(textInput);
-            }
-        }
-
-        @Override
-        public void charactersRemoved(TextInput textInput, int index, int count) {
-            suggestionPopup.close();
-        }
-    };
-
     public SuggestionPopups() {
         // Populate the lookup values, ensuring that they are sorted
         states = new ArrayList<String>();
@@ -118,7 +93,29 @@ public class SuggestionPopups extends Wi
     @Override
     public void initialize(Dictionary<String, Object> context, Resources resources) {
         stateTextInput = (TextInput)context.get("stateTextInput");
-        stateTextInput.getTextInputCharacterListeners().add(textInputCharacterListener);
+        stateTextInput.getTextInputTextListeners().add(new TextInputTextListener.Adapter() {
+            @Override
+            public void charactersInserted(TextInput textInput, int index, int count) {
+                String text = textInput.getText();
+                ArrayList<String> suggestions = new ArrayList<String>();
+
+                for (String state : states) {
+                    if (state.toUpperCase().startsWith(text.toUpperCase())) {
+                        suggestions.add(state);
+                    }
+                }
+
+                if (suggestions.getLength() > 0) {
+                    suggestionPopup.setSuggestions(suggestions);
+                    suggestionPopup.open(textInput);
+                }
+            }
+
+            @Override
+            public void charactersRemoved(TextInput textInput, int index, int count) {
+                suggestionPopup.close();
+            }
+        });
     }
 
     @Override

Modified: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/text/TextInputs.java
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/text/TextInputs.java?rev=958668&r1=958667&r2=958668&view=diff
==============================================================================
--- pivot/trunk/tutorials/src/org/apache/pivot/tutorials/text/TextInputs.java (original)
+++ pivot/trunk/tutorials/src/org/apache/pivot/tutorials/text/TextInputs.java Mon Jun 28 18:17:09 2010
@@ -22,7 +22,7 @@ import org.apache.pivot.collections.Dict
 import org.apache.pivot.util.Resources;
 import org.apache.pivot.wtk.Display;
 import org.apache.pivot.wtk.TextInput;
-import org.apache.pivot.wtk.TextInputCharacterListener;
+import org.apache.pivot.wtk.TextInputTextListener;
 import org.apache.pivot.wtk.Window;
 
 public class TextInputs extends Window implements Bindable {
@@ -30,41 +30,6 @@ public class TextInputs extends Window i
 
     private ArrayList<String> states;
 
-    private TextInputCharacterListener textInputCharacterListener =
-        new TextInputCharacterListener.Adapter() {
-        @Override
-        public void charactersInserted(final TextInput textInput, int index, int count) {
-            String text = textInput.getText();
-
-            int i = ArrayList.binarySearch(states, text,
-                states.getComparator());
-
-            if (i < 0) {
-                i = -(i + 1);
-                int n = states.getLength();
-
-                if (i < n) {
-                    text = text.toLowerCase();
-                    final String state = states.get(i);
-
-                    if (state.toLowerCase().startsWith(text)) {
-                        String nextState = (i == n - 1) ?
-                            null : states.get(i + 1);
-
-                        if (nextState == null
-                            || !nextState.toLowerCase().startsWith(text)) {
-                            textInput.setText(state);
-
-                            int selectionStart = text.length();
-                            int selectionLength = state.length() - selectionStart;
-                            textInput.setSelection(selectionStart, selectionLength);
-                        }
-                    }
-                }
-            }
-        }
-    };
-
     public TextInputs() {
         // Populate the lookup values, ensuring that they are sorted
         states = new ArrayList<String>();
@@ -126,7 +91,39 @@ public class TextInputs extends Window i
     @Override
     public void initialize(Dictionary<String, Object> context, Resources resources) {
         stateTextInput = (TextInput)context.get("stateTextInput");
-        stateTextInput.getTextInputCharacterListeners().add(textInputCharacterListener);
+        stateTextInput.getTextInputTextListeners().add(new TextInputTextListener.Adapter() {
+            @Override
+            public void charactersInserted(final TextInput textInput, int index, int count) {
+                String text = textInput.getText();
+
+                int i = ArrayList.binarySearch(states, text,
+                    states.getComparator());
+
+                if (i < 0) {
+                    i = -(i + 1);
+                    int n = states.getLength();
+
+                    if (i < n) {
+                        text = text.toLowerCase();
+                        final String state = states.get(i);
+
+                        if (state.toLowerCase().startsWith(text)) {
+                            String nextState = (i == n - 1) ?
+                                null : states.get(i + 1);
+
+                            if (nextState == null
+                                || !nextState.toLowerCase().startsWith(text)) {
+                                textInput.setText(state);
+
+                                int selectionStart = text.length();
+                                int selectionLength = state.length() - selectionStart;
+                                textInput.setSelection(selectionStart, selectionLength);
+                            }
+                        }
+                    }
+                }
+            }
+        });
     }
 
     @Override

Modified: pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraFileBrowserSheetSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraFileBrowserSheetSkin.java?rev=958668&r1=958667&r2=958668&view=diff
==============================================================================
--- pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraFileBrowserSheetSkin.java (original)
+++ pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraFileBrowserSheetSkin.java Mon Jun 28 18:17:09 2010
@@ -109,9 +109,9 @@ public class TerraFileBrowserSheetSkin e
 
         beanSerializer.bind(this, TerraFileBrowserSheetSkin.class);
 
-        saveAsTextInput.getTextInputTextListeners().add(new TextInputTextListener() {
+        saveAsTextInput.getTextInputTextListeners().add(new TextInputTextListener.Adapter() {
             @Override
-            public void textChanged(TextInput textInput) {
+            public void textChanged(TextInput textInput, String previousText) {
                 updateOKButtonState();
             }
         });

Modified: pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraFileBrowserSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraFileBrowserSkin.java?rev=958668&r1=958667&r2=958668&view=diff
==============================================================================
--- pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraFileBrowserSkin.java (original)
+++ pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraFileBrowserSkin.java Mon Jun 28 18:17:09 2010
@@ -658,9 +658,9 @@ public class TerraFileBrowserSkin extend
             }
         });
 
-        searchTextInput.getTextInputTextListeners().add(new TextInputTextListener() {
+        searchTextInput.getTextInputTextListeners().add(new TextInputTextListener.Adapter() {
             @Override
-            public void textChanged(TextInput textInput) {
+            public void textChanged(TextInput textInput, String previousText) {
                 String text = textInput.getText().trim();
                 if (text.length() == 0) {
                     text = null;

Modified: pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTextInputSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTextInputSkin.java?rev=958668&r1=958667&r2=958668&view=diff
==============================================================================
--- pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTextInputSkin.java (original)
+++ pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTextInputSkin.java Mon Jun 28 18:17:09 2010
@@ -46,9 +46,9 @@ import org.apache.pivot.wtk.Mouse;
 import org.apache.pivot.wtk.Orientation;
 import org.apache.pivot.wtk.Platform;
 import org.apache.pivot.wtk.TextInput;
-import org.apache.pivot.wtk.TextInputCharacterListener;
 import org.apache.pivot.wtk.TextInputListener;
 import org.apache.pivot.wtk.TextInputSelectionListener;
+import org.apache.pivot.wtk.TextInputTextListener;
 import org.apache.pivot.wtk.Theme;
 import org.apache.pivot.wtk.Window;
 import org.apache.pivot.wtk.skin.ComponentSkin;
@@ -59,7 +59,7 @@ import org.apache.pivot.wtk.validation.V
  * Text input skin.
  */
 public class TerraTextInputSkin extends ComponentSkin implements TextInput.Skin,
-    TextInputListener, TextInputCharacterListener, TextInputSelectionListener {
+    TextInputListener, TextInputTextListener, TextInputSelectionListener {
     private class BlinkCaretCallback implements Runnable {
         @Override
         public void run() {
@@ -184,7 +184,7 @@ public class TerraTextInputSkin extends 
 
         TextInput textInput = (TextInput)component;
         textInput.getTextInputListeners().add(this);
-        textInput.getTextInputCharacterListeners().add(this);
+        textInput.getTextInputTextListeners().add(this);
         textInput.getTextInputSelectionListeners().add(this);
 
         textInput.setCursor(Cursor.TEXT);
@@ -1358,12 +1358,16 @@ public class TerraTextInputSkin extends 
     // Text input character events
     @Override
     public void charactersInserted(TextInput textInput, int index, int count) {
-        layout();
-        repaintComponent();
+        // No-op
     }
 
     @Override
     public void charactersRemoved(TextInput textInput, int index, int count) {
+        // No-op
+    }
+
+    @Override
+    public void textChanged(TextInput textInput, String previousText) {
         layout();
         repaintComponent();
     }

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/TextInput.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/TextInput.java?rev=958668&r1=958667&r2=958668&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/TextInput.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/TextInput.java Mon Jun 28 18:17:09 2010
@@ -139,26 +139,23 @@ public class TextInput extends Component
     private static class TextInputTextListenerList extends ListenerList<TextInputTextListener>
         implements TextInputTextListener {
         @Override
-        public void textChanged(TextInput textInput) {
+        public void charactersInserted(TextInput textInput, int index, int count) {
             for (TextInputTextListener listener : this) {
-                listener.textChanged(textInput);
+                listener.charactersInserted(textInput, index, count);
             }
         }
-    }
 
-    private static class TextInputCharacterListenerList extends ListenerList<TextInputCharacterListener>
-        implements TextInputCharacterListener {
         @Override
-        public void charactersInserted(TextInput textInput, int index, int count) {
-            for (TextInputCharacterListener listener : this) {
-                listener.charactersInserted(textInput, index, count);
+        public void charactersRemoved(TextInput textInput, int index, int count) {
+            for (TextInputTextListener listener : this) {
+                listener.charactersRemoved(textInput, index, count);
             }
         }
 
         @Override
-        public void charactersRemoved(TextInput textInput, int index, int count) {
-            for (TextInputCharacterListener listener : this) {
-                listener.charactersRemoved(textInput, index, count);
+        public void textChanged(TextInput textInput, String previousText) {
+            for (TextInputTextListener listener : this) {
+                listener.textChanged(textInput, previousText);
             }
         }
     }
@@ -223,6 +220,7 @@ public class TextInput extends Component
     private NodeListener textNodeListener = new NodeListener.Adapter() {
         @Override
         public void rangeInserted(Node node, int offset, int characterCount) {
+            // TODO If selected range changes, also fire selection change event?
             if (selectionStart + selectionLength > offset) {
                 if (selectionStart > offset) {
                     selectionStart += characterCount;
@@ -231,13 +229,14 @@ public class TextInput extends Component
                 }
             }
 
-            textInputCharacterListeners.charactersInserted(TextInput.this, offset, characterCount);
-            textInputTextListeners.textChanged(TextInput.this);
+            textInputTextListeners.charactersInserted(TextInput.this, offset, characterCount);
+            textInputTextListeners.textChanged(TextInput.this, null);
             validateText();
         }
 
         @Override
         public void rangeRemoved(Node node, int offset, int characterCount) {
+            // TODO If selected range changes, also fire selection change event?
             if (selectionStart + selectionLength > offset) {
                 if (selectionStart > offset) {
                     selectionStart -= characterCount;
@@ -246,15 +245,14 @@ public class TextInput extends Component
                 }
             }
 
-            textInputCharacterListeners.charactersRemoved(TextInput.this, offset, characterCount);
-            textInputTextListeners.textChanged(TextInput.this);
+            textInputTextListeners.charactersRemoved(TextInput.this, offset, characterCount);
+            textInputTextListeners.textChanged(TextInput.this, null);
             validateText();
         }
     };
 
     private TextInputListenerList textInputListeners = new TextInputListenerList();
     private TextInputTextListenerList textInputTextListeners = new TextInputTextListenerList();
-    private TextInputCharacterListenerList textInputCharacterListeners = new TextInputCharacterListenerList();
     private TextInputSelectionListenerList textInputSelectionListeners = new TextInputSelectionListenerList();
     private TextInputBindingListenerList textInputBindingListeners = new TextInputBindingListenerList();
 
@@ -312,7 +310,10 @@ public class TextInput extends Component
             selectionLength = 0;
 
             textInputListeners.textNodeChanged(this, previousTextNode);
-            textInputTextListeners.textChanged(this);
+            textInputTextListeners.textChanged(this,
+                (previousTextNode == null) ? null : previousTextNode.getText());
+
+            // TODO If selected range changes, also fire selection change event
 
             validateText();
         }
@@ -365,10 +366,12 @@ public class TextInput extends Component
         int length = textNode.getCharacterCount();
         textNode.insertText(text, selectionStart);
 
-        // Update the selection only if a listener did not modify the text
+        // TODO Update the selection only if a listener did not modify the text?
         if (length + text.length() == textNode.getCharacterCount()) {
             setSelection(selectionStart + text.length(), 0);
         }
+
+        // TODO Move the text node event logic here
     }
 
     /**
@@ -390,6 +393,8 @@ public class TextInput extends Component
             // TODO Make this part of the undoable action (for all such
             // actions)
             textNode.removeRange(selectionStart, selectionLength);
+
+            // TODO Move the text node event logic here
         } else {
             int offset = selectionStart;
 
@@ -900,13 +905,6 @@ public class TextInput extends Component
     }
 
     /**
-     * Returns the text input character listener list.
-     */
-    public ListenerList<TextInputCharacterListener> getTextInputCharacterListeners() {
-        return textInputCharacterListeners;
-    }
-
-    /**
      * Returns the text input selection listener list.
      */
     public ListenerList<TextInputSelectionListener> getTextInputSelectionListeners() {

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/TextInputTextListener.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/TextInputTextListener.java?rev=958668&r1=958667&r2=958668&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/TextInputTextListener.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/TextInputTextListener.java Mon Jun 28 18:17:09 2010
@@ -21,9 +21,44 @@ package org.apache.pivot.wtk;
  */
 public interface TextInputTextListener {
     /**
+     * Text input character listener adapter.
+     */
+    public static class Adapter implements TextInputTextListener {
+        @Override
+        public void charactersInserted(TextInput textInput, int index, int count) {
+        }
+
+        @Override
+        public void charactersRemoved(TextInput textInput, int index, int count) {
+        }
+
+        @Override
+        public void textChanged(TextInput textInput, String previousText) {
+        }
+    }
+
+    /**
+     * Called when characters have been inserted into a text input.
+     *
+     * @param textInput
+     * @param index
+     * @param count
+     */
+    public void charactersInserted(TextInput textInput, int index, int count);
+
+    /**
+     * Called when characters have been removed from a text input.
+     *
+     * @param textInput
+     * @param index
+     * @param count
+     */
+    public void charactersRemoved(TextInput textInput, int index, int count);
+
+    /**
      * Called when a text input's text has changed.
      *
      * @param textInput
      */
-    public void textChanged(TextInput textInput);
+    public void textChanged(TextInput textInput, String previousText);
 }