001: /*
002: * Copyright (C) 2005 - 2008 JasperSoft Corporation. All rights reserved.
003: * http://www.jaspersoft.com.
004: *
005: * Unless you have purchased a commercial license agreement from JasperSoft,
006: * the following license terms apply:
007: *
008: * This program is free software; you can redistribute it and/or modify
009: * it under the terms of the GNU General Public License version 2 as published by
010: * the Free Software Foundation.
011: *
012: * This program is distributed WITHOUT ANY WARRANTY; and without the
013: * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
014: * See the GNU General Public License for more details.
015: *
016: * You should have received a copy of the GNU General Public License
017: * along with this program; if not, see http://www.gnu.org/licenses/gpl.txt
018: * or write to:
019: *
020: * Free Software Foundation, Inc.,
021: * 59 Temple Place - Suite 330,
022: * Boston, MA USA 02111-1307
023: *
024: *
025: *
026: *
027: * PluginEntry.java
028: *
029: * Created on 19 maggio 2004, 7.59
030: *
031: */
032:
033: package it.businesslogic.ireport;
034:
035: /**
036: *
037: * @author Administrator
038: */
039: public class PluginEntry {
040:
041: private String name = "";
042: private String description = "";
043: private boolean configurable = false;
044: private it.businesslogic.ireport.plugin.IReportPlugin plugin = null;
045: private javax.swing.Icon icon = null;
046: private String className = null;
047: private boolean hide = false;
048: private boolean loadOnStartup = false;
049: private it.businesslogic.ireport.gui.MainFrame mainFrame = null;
050:
051: /** Creates a new instance of PluginEntry */
052: public PluginEntry() {
053: }
054:
055: /** Getter for property configurable.
056: * @return Value of property configurable.
057: *
058: */
059: public boolean isConfigurable() {
060: return configurable;
061: }
062:
063: /** Setter for property configurable.
064: * @param configurable New value of property configurable.
065: *
066: */
067: public void setConfigurable(boolean configurable) {
068: this .configurable = configurable;
069: }
070:
071: /** Getter for property description.
072: * @return Value of property description.
073: *
074: */
075: public java.lang.String getDescription() {
076: return description;
077: }
078:
079: /** Setter for property description.
080: * @param description New value of property description.
081: *
082: */
083: public void setDescription(java.lang.String description) {
084: this .description = description;
085: }
086:
087: /** Getter for property icon.
088: * @return Value of property icon.
089: *
090: */
091: public javax.swing.Icon getIcon() {
092: return icon;
093: }
094:
095: /** Setter for property icon.
096: * @param icon New value of property icon.
097: *
098: */
099: public void setIcon(javax.swing.Icon 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 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 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: if (plugin == null) {
125: try {
126: //plugin = (it.businesslogic.ireport.plugin.IReportPlugin)getClass().forName(getClassName()).newInstance();
127: ReportClassLoader rcl = this .mainFrame
128: .getReportClassLoader();
129: rcl.rescanAdditionalClasspath();
130:
131: try {
132: plugin = (it.businesslogic.ireport.plugin.IReportPlugin) rcl
133: .findClass(getClassName()).newInstance();
134: } catch (java.lang.ClassNotFoundException ex) {
135: plugin = (it.businesslogic.ireport.plugin.IReportPlugin) getClass()
136: .forName(getClassName()).newInstance();
137: }
138:
139: plugin.setMainFrame(this .mainFrame);
140: } catch (Exception ex) {
141: ex.printStackTrace();
142: }
143: }
144: return plugin;
145: }
146:
147: /** Setter for property plugin.
148: * @param plugin New value of property plugin.
149: *
150: */
151: public void setPlugin(
152: 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 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 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 toString() {
205: if (this .getName() != null) {
206: return this .getName();
207: }
208: return "" + this ;
209: }
210:
211: /** Getter for property mainFrame.
212: * @return Value of property mainFrame.
213: *
214: */
215: public it.businesslogic.ireport.gui.MainFrame getMainFrame() {
216: return mainFrame;
217: }
218:
219: /** Setter for property mainFrame.
220: * @param mainFrame New value of property mainFrame.
221: *
222: */
223: public void setMainFrame(
224: it.businesslogic.ireport.gui.MainFrame mainFrame) {
225: this.mainFrame = mainFrame;
226: }
227:
228: }
|