KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > editor > errorstripe > privatespi > MarkProvider


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.modules.editor.errorstripe.privatespi;
21
22 import java.beans.PropertyChangeListener JavaDoc;
23 import java.beans.PropertyChangeSupport JavaDoc;
24 import java.util.List JavaDoc;
25 import org.netbeans.spi.editor.errorstripe.UpToDateStatus;
26
27 /**Provider of list of {@link Mark}. The provider is supposed to report marks
28  * found in a document. The provider can also tell whether the current list of marks
29  * is up to date with the current state of the document. The provider is supposed
30  * to fire a property change event if the list of marks or up-to-date property
31  * are changed.
32  *
33  * @author Jan Lahoda
34  */

35 public abstract class MarkProvider {
36     
37     /**Name of property which should be fired when the list of {@link Mark}s changes.
38      */

39     public static final String JavaDoc PROP_MARKS = "marks"; // NOI18N
40

41     private PropertyChangeSupport JavaDoc pcs;
42     
43     /** Creates a new instance of MarkProvider */
44     public MarkProvider() {
45         pcs = new PropertyChangeSupport JavaDoc(this);
46     }
47     
48     /**Return list of {@link Mark}s that are to be shown in the Error Stripe.
49      *
50      * @return list of {@link Mark}s
51      */

52     public abstract List JavaDoc/*<Mark>*/ getMarks();
53     
54     /**Register a {@link PropertyChangeListener}.
55      *
56      * @param l listener to register
57      */

58     public final void addPropertyChangeListener(PropertyChangeListener JavaDoc l) {
59         pcs.addPropertyChangeListener(l);
60     }
61     
62     /**Unregister a {@link PropertyChangeListener}.
63      *
64      * @param l listener to register
65      */

66     public final void removePropertyChangeListener(PropertyChangeListener JavaDoc l) {
67         pcs.removePropertyChangeListener(l);
68     }
69     
70     /**Fire property change event to all registered listener. Subclasses should call
71      * this method when they need to fire the {@link java.beans.PropertyChangeEvent}
72      * because property {@link #PROP_UP_TO_DATE} or {@link #PROP_MARKS} have changed.
73      *
74      * @param name name of the property ({@link #PROP_UP_TO_DATE} or {@link #PROP_MARKS})
75      * @param old previous value of the property or null if unknown
76      * @param nue current value of the property or null if unknown
77      */

78     protected final void firePropertyChange(String JavaDoc name, Object JavaDoc old, Object JavaDoc nue) {
79         pcs.firePropertyChange(name, old, nue);
80     }
81     
82 }
83
Popular Tags