001: /*
002: * EJBQLConnectionEditor.java
003: *
004: * Created on March 27, 2007, 1:18 PM
005: */
006:
007: package it.businesslogic.ireport.connection.gui;
008:
009: import it.businesslogic.ireport.IReportConnection;
010: import it.businesslogic.ireport.IReportConnectionEditor;
011: import it.businesslogic.ireport.connection.JRDataSourceProviderConnection;
012: import it.businesslogic.ireport.util.I18n;
013:
014: /**
015: *
016: * @author gtoffoli
017: */
018: public class JRDataSourceProviderConnectionEditor extends
019: javax.swing.JPanel implements IReportConnectionEditor {
020:
021: private IReportConnection iReportConnection = null;
022: private boolean init = false;
023:
024: /** Creates new form EJBQLConnectionEditor */
025: public JRDataSourceProviderConnectionEditor() {
026: initComponents();
027: applyI18n();
028: }
029:
030: /** This method is called from within the constructor to
031: * initialize the form.
032: * WARNING: Do NOT modify this code. The content of this method is
033: * always regenerated by the Form Editor.
034: */
035: // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
036: private void initComponents() {
037: java.awt.GridBagConstraints gridBagConstraints;
038:
039: jPanelDatasourceProvider = new javax.swing.JPanel();
040: jLabel17 = new javax.swing.JLabel();
041: jTextFieldJRDataSourceProvider = new javax.swing.JTextField();
042:
043: setLayout(new java.awt.BorderLayout());
044:
045: jPanelDatasourceProvider
046: .setLayout(new java.awt.GridBagLayout());
047:
048: jLabel17.setText("JasperReports DataSource Provider class");
049: gridBagConstraints = new java.awt.GridBagConstraints();
050: gridBagConstraints.gridx = 0;
051: gridBagConstraints.gridy = 0;
052: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
053: gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
054: gridBagConstraints.weightx = 1.0;
055: gridBagConstraints.insets = new java.awt.Insets(3, 5, 1, 3);
056: jPanelDatasourceProvider.add(jLabel17, gridBagConstraints);
057:
058: jTextFieldJRDataSourceProvider
059: .setText("it.businesslogic.ireport.examples.PersonBeansDataSource");
060: gridBagConstraints = new java.awt.GridBagConstraints();
061: gridBagConstraints.gridx = 0;
062: gridBagConstraints.gridy = 1;
063: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
064: gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
065: gridBagConstraints.weighty = 1.0;
066: gridBagConstraints.insets = new java.awt.Insets(3, 5, 3, 3);
067: jPanelDatasourceProvider.add(jTextFieldJRDataSourceProvider,
068: gridBagConstraints);
069:
070: add(jPanelDatasourceProvider, java.awt.BorderLayout.CENTER);
071:
072: }// </editor-fold>//GEN-END:initComponents
073:
074: // Variables declaration - do not modify//GEN-BEGIN:variables
075: private javax.swing.JLabel jLabel17;
076: private javax.swing.JPanel jPanelDatasourceProvider;
077: private javax.swing.JTextField jTextFieldJRDataSourceProvider;
078:
079: // End of variables declaration//GEN-END:variables
080:
081: public void setIReportConnection(IReportConnection c) {
082:
083: this .iReportConnection = c;
084: if (iReportConnection instanceof JRDataSourceProviderConnection) {
085: JRDataSourceProviderConnection con = (JRDataSourceProviderConnection) iReportConnection;
086: this .jTextFieldJRDataSourceProvider
087: .setText(it.businesslogic.ireport.util.Misc.nvl(con
088: .getProperties()
089: .get("JRDataSourceProvider"), ""));
090: }
091: }
092:
093: public IReportConnection getIReportConnection() {
094:
095: IReportConnection irConn = new JRDataSourceProviderConnection();
096: ((JRDataSourceProviderConnection) irConn).getProperties().put(
097: "JRDataSourceProvider",
098: this .jTextFieldJRDataSourceProvider.getText().trim());
099: iReportConnection = irConn;
100: return iReportConnection;
101: }
102:
103: public void applyI18n() {
104: jLabel17.setText(I18n.getString("connectionDialog.label17",
105: "JasperReports DataSource Provider class"));
106: }
107:
108: }
|