javauis/lcdui_qt/src/javax/microedition/lcdui/TextEditorChangeListener.java
changeset 21 2a9601315dfc
child 23 98ccebc37403
equal deleted inserted replaced
18:e8e63152f320 21:2a9601315dfc
       
     1 /*
       
     2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 package javax.microedition.lcdui;
       
    20 
       
    21 /**
       
    22  * A listener for receiving notification of content changes that have been
       
    23  * invoked on <code>TextEditor</code> objects. When a content change happens,
       
    24  * the application is notified by calling the relevant methods on the
       
    25  * <code>TextEditorChangeListener</code> that had been set on the
       
    26  * <code>TextEditor</code> with a call to
       
    27  * {@link TextEditor#setTextEditorChangeListener setTextEditorChangeListener()}.
       
    28  */
       
    29 
       
    30 public interface TextEditorChangeListener {
       
    31 
       
    32     /**
       
    33      * Constant indicating the caret movement direction up.
       
    34      */
       
    35     public static final int CARET_UP = 1;
       
    36 
       
    37     /**
       
    38      * Constant indicating the caret movement direction up.
       
    39      */
       
    40     public static final int CARET_RIGHT = 2;
       
    41 
       
    42     /**
       
    43      * Constant indicating the caret movement direction up.
       
    44      */
       
    45     public static final int CARET_DOWN = 3;
       
    46 
       
    47     /**
       
    48      * Constant indicating the caret movement direction up.
       
    49      */
       
    50     public static final int CARET_LEFT = 4;
       
    51 
       
    52     /**
       
    53      * Called by the implementation to indicate that a range of the content in
       
    54      * the TextEditor has been changed either by user, prgrammatically or via
       
    55      * external front end processors for advanced input methods. The parameters
       
    56      * indicate the range of the new modified text. The length parameter is
       
    57      * always > 0.
       
    58      * 
       
    59      * @param index the index of the first character that is selected.
       
    60      * @param length the length of selection as number of characters.
       
    61      */
       
    62     public void textChanged(int index, int length);
       
    63 
       
    64     /**
       
    65      * Called by the implementation to indicate that the caret has been moved.
       
    66      * The parameters indicate the new caret index and the movement direction in
       
    67      * relation the previous caret position.
       
    68      * 
       
    69      * @param newIndex the character index before which the caret is placed
       
    70      *            after the movement
       
    71      * @param movementDirection the caret movement direction; must be one of
       
    72      *            CARET_UP, CARET_RIGHT, CARET_DOWN, or CARET_LEFT
       
    73      */
       
    74     public void caretMoved(int newIndex, int movementDirection);
       
    75 
       
    76     /**
       
    77      * Called by the implementation to indicate that a range of the content in
       
    78      * the TextEditor has been selected. The selection have been set with
       
    79      * programmatically or by user interaction. The parameters indicate the
       
    80      * range of the current selection.
       
    81      * 
       
    82      * @param index the index of the first character that is selected.
       
    83      * @param length the length of selection as number of characters.
       
    84      */
       
    85     public void contentSelected(int index, int length);
       
    86 
       
    87 }