KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > ca > directory > jxplorer > viewer > PluggableEditor


1 package com.ca.directory.jxplorer.viewer;
2
3 import com.ca.directory.jxplorer.DataSink;
4
5 import java.awt.Component JavaDoc;
6 import javax.swing.*;
7
8
9 /**
10  * PluggableEditor defines the interface used by 'pluggable' objects that
11  * display data to the user in JXPlorer. Objects that implement this
12  * interface, are placed in the package com.ca.directory.jxplorer.viewer, and
13  * are given the class name of a particular schema object class will be
14  * dynamically loaded when the JXPlorer user attempts to view that
15  * object class.<p>
16  * For example, a class implementing this interface, called
17  * 'person.class', and placed in the com/cai/od/jxplorer/viewer directory,
18  * would be automatically loaded whenever the user accessed a 'person' entry,
19  * or a 'person' derived entry, in the directory.<p>
20  * Note that the class should be given the completely <b>lower case</b> name of the
21  * object class being modelled, and be aware that this breaks the java class naming
22  * convention. (E.g. use 'organizationalunit.java' rather than either 'OrganizatonalUnit.java'
23  * or 'organizationalUnit.java').<p>
24  * @author Chris Betts
25  */

26  
27 public interface PluggableEditor
28 {
29     /**
30      * This returns the swing component being used to display
31      * the data, so that another component can set its visibility.<p>
32      * In many cases this may be the editor itself.
33      * @return the java.swing component being used to display the node data.
34      */

35      
36     public JComponent getDisplayComponent();
37     
38     /**
39      * This returns the component that should be used to print
40      * the data (e.g. a full table of data that spans several pages).<p>
41      * A minimal implementation can simply return getDisplayComponent().
42      * @return the component being used to print the node data.
43      */

44     public Component JavaDoc getPrintComponent();
45     
46      /**
47       * Returns the data sink that will be used to slurp data.<p>
48       * In many cases this may be the editor itself.
49       * @return a data sink to display or process data.
50       */

51       
52      public DataSink getDataSink();
53
54     
55     /**
56      * This sets whether the component expects to be the <i>only</i>
57      * editor used for its object class, or whether it will co-exist
58      * with any other applicable editors, and the default (html/table)
59      * editor.
60      */

61      
62     public boolean isUnique();
63     
64     /**
65      * Returns the title of the editor. (This might be displayed on a
66      * tab or similar). If null, the object class name will be used
67      * instead.
68      */

69      
70      public String JavaDoc getName();
71      
72     /**
73      * Returns the icon of the editor. (This might be displayed on a tab or similar).
74      * .
75      */

76      
77      public ImageIcon getIcon();
78      
79     /**
80      * Returns the Tool Tip of the editor. (This might be displayed on a tab or similar).
81      * .
82      */

83          
84      public String JavaDoc getToolTip();
85      
86      
87     /**
88      * Registers Swing components that the pluggable editor may manipulate.
89      * Any or all of these may be null if the editor is not permitted to
90      * manipulate the objects. <p>
91      *
92      * Any changes made by the editor should be removed when the editor is
93      * unloaded.
94      *
95      * @param menu the main menu that appears on the top of JXplorer
96      * @param buttons the JXplorer button bar
97      * @param tree the JXplorer tree
98      * @param treeMenu the popup menu that JXplorer uses for tree items
99      * @param jxplorer the root JXplorer object, from which the entire GUI tree descends. (You need this for
100      * look & feel updates, and possibly for paintology)
101      */

102           
103      public void registerComponents(JMenuBar menu, JToolBar buttons, JTree tree, JPopupMenu treeMenu, JFrame jxplorer);
104      
105      
106      /**
107       * This method is called when the editor is being unloaded by the browser,
108       * and allows for any required clean up activity. Note that this is <i>not</i>
109       * necessarily called when JXplorer shuts down.
110       */

111       
112      public void unload();
113      
114      /**
115       * If a UNIQUE pluggable editor exists for an entry, the display tree will
116       * call this method to see if a special icon is desired. At this stage it
117       * is quite likely that the entry will not have been fully read, so that all
118       * that is known will be the entry name and object classes.<p>
119       *
120       * Most pluggable editors will not bother implementing this class and will just
121       * return null. Only pluggable editors with very special needs should consider
122       * implementing this: otherwise the normal naming attribute or object class
123       * based icons should be sufficient.
124       *
125       * @param rdn the name of the tree node being displayed (i.e. the rdn of the entry)
126       * @return an image icon to display - usually 'null' to revert to default behaviour.
127       */

128       
129      public ImageIcon getTreeIcon(String JavaDoc rdn);
130      
131      
132      /**
133       * If a UNIQUE pluggable editor exists for an entry, the display tree will
134       * call this method to see if a special pull down menu ('right click menu')
135       * is desired. Most pluggable editors will use the default behaviour and
136       * will simply return null.
137       * @param rdn the name of the tree node being displayed (i.e. the rdn of the entry)
138       * @return a popup menu to use for this type of entry - usually 'null' to revert to default behaviour.
139       */

140       
141      public JPopupMenu getPopupMenu(String JavaDoc rdn);
142      
143      
144      /**
145       * If a UNIQUE pluggable editor exists for an entry, the display tree will
146       * call this method to see if it should hide the subtree below this entry
147       * because the pluggable editor is directly handling this data.<p>
148       *
149       * Most pluggable editors will use the default behaviour and return 'false'
150       * to allow user browsing of sub entries.
151       *
152       * @param rdn the name of the tree node being displayed (i.e. the rdn of the entry)
153       * @return whether to truncate the subtree (normally 'false').
154       */

155       
156       public boolean hideSubEntries(String JavaDoc rdn);
157      
158
159
160 }
Popular Tags