Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1.4.0)

E13403-05

oracle.javatools.buffer
Interface TextBufferListener

All Superinterfaces:
java.util.EventListener
All Known Implementing Classes:
BasicCaret, BasicDocument, CodeEditorGutter, DragDropPlugin.DragCaret, ForwardingTextBufferListener, LineGutterPlugin, NodeResourceBundle, NodeUpdater, SourceElementHandle, TextBufferTracker

public interface TextBufferListener
extends java.util.EventListener

The TextBufferListener interface should be implemented by observers interested in receiving notifications of changes to the associated TextBuffer. These change notifications provide information about each insert or removal of text into the TextBuffer regardless of the source, or the change of one of the buffer attributes, such as the read-only mode, or EOL type.

Notifications are provided via the mutating thread causing the change to the TextBuffer - this guarantees listeners that they will have read access for the duration of the notification.

As with notifications in the swing text package, there is no guarantee about the order of delivery of notifications to listeners, and all listeners must be notified before any further changes to the TextBuffer. This means it is illegal for listeners to issue a change to the TextBuffer during the notification.

Note, instead of defining a TextBufferEvent, the details about the change are passed as parameters to the listener to avoid an explicit object creation.

There are two pseudo-attributes used to notify clients that the entire contents of the TextBuffer is being reloaded from a Reader instance. The RELOAD_START_ATTRIBUTE is sent as a pre-notification before the reload occurs. The RELOAD_END_ATTRIBUTE is sent as a post-notification after the reload has finished. This allows editor implementations to distinguish regular text buffer edits from text buffer reloads. The TextBuffer implementations are required to guarantee that these two psuedo-attributes will be fired as a pair (i.e., will not be missing the END attribute).


Field Summary
static int EOL_TYPE_ATTRIBUTE
          Public constant for the attribute for EOL type.
static int MODIFIED_ATTRIBUTE
          Public constant for the attribute for the modified state.
static int READ_ONLY_ATTRIBUTE
          Public constant for the attribute for read-only mode.
static int RELOAD_END_ATTRIBUTE
          Public (pseudo-attribute) constant used as a post-notification to clients that the TextBuffer.read( Reader ) has been completed, and that the contents of the buffer have already been replaced.
static int RELOAD_START_ATTRIBUTE
          Public (pseudo-attribute) constant used as a pre-notification to clients that the TextBuffer.read( Reader ) has been invoked, and that the contents of the buffer are about to be reloaded.
 
Method Summary
 void attributeUpdate(TextBuffer buffer, int attribute)
          Provides notification regarding a change to one of the buffer attributes.
 void insertUpdate(TextBuffer buffer, int offset, int count, char[] insertedData)
          Provides notification about an insertion into the TextBuffer.
 void removeUpdate(TextBuffer buffer, int offset, int count, char[] removedData)
          Provides notification about a removal from the TextBuffer.
 

Field Detail

EOL_TYPE_ATTRIBUTE

static final int EOL_TYPE_ATTRIBUTE
Public constant for the attribute for EOL type. This is used by attributeUpdate() to report a change to the EOL type.

See Also:
Constant Field Values

READ_ONLY_ATTRIBUTE

static final int READ_ONLY_ATTRIBUTE
Public constant for the attribute for read-only mode. This is used by attributeUpdate() to report a change to the read-only mode.

See Also:
Constant Field Values

RELOAD_START_ATTRIBUTE

static final int RELOAD_START_ATTRIBUTE
Public (pseudo-attribute) constant used as a pre-notification to clients that the TextBuffer.read( Reader ) has been invoked, and that the contents of the buffer are about to be reloaded.

See Also:
Constant Field Values

RELOAD_END_ATTRIBUTE

static final int RELOAD_END_ATTRIBUTE
Public (pseudo-attribute) constant used as a post-notification to clients that the TextBuffer.read( Reader ) has been completed, and that the contents of the buffer have already been replaced.

See Also:
Constant Field Values

MODIFIED_ATTRIBUTE

static final int MODIFIED_ATTRIBUTE
Public constant for the attribute for the modified state. This is used by attributeUpdate() to report a change in the modified state of the buffer.

See Also:
Constant Field Values
Method Detail

insertUpdate

void insertUpdate(TextBuffer buffer,
                  int offset,
                  int count,
                  char[] insertedData)
Provides notification about an insertion into the TextBuffer.

Parameters:
buffer - the TextBuffer that changed.
offset - the offset where the insert took place
count - the number of characters inserted (insertedData.length)
insertedData - an array of the removed characters.

removeUpdate

void removeUpdate(TextBuffer buffer,
                  int offset,
                  int count,
                  char[] removedData)
Provides notification about a removal from the TextBuffer.

Parameters:
buffer - the TextBuffer that changed.
offset - the offset of the first removed character.
count - the number of characters removed (removedData.length)
removedData - an array of the removed characters

attributeUpdate

void attributeUpdate(TextBuffer buffer,
                     int attribute)
Provides notification regarding a change to one of the buffer attributes. The possible attributes are defined in this interface.

Parameters:
buffer - the TextBuffer that changed.
attribute - the attribute that changed

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1.4.0)

E13403-05

Copyright © 1997, 2011, Oracle. All rights reserved.