KickJava   Java API By Example, From Geeks To Geeks.

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


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  * FieldsProvider.java
25  *
26  * Created on December 5, 2006, 8:55 PM
27  *
28  */

29
30 package it.businesslogic.ireport;
31
32 import it.businesslogic.ireport.gui.ReportQueryDialog;
33 import java.awt.Component JavaDoc;
34 import java.util.Map JavaDoc;
35 import net.sf.jasperreports.engine.JRDataset;
36 import net.sf.jasperreports.engine.JRException;
37 import net.sf.jasperreports.engine.JRField;
38
39 /**
40  *
41  * @author gtoffoli
42  */

43 public interface FieldsProvider {
44     
45     /**
46      * Returns true if the provider supports the {@link #getFields(IReportConnection,JRDataset,Map) getFields}
47      * operation. By returning true in this method the data source provider indicates
48      * that it is able to introspect the data source and discover the available fields.
49      *
50      * @return true if the getFields() operation is supported.
51      */

52     public boolean supportsGetFieldsOperation();
53     
54     /**
55      * Returns the fields that are available from a query of a specific language
56      * The provider can use the passed in report to extract some additional
57      * configuration information such as report properties.
58      * The IReportConnection object can be used to execute the query.
59      *
60      * @param con the IReportConnection active in iReport.
61      * @param the JRDataset that will be filled using the data source created by this provider.
62      * The passed in report can be null. That means that no compiled report is available yet.
63      * @param parameters map containing the interpreted default value of each parameter
64      * @return a non null fields array. If there are no fields then an empty array must be returned.
65      *
66      * @throws UnsupportedOperationException is the method is not supported
67      * @throws JRException if an error occurs.
68      */

69     public JRField[] getFields(IReportConnection con, JRDataset reportDataset, Map JavaDoc parameters ) throws JRException, UnsupportedOperationException JavaDoc;
70     
71     /**
72      * Returns true if the getFields can be run in a backgroiund thread each time the user changes the query.
73      * This approach can not be valid for fieldsProviders that require much time to return the list of fields.
74      */

75     public boolean supportsAutomaticQueryExecution();
76     
77     /**
78      * Returns true if the FieldsProvider can run an own query designer
79      */

80     public boolean hasQueryDesigner();
81     
82     /**
83      * Returns true if the FieldsProvider can run an own editor
84      */

85     public boolean hasEditorComponent();
86     
87     /**
88      * This method is used to run a query designer for the specific language.
89      *
90      * @param con the IReportConnection active in iReport.
91      * @param query the query to modify
92      * @param reportQueryDialog the parent reportQueryDialog. It can be used to get all (sub)dataset informations
93      * with reportQueryDialog.getSubDataset();
94      *
95      */

96     public String JavaDoc designQuery(IReportConnection con, String JavaDoc query, ReportQueryDialog reportQueryDialog ) throws JRException, UnsupportedOperationException JavaDoc;
97     
98     
99     /**
100      * The component that will stay on the right of the query panel. To listen for query changes, the component must implement
101      * the interface FieldsProviderEditor. The component will be visible only when a queryCahnged is succesfully executed.
102      * The component can store the reference to the report query dialog in which it will appear.
103      *
104      * The editor can
105      */

106     public FieldsProviderEditor getEditorComponent( ReportQueryDialog reportQueryDialog );
107     
108 }
109
Popular Tags