001: /*
002: * Copyright (C) 2005-2007 JasperSoft http://www.jaspersoft.com
003: *
004: * This program is free software; you can redistribute it and/or modify
005: * it under the terms of the GNU General Public License as published by
006: * the Free Software Foundation; either version 2 of the License, or
007: * (at your option) any later version.
008: *
009: * This program is distributed WITHOUT ANY WARRANTY; and without the
010: * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
011: * See the GNU General Public License for more details.
012: *
013: * You should have received a copy of the GNU General Public License
014: * along with this program; if not, see http://www.gnu.org/licenses/gpl.txt
015: * or write to:
016: *
017: * Free Software Foundation, Inc.,
018: * 59 Temple Place - Suite 330,
019: * Boston, MA USA 02111-1307
020: *
021: *
022: * SQLFieldsProvider.java
023: *
024: * Created on December 7, 2006, 9:22 AM
025: *
026: * To change this template, choose Tools | Template Manager
027: * and open the template in the editor.
028: */
029:
030: package it.businesslogic.ireport.data;
031:
032: import it.businesslogic.ireport.FieldsProvider;
033: import it.businesslogic.ireport.FieldsProviderEditor;
034: import it.businesslogic.ireport.IReportConnection;
035: import it.businesslogic.ireport.gui.MainFrame;
036: import it.businesslogic.ireport.gui.ReportQueryDialog;
037: import java.awt.Component;
038: import java.util.Map;
039: import net.sf.jasperreports.engine.JRDataset;
040: import net.sf.jasperreports.engine.JRException;
041: import net.sf.jasperreports.engine.JRField;
042:
043: /**
044: *
045: * @author gtoffoli
046: */
047: public class EJBQLFieldsProvider implements FieldsProvider {
048:
049: private EJBQLBeanInspectorPanel bip = null;
050:
051: /** Creates a new instance of SQLFieldsProvider */
052: public EJBQLFieldsProvider() {
053: }
054:
055: /**
056: * Returns true if the provider supports the {@link #getFields(IReportConnection,JRDataset,Map) getFields}
057: * operation. By returning true in this method the data source provider indicates
058: * that it is able to introspect the data source and discover the available fields.
059: *
060: * @return true if the getFields() operation is supported.
061: */
062: public boolean supportsGetFieldsOperation() {
063: return false;
064: }
065:
066: public JRField[] getFields(IReportConnection con,
067: JRDataset reportDataset, Map parameters)
068: throws JRException, UnsupportedOperationException {
069: return null;
070: }
071:
072: public boolean supportsAutomaticQueryExecution() {
073: return true;
074: }
075:
076: public boolean hasQueryDesigner() {
077: return false;
078: }
079:
080: public boolean hasEditorComponent() {
081: return true;
082: }
083:
084: public String designQuery(IReportConnection con, String query,
085: ReportQueryDialog reportQueryDialog) throws JRException,
086: UnsupportedOperationException {
087: return null;
088: }
089:
090: public FieldsProviderEditor getEditorComponent(
091: ReportQueryDialog reportQueryDialog) {
092:
093: if (bip == null) {
094: bip = new EJBQLBeanInspectorPanel();
095: if (reportQueryDialog != null) {
096: bip.setReportQueryDialog(reportQueryDialog);
097: bip.setJTableFields(reportQueryDialog.getFieldsTable());
098: }
099: }
100: return bip;
101: }
102:
103: }
|