KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > gjt > sp > jedit > buffer > BufferListener


1 /*
2  * BufferListener.java - Buffer listener interface
3  * :tabSize=8:indentSize=8:noTabs=false:
4  * :folding=explicit:collapseFolds=1:
5  *
6  * Copyright (C) 2001, 2005 Slava Pestov
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21  */

22
23 package org.gjt.sp.jedit.buffer;
24
25 /**
26  * A interface for notification of changes to buffer text.<p>
27  *
28  * This interface is new in jEdit 4.3pre3. The text area was made independent
29  * of the rest of jEdit, and thus this class could no longer depend on
30  * <code>org.gjt.sp.jedit.Buffer</code>.<p>
31  *
32  * While the
33  * {@link org.gjt.sp.jedit.msg.BufferUpdate} EditBus message is used for
34  * general buffer state changes, this interface is used for events which are
35  * fired frequently, or for which performance is essential.<p>
36  *
37  * Because this interface is subject to change in the future, you
38  * should subclass <code>BufferAdapter</code> instead of
39  * implementing it directly.
40  *
41  * @author Slava Pestov
42  * @version $Id: BufferListener.java 5339 2006-01-25 23:12:07Z spestov $
43  * @since jEdit 4.3pre3
44  */

45 public interface BufferListener
46 {
47     //{{{ foldLevelChanged() method
48
/**
49      * Called when line fold levels change.
50      * @param buffer The buffer in question
51      * @param startLine The start line number
52      * @param endLine The end line number
53      * @since jEdit 4.3pre3
54      */

55     void foldLevelChanged(JEditBuffer buffer, int startLine, int endLine);
56     //}}}
57

58     //{{{ contentInserted() method
59
/**
60      * Called when text is inserted into the buffer.
61      * @param buffer The buffer in question
62      * @param startLine The first line
63      * @param offset The start offset, from the beginning of the buffer
64      * @param numLines The number of lines inserted
65      * @param length The number of characters inserted
66      * @since jEdit 4.3pre3
67      */

68     void contentInserted(JEditBuffer buffer, int startLine, int offset,
69         int numLines, int length);
70     //}}}
71

72     //{{{ contentRemoved() method
73
/**
74      * Called when text is removed from the buffer.
75      * @param buffer The buffer in question
76      * @param startLine The first line
77      * @param offset The start offset, from the beginning of the buffer
78      * @param numLines The number of lines removed
79      * @param length The number of characters removed
80      * @since jEdit 4.3pre3
81      */

82     void contentRemoved(JEditBuffer buffer, int startLine, int offset,
83         int numLines, int length);
84     //}}}
85

86     //{{{ preContentRemoved() method
87
/**
88      * Called when text is about to be removed from the buffer, but is
89      * still present.
90      * @param buffer The buffer in question
91      * @param startLine The first line
92      * @param offset The start offset, from the beginning of the buffer
93      * @param numLines The number of lines to be removed
94      * @param length The number of characters to be removed
95      * @since jEdit 4.3pre3
96      */

97     public void preContentRemoved(JEditBuffer buffer, int startLine, int offset,
98         int numLines, int length);
99     //}}}
100

101     //{{{ transactionComplete() method
102
/**
103      * Called after an undo or compound edit has finished. The text area
104      * uses this event to queue up and collapse cleanup operations so they
105      * are only run once during a long transaction (such as a "Replace All"
106      * operation.)
107      *
108      * @param buffer The buffer in question
109      * @since jEdit 4.3pre3
110      */

111     void transactionComplete(JEditBuffer buffer);
112     //}}}
113

114     //{{{ foldHandlerChanged() method
115
/**
116      * Called to notify the text area that folds need to be collapsed if
117      * the "collapseFolds" property is set. This method is called after the
118      * buffer has been loaded, and also if the user changes the fold
119      * handler.
120      *
121      * @param buffer The buffer in question
122      * @since jEdit 4.3pre3
123      */

124     void foldHandlerChanged(JEditBuffer buffer);
125     //}}}
126

127     //{{{ foldHandlerChanged() method
128
/**
129      * Called to notify the text area that the buffer has been reloaded.
130      *
131      * @param buffer The buffer in question
132      * @since jEdit 4.3pre3
133      */

134     void bufferLoaded(JEditBuffer buffer);
135     //}}}
136
}
137
Popular Tags