KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > spi > editor > errorstripe > UpToDateStatusProvider


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.errorstripe;
21
22 import java.beans.PropertyChangeListener JavaDoc;
23 import java.beans.PropertyChangeSupport JavaDoc;
24 import org.netbeans.modules.editor.errorstripe.apimodule.SPIAccessor;
25
26 /**UpToDateStatus provider.
27  *
28  * TODO: better javadoc.
29  *
30  * @author Jan Lahoda
31  */

32 public abstract class UpToDateStatusProvider {
33
34     static {
35         SPIAccessor.DEFAULT = new SPIAccessorImpl();
36     }
37
38     /**Name of property which should be fired when the up-to-date status changes.
39      */

40     public static final String JavaDoc PROP_UP_TO_DATE = "upToDate"; // NOI18N
41

42     private PropertyChangeSupport JavaDoc pcs;
43     
44     /** Creates a new instance of MarkProvider */
45     public UpToDateStatusProvider() {
46         pcs = new PropertyChangeSupport JavaDoc(this);
47     }
48     
49     /**Report whether the current annotations attached to the documents are up-to-date
50      * (the meaning of up-to-date is left on the provider).
51      *
52      * If a provider does not provide this information, it should
53      * always return {@link UpToDateStatus#UP_TO_DATE_OK} value.
54      *
55      * @return a value of the {@link UpToDateStatus} enum.
56      *
57      * @see UpToDateStatus#UP_TO_DATE_OK
58      * @see UpToDateStatus#UP_TO_DATE_PROCESSING
59      * @see UpToDateStatus#UP_TO_DATE_DIRTY
60      *
61      */

62     public abstract UpToDateStatus getUpToDate();
63     
64     /**Register a {@link PropertyChangeListener}.
65      *
66      * @param l listener to register
67      */

68     /*package private*/ final void addPropertyChangeListener(PropertyChangeListener JavaDoc l) {
69         pcs.addPropertyChangeListener(l);
70     }
71     
72     /**Unregister a {@link PropertyChangeListener}.
73      *
74      * @param l listener to register
75      */

76     /*package private*/ final void removePropertyChangeListener(PropertyChangeListener JavaDoc l) {
77         pcs.removePropertyChangeListener(l);
78     }
79     
80     /**Fire property change event to all registered listener. Subclasses should call
81      * this method when they need to fire the {@link java.beans.PropertyChangeEvent}
82      * because property {@link #PROP_UP_TO_DATE} have changed.
83      *
84      * @param name name of the property ({@link #PROP_UP_TO_DATE})
85      * @param old previous value of the property or null if unknown
86      * @param nue current value of the property or null if unknown
87      */

88     protected final void firePropertyChange(String JavaDoc name, Object JavaDoc old, Object JavaDoc nue) {
89         pcs.firePropertyChange(name, old, nue);
90     }
91     
92 }
93
Popular Tags