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.data.xml.XMLFieldMappingEditor;
036: import it.businesslogic.ireport.gui.MainFrame;
037: import it.businesslogic.ireport.gui.ReportQueryDialog;
038: import java.awt.Component;
039: import java.util.Map;
040: import net.sf.jasperreports.engine.JRDataset;
041: import net.sf.jasperreports.engine.JRException;
042: import net.sf.jasperreports.engine.JRField;
043:
044: /**
045: *
046: * @author gtoffoli
047: */
048: public class XMLFieldsProvider implements FieldsProvider {
049:
050: private XMLFieldMappingEditor editor = null;
051:
052: /** Creates a new instance of SQLFieldsProvider */
053: public XMLFieldsProvider() {
054: }
055:
056: /**
057: * Returns true if the provider supports the {@link #getFields(IReportConnection,JRDataset,Map) getFields}
058: * operation. By returning true in this method the data source provider indicates
059: * that it is able to introspect the data source and discover the available fields.
060: *
061: * @return true if the getFields() operation is supported.
062: */
063: public boolean supportsGetFieldsOperation() {
064: return false;
065: }
066:
067: public JRField[] getFields(IReportConnection con,
068: JRDataset reportDataset, Map parameters)
069: throws JRException, UnsupportedOperationException {
070: return null;
071: }
072:
073: public boolean supportsAutomaticQueryExecution() {
074: return true;
075: }
076:
077: public boolean hasQueryDesigner() {
078: return false;
079: }
080:
081: public boolean hasEditorComponent() {
082: return true;
083: }
084:
085: public String designQuery(IReportConnection con, String query,
086: ReportQueryDialog reportQueryDialog) throws JRException,
087: UnsupportedOperationException {
088: return query;
089: }
090:
091: public FieldsProviderEditor getEditorComponent(
092: ReportQueryDialog reportQueryDialog) {
093:
094: if (editor == null) {
095: editor = new XMLFieldMappingEditor(reportQueryDialog);
096: }
097:
098: return editor;
099: }
100:
101: }
|