KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > spi > editor > highlighting > HighlightsChangeEvent


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.spi.editor.highlighting;
21
22 import java.util.EventObject JavaDoc;
23
24 /**
25  * An event object notifying about a change in highlighting of certain area
26  * of a document. The area where the highlighting has changed is specified by
27  * its starting and ending offsets. Whoever receives this event should consider
28  * re-requesting the new list of highlighted areas from the
29  * <code>HighlightsContainer</code> that fired the event.
30  *
31  * @author Vita Stejskal
32  */

33 public final class HighlightsChangeEvent extends EventObject JavaDoc {
34     
35     private int startOffset;
36     private int endOffset;
37     
38     /**
39      * Creates a new instance of <code>HighlightsChangeEvent</code>. The
40      * <code>startOffset</code> and <code>endOffset</code> parameters specify
41      * the area of a document where highlighting has changed. It's possible to
42      * use <code>Integer.MAX_VALUE</code> for the <code>endOffset</code> parameter
43      * meaning that the end of the change is unknown or the change spans up to
44      * the end of a document.
45      *
46      * @param source The highlight layer that fired this event.
47      * @param startOffset The beginning of the area that has changed.
48      * @param endOffset The end of the changed area.
49      */

50     public HighlightsChangeEvent(HighlightsContainer source, int startOffset, int endOffset) {
51         super(source);
52         this.startOffset = startOffset;
53         this.endOffset = endOffset;
54     }
55
56     /**
57      * Gets the beginning of an area in the document where highlighting has
58      * changed.
59      *
60      * @return The starting offset of the chaged area. Should always be greater than
61      * or equal to zero.
62      */

63     public int getStartOffset() {
64         return startOffset;
65     }
66     
67     /**
68      * Gets the end of an area in the document where highlighting has
69      * changed.
70      *
71      * @return The ending offset of the chaged area. May return <code>Integer.MAX_VALUE</code>
72      * if the ending position is unknown.
73      */

74     public int getEndOffset() {
75         return endOffset;
76     }
77 }
78
Popular Tags