KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > columba > core > gui > plugin > PluginNode


1 //The contents of this file are subject to the Mozilla Public License Version 1.1
2
//(the "License"); you may not use this file except in compliance with the
3
//License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
4
//
5
//Software distributed under the License is distributed on an "AS IS" basis,
6
//WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
7
//for the specific language governing rights and
8
//limitations under the License.
9
//
10
//The Original Code is "The Columba Project"
11
//
12
//The Initial Developers of the Original Code are Frederik Dietz and Timo Stich.
13
//Portions created by Frederik Dietz and Timo Stich are Copyright (C) 2003.
14
//
15
//All Rights Reserved.
16
package org.columba.core.gui.plugin;
17
18 import javax.swing.tree.DefaultMutableTreeNode JavaDoc;
19
20 import org.columba.core.plugin.PluginManager;
21
22
23 /**
24  * @author frd
25  *
26  * To change the template for this generated type comment go to
27  * Window>Preferences>Java>Code Generation>Code and Comments
28  */

29 public class PluginNode extends DefaultMutableTreeNode JavaDoc {
30     
31     private static final java.util.logging.Logger JavaDoc LOG =
32         java.util.logging.Logger.getLogger("org.columba.core.gui.plugin"); //$NON-NLS-1$
33

34     String JavaDoc id;
35     String JavaDoc version;
36     String JavaDoc tooltip;
37     boolean category;
38     boolean enabled;
39
40     /** Lazily created Boolean stating if the plugin has info or not, can be null. */
41     Boolean JavaDoc hasInfo;
42
43     public PluginNode() {
44         category = false;
45     }
46
47     /**
48  * @param arg0
49  */

50     public PluginNode(Object JavaDoc arg0) {
51         super(arg0);
52
53         category = false;
54     }
55
56     /**
57  * @return
58  */

59     public String JavaDoc getId() {
60         return id;
61     }
62
63     /**
64  * @return
65  */

66     public boolean isEnabled() {
67         return enabled;
68     }
69
70     /**
71  * @param string
72  */

73     public void setId(String JavaDoc string) {
74         id = string;
75     }
76
77     /**
78  * @param b
79  */

80     public void setEnabled(boolean b) {
81         enabled = b;
82     }
83
84     /**
85  * @return
86  */

87     public String JavaDoc getTooltip() {
88         return tooltip;
89     }
90
91     /**
92  * @param string
93  */

94     public void setTooltip(String JavaDoc string) {
95         tooltip = string;
96     }
97
98     /**
99  * @return
100  */

101     public String JavaDoc getVersion() {
102         return version;
103     }
104
105     /**
106  * @param string
107  */

108     public void setVersion(String JavaDoc string) {
109         version = string;
110     }
111
112     /**
113  * @return
114  */

115     public boolean isCategory() {
116         return category;
117     }
118
119     /**
120  * @param b
121  */

122     public void setCategory(boolean b) {
123         category = b;
124     }
125
126     /**
127  * Returns true if the plugin has information about the plugin.
128  * This attribute is created lazily, and may take a while since it
129  * has to check for files on the file system. (Using the <code>PluginManager</code>.)
130  * @return true if the plugin has info files; false if it doesnt have an info file.
131  */

132     public boolean hasInfo() {
133         if (hasInfo == null) {
134             hasInfo = Boolean.valueOf(PluginManager.getInstance().getInfoURL(id) != null);
135         }
136
137         return hasInfo.booleanValue();
138     }
139
140     public void debug() {
141         LOG.info("id=" + id); //$NON-NLS-1$
142
LOG.info("version=" + version); //$NON-NLS-1$
143
LOG.info("enabled=" + enabled); //$NON-NLS-1$
144
LOG.info("isCategory=" + category); //$NON-NLS-1$
145
LOG.info("description=" + tooltip); //$NON-NLS-1$
146
LOG.info("hasInfo=" + hasInfo()); //$NON-NLS-1$
147
}
148 }
149
Popular Tags