|
LPEX 4.4.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface LpexDocumentListener
Interface LpexDocumentListener can be implemented to listen to text changes and adjustments in the document.
Note: In general, the document-parser calls are sufficient for applications that use the LPEX widget, and this specialized listener is not needed. The performance overhead of creating this listener's notifications should be taken into consideration before using it. It is mainly intended for internal use inside the editor, and the definition of its notifications (types and parameters) may change in future releases.
The information provided applies to the entire text of the line(s), i.e., including the sequence numbers, if set. No notifications are sent for show elements (such as document parser error-message lines).
Certain editing operations may trigger several consecutive notifications for one change which has already been recorded in the text of an element. For example, one replaceText command may trigger notifications indicating the text replaced, the text inserted beyond the end of the original line, and a sequence-numbers text part change.
Create a listener object using this class, and then register it with a
document view using LpexView's addLpexDocumentListener()
or
addLpexDocumentAdjustListener()
. When text changes occur in
the currently-loaded document section, the documentChanged() method in the
listener object is invoked. Example:
lpexView.addLpexDocumentListener(new LpexDocumentListener() { // document text change public void documentChanged(LpexView view, int type, int line, int position, int count) { handleDocumentChange(view, type, line, position, count); } }); |
LpexView.addLpexDocumentListener(com.ibm.lpex.core.LpexDocumentListener)
,
LpexView.removeLpexDocumentListener(com.ibm.lpex.core.LpexDocumentListener)
,
LpexView.addLpexDocumentAdjustListener(com.ibm.lpex.core.LpexDocumentListener)
,
LpexView.removeLpexDocumentAdjustListener(com.ibm.lpex.core.LpexDocumentListener)
Field Summary | |
---|---|
static int |
ELEMENT_INSERTED
Notification sent when one or more consecutive text element(s) are inserted in the document. |
static int |
ELEMENT_REMOVED
Notification sent when one or more consecutive text elements are deleted from the document. |
static int |
ELEMENT_REPLACED
Notification sent when one or more consecutive text element(s) are replaced in the document. |
static int |
END_CHANGES
Informational notification sent for certain operations to indicate the end of the series of non-overlapping changes. |
static int |
START_CHANGES
Informational notification sent for certain operations to indicate the start of a series of non-overlapping changes. |
static int |
TEXT_INSERTED
Notification sent when text is inserted in a text element. |
static int |
TEXT_REMOVED
Notification sent when text is deleted in a text element. |
static int |
TEXT_REPLACED
Notification sent when text is replaced in a text element. |
Method Summary | |
---|---|
void |
documentChanged(LpexView lpexView,
int type,
int line,
int position,
int count)
This method is invoked when a text event occurs in the LPEX document. |
Field Detail |
---|
static final int TEXT_REMOVED
count
indicates the number of characters being deleted.
static final int TEXT_REPLACED
count
indicates the number of characters replaced.
static final int TEXT_INSERTED
count
indicates the number of characters inserted.
static final int ELEMENT_REMOVED
count
indicates the number of text elements being deleted.
static final int ELEMENT_REPLACED
count
indicates the number of text elements replaced.
static final int ELEMENT_INSERTED
count
indicates the number of text elements inserted.
static final int START_CHANGES
count
is 0.
static final int END_CHANGES
count
is 0.
Method Detail |
---|
void documentChanged(LpexView lpexView, int type, int line, int position, int count)
lpexView
- the view of the editor document that triggered the
notificationtype
- notification typeline
- first or only document line affected (defined inside the
document section that is currently loaded in the editor), or
0 for informational notificationsposition
- first change position inside line
, or
0 for element and informational notificationscount
- character / element count of the change, or
0 for informational notifications
|
LPEX 4.4.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |