org.netbeans.modules.editor.lib2/1 1.43.1 10

org.netbeans.spi.editor.typinghooks
Class TypedTextInterceptor.Context

java.lang.Object
  extended by org.netbeans.spi.editor.typinghooks.TypedTextInterceptor.Context
Direct Known Subclasses:
TypedTextInterceptor.MutableContext
Enclosing interface:
TypedTextInterceptor

public static class TypedTextInterceptor.Context
extends Object

The context class providing information about the edited document, its editor pane, insertion offset and text.


Method Summary
 JTextComponent getComponent()
          Gets the editor component where the currently processed key typed event occurred.
 Document getDocument()
          Gets the edited document.
 int getOffset()
          Gets the insertion offset.
 String getText()
          Gets the insertion text.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getComponent

public JTextComponent getComponent()
Gets the editor component where the currently processed key typed event occurred.

Returns:
The editor pane that contains the edited Document.

getDocument

public Document getDocument()
Gets the edited document. It's the document that will receive the insertion text (ie the text typed by a user or its modification provided by an interceptor).

Returns:
The edited document.

getOffset

public int getOffset()
Gets the insertion offset. This is the offset in the document where user typed the text (ie. where the currently processed KeyEvent happened). This is also the offset where the insertion text will end up.

Returns:
The offset in the edited document.

getText

public String getText()
Gets the insertion text. This is the text that was typed by the user or its modification provided by one of the interceptors.

It is guaranteed that the text will have length equal to 1 for contexts that are passed to beforeInsert and insert methods. In these methods getText returns exactly what a user typed in the editor.

In the afterInsert method the text returned from getText method can have any length and will correspond to either the originally typed text or to text supplied by one of the interceptors participating in the key typed event processing.

Returns:
The insertion text.

org.netbeans.modules.editor.lib2/1 1.43.1 10

Built on December 5 2011.  |  Portions Copyright 1997-2011 Sun Microsystems, Inc. All rights reserved.