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.JREmptyDatasourceConnection;
012: import it.businesslogic.ireport.util.I18n;
013:
014: /**
015: *
016: * @author gtoffoli
017: */
018: public class JREmptyDataSourceConnectionEditor 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 JREmptyDataSourceConnectionEditor() {
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: jPanelEmptyDataSource = new javax.swing.JPanel();
040: jLabel24 = new javax.swing.JLabel();
041: jSpinnerNumRecords = new javax.swing.JSpinner();
042:
043: setLayout(new java.awt.BorderLayout());
044:
045: jPanelEmptyDataSource.setLayout(new java.awt.GridBagLayout());
046:
047: jLabel24
048: .setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
049: jLabel24.setText("Number of empty records");
050: gridBagConstraints = new java.awt.GridBagConstraints();
051: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
052: gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
053: gridBagConstraints.weighty = 1.0;
054: gridBagConstraints.insets = new java.awt.Insets(16, 20, 0, 4);
055: jPanelEmptyDataSource.add(jLabel24, gridBagConstraints);
056:
057: jSpinnerNumRecords.setPreferredSize(new java.awt.Dimension(70,
058: 18));
059: gridBagConstraints = new java.awt.GridBagConstraints();
060: gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
061: gridBagConstraints.weightx = 1.0;
062: gridBagConstraints.weighty = 1.0;
063: gridBagConstraints.insets = new java.awt.Insets(14, 0, 0, 20);
064: jPanelEmptyDataSource.add(jSpinnerNumRecords,
065: gridBagConstraints);
066:
067: add(jPanelEmptyDataSource, java.awt.BorderLayout.CENTER);
068:
069: }// </editor-fold>//GEN-END:initComponents
070:
071: // Variables declaration - do not modify//GEN-BEGIN:variables
072: private javax.swing.JLabel jLabel24;
073: private javax.swing.JPanel jPanelEmptyDataSource;
074: private javax.swing.JSpinner jSpinnerNumRecords;
075:
076: // End of variables declaration//GEN-END:variables
077:
078: public void setIReportConnection(IReportConnection c) {
079:
080: this .iReportConnection = c;
081: if (iReportConnection instanceof JREmptyDatasourceConnection) {
082: JREmptyDatasourceConnection con = (JREmptyDatasourceConnection) iReportConnection;
083: jSpinnerNumRecords.getModel().setValue(
084: new Integer(con.getRecords()));
085: }
086: }
087:
088: public IReportConnection getIReportConnection() {
089:
090: IReportConnection irConn = new JREmptyDatasourceConnection();
091:
092: ((JREmptyDatasourceConnection) irConn)
093: .setRecords(((javax.swing.SpinnerNumberModel) jSpinnerNumRecords
094: .getModel()).getNumber().intValue());
095: iReportConnection = irConn;
096: return iReportConnection;
097: }
098:
099: public void applyI18n() {
100: // Start autogenerated code ----------------------
101: jLabel24.setText(I18n.getString("connectionDialog.label24",
102: "Number of empty records"));
103: }
104:
105: }
|