KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > it > businesslogic > ireport > PluginEntry


1 /*
2  * Copyright (C) 2005 - 2006 JasperSoft Corporation. All rights reserved.
3  * http://www.jaspersoft.com.
4  *
5  * Unless you have purchased a commercial license agreement from JasperSoft,
6  * the following license terms apply:
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License version 2 as published by
10  * the Free Software Foundation.
11  *
12  * This program is distributed WITHOUT ANY WARRANTY; and without the
13  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14  * See the GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, see http://www.gnu.org/licenses/gpl.txt
18  * or write to:
19  *
20  * Free Software Foundation, Inc.,
21  * 59 Temple Place - Suite 330,
22  * Boston, MA USA 02111-1307
23  *
24  *
25  *
26  *
27  * PluginEntry.java
28  *
29  * Created on 19 maggio 2004, 7.59
30  *
31  */

32
33 package it.businesslogic.ireport;
34
35 /**
36  *
37  * @author Administrator
38  */

39 public class PluginEntry {
40        
41     private String JavaDoc name = "";
42     private String JavaDoc description = "";
43     private boolean configurable = false;
44     private it.businesslogic.ireport.plugin.IReportPlugin plugin = null;
45     private javax.swing.Icon JavaDoc icon = null;
46     private String JavaDoc className = null;
47     private boolean hide = false;
48     private boolean loadOnStartup = false;
49     private it.businesslogic.ireport.gui.MainFrame mainFrame = null;
50     
51     /** Creates a new instance of PluginEntry */
52     public PluginEntry() {
53     }
54     
55     /** Getter for property configurable.
56      * @return Value of property configurable.
57      *
58      */

59     public boolean isConfigurable() {
60         return configurable;
61     }
62             
63     /** Setter for property configurable.
64      * @param configurable New value of property configurable.
65      *
66      */

67     public void setConfigurable(boolean configurable) {
68         this.configurable = configurable;
69     }
70     
71     /** Getter for property description.
72      * @return Value of property description.
73      *
74      */

75     public java.lang.String JavaDoc getDescription() {
76         return description;
77     }
78     
79     /** Setter for property description.
80      * @param description New value of property description.
81      *
82      */

83     public void setDescription(java.lang.String JavaDoc description) {
84         this.description = description;
85     }
86     
87     /** Getter for property icon.
88      * @return Value of property icon.
89      *
90      */

91     public javax.swing.Icon JavaDoc getIcon() {
92         return icon;
93     }
94     
95     /** Setter for property icon.
96      * @param icon New value of property icon.
97      *
98      */

99     public void setIcon(javax.swing.Icon JavaDoc icon) {
100         this.icon = icon;
101     }
102     
103     /** Getter for property name.
104      * @return Value of property name.
105      *
106      */

107     public java.lang.String JavaDoc getName() {
108         return name;
109     }
110     
111     /** Setter for property name.
112      * @param name New value of property name.
113      *
114      */

115     public void setName(java.lang.String JavaDoc name) {
116         this.name = name;
117     }
118     
119     /** Getter for property plugin.
120      * @return Value of property plugin.
121      *
122      */

123     public it.businesslogic.ireport.plugin.IReportPlugin getPlugin()
124     {
125         if (plugin == null)
126         {
127             try {
128                //plugin = (it.businesslogic.ireport.plugin.IReportPlugin)getClass().forName(getClassName()).newInstance();
129
ReportClassLoader rcl = this.mainFrame.getReportClassLoader();
130                rcl.rescanAdditionalClasspath();
131                 
132                try {
133                 plugin = (it.businesslogic.ireport.plugin.IReportPlugin)rcl.findClass(getClassName()).newInstance();
134                } catch (java.lang.ClassNotFoundException JavaDoc ex)
135                {
136                    plugin = (it.businesslogic.ireport.plugin.IReportPlugin)getClass().forName(getClassName()).newInstance();
137                }
138                
139                 plugin.setMainFrame( this.mainFrame );
140             } catch (Exception JavaDoc ex)
141             {
142                 ex.printStackTrace();
143             }
144         }
145         return plugin;
146     }
147     
148     /** Setter for property plugin.
149      * @param plugin New value of property plugin.
150      *
151      */

152     public void setPlugin(it.businesslogic.ireport.plugin.IReportPlugin plugin) {
153         this.plugin = plugin;
154     }
155     
156     /** Getter for property className.
157      * @return Value of property className.
158      *
159      */

160     public java.lang.String JavaDoc getClassName() {
161         return className;
162     }
163     
164     /** Setter for property className.
165      * @param className New value of property className.
166      *
167      */

168     public void setClassName(java.lang.String JavaDoc className) {
169         this.className = className;
170     }
171     
172     /** Getter for property hide.
173      * @return Value of property hide.
174      *
175      */

176     public boolean isHide() {
177         return hide;
178     }
179     
180     /** Setter for property hide.
181      * @param hide New value of property hide.
182      *
183      */

184     public void setHide(boolean hide) {
185         this.hide = hide;
186     }
187     
188     /** Getter for property loadOnStartup.
189      * @return Value of property loadOnStartup.
190      *
191      */

192     public boolean isLoadOnStartup() {
193         return loadOnStartup;
194     }
195     
196     /** Setter for property loadOnStartup.
197      * @param loadOnStartup New value of property loadOnStartup.
198      *
199      */

200     public void setLoadOnStartup(boolean loadOnStartup) {
201         this.loadOnStartup = loadOnStartup;
202     }
203     
204     public String JavaDoc toString()
205     {
206         if (this.getName() != null)
207         {
208             return this.getName();
209         }
210         return ""+this;
211     }
212     
213     /** Getter for property mainFrame.
214      * @return Value of property mainFrame.
215      *
216      */

217     public it.businesslogic.ireport.gui.MainFrame getMainFrame() {
218         return mainFrame;
219     }
220     
221     /** Setter for property mainFrame.
222      * @param mainFrame New value of property mainFrame.
223      *
224      */

225     public void setMainFrame(it.businesslogic.ireport.gui.MainFrame mainFrame) {
226         this.mainFrame = mainFrame;
227     }
228     
229 }
230
Popular Tags