KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > spi > options > OptionsPanelController


1 package org.netbeans.spi.options;
2
3 import java.beans.PropertyChangeListener JavaDoc;
4 import javax.swing.JComponent JavaDoc;
5 import org.openide.util.HelpCtx;
6 import org.openide.util.Lookup;
7
8 /**
9  * PanelController creates visual representation of one Options Dialog
10  * category, and manages communication between Options Dialog and this
11  * panel.
12  */

13 public abstract class OptionsPanelController {
14
15     /**
16      * Property name constant.
17      */

18     public static final String JavaDoc PROP_VALID = "valid";
19
20     /**
21      * Property name constant.
22      */

23     public static final String JavaDoc PROP_CHANGED = "changed";
24
25     /**
26      * Property name constant.
27      */

28     public static final String JavaDoc PROP_HELP_CTX = "helpCtx";
29
30     /**
31      * Component should load its data here. You should not do any
32      * time-consuming operations inside the constructor, because it
33      * blocks initialization of OptionsDialog. Initialization
34      * should be implemented in update method.
35      * This method is called after {@link #getComponent} method.
36      * Update method can be called more than one time for the same instance
37      * of JComponent obtained from {@link #getComponent} call.
38      */

39     public abstract void update ();
40
41     /**
42      * This method is called when Options Dialog "OK" button is pressed.
43      * This method can be called even before update () method is called.
44      */

45     public abstract void applyChanges ();
46
47     /**
48      * This method is called when Options Dialog "Cancel" button is pressed.
49      * This method can be called even before update () method is called.
50      */

51     public abstract void cancel ();
52
53     /**
54      * Should return <code>true</code> if some option value in this
55      * category is valid.
56      *
57      *
58      * @return <code>true</code> if some option value in this
59      * category is valid
60      */

61     public abstract boolean isValid ();
62
63     /**
64      * Should return <code>true</code> if some option value in this
65      * category has been changed.
66      *
67      *
68      * @return <code>true</code> if some option value in this
69      * category has been changed
70      */

71     public abstract boolean isChanged ();
72
73     /**
74      * Each option category can provide some lookup. Options Dialog master
75      * lookup is composed from these individual lookups. Master lookup
76      * can be obtained from {@link #getComponent} call. This lookup is designed
77      * to support communication anong individual panels in one Options
78      * Dialog.
79      *
80      *
81      * @return lookup provided by this Options Dialog panel
82      */

83     public Lookup getLookup () {
84         return Lookup.EMPTY;
85     }
86
87     /**
88      * Returns visual component representing this options category.
89      * This method is called before {@link #update} method.
90      *
91      * @param masterLookup master lookup composed from lookups provided by
92      * individual OptionsPanelControllers
93      * - {@link OptionsPanelController#getLookup}
94      * @return visual component representing this options category
95      */

96     public abstract JComponent JavaDoc getComponent (Lookup masterLookup);
97
98     /**
99      *
100      * Get current help context asociated with this panel.
101      *
102      *
103      * @return current help context
104      */

105     public abstract HelpCtx getHelpCtx ();
106
107     /**
108      * Registers new listener.
109      *
110      *
111      * @param l a new listener
112      */

113     public abstract void addPropertyChangeListener (PropertyChangeListener JavaDoc l);
114
115     /**
116      * Unregisters given listener.
117      *
118      *
119      * @param l a listener to be removed
120      */

121     public abstract void removePropertyChangeListener (PropertyChangeListener JavaDoc l);
122 }
123
Popular Tags