|
Extension SDK | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
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(int attribute)
Provides notification regarding a change to one of the buffer attributes. |
void |
insertUpdate(int offset,
int count,
char[] insertedData)
Provides notification about an insertion into the TextBuffer . |
void |
removeUpdate(int offset,
int count,
char[] removedData)
Provides notification about a removal from the TextBuffer . |
Field Detail |
public static final int EOL_TYPE_ATTRIBUTE
attributeUpdate()
to report a change to the EOL
type.
public static final int READ_ONLY_ATTRIBUTE
attributeUpdate()
to report a change to the
read-only mode.
public static final int RELOAD_START_ATTRIBUTE
TextBuffer.read( Reader )
has been
invoked, and that the contents of the buffer are about to be
reloaded.
public static final int RELOAD_END_ATTRIBUTE
TextBuffer.read( Reader )
has been
completed, and that the contents of the buffer have already been
replaced.
public static final int MODIFIED_ATTRIBUTE
attributeUpdate()
to report a change
in the modified state of the buffer.
Method Detail |
public void insertUpdate(int offset, int count, char[] insertedData)
TextBuffer
.
offset
- the offset where the insert took placecount
- the number of characters inserted (insertedData.length)insertedData
- the contents of the insertionpublic void removeUpdate(int offset, int count, char[] removedData)
TextBuffer
.
offset
- the offset where the removal took placecount
- the number of characters removed (removedData.length)removedData
- the contents of the removalpublic void attributeUpdate(int attribute)
attribute
- the attribute that changed
|
Extension SDK | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright ©1997, 2003, Oracle. All rights reserved.