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.connection.EJBQLConnection;
011: import it.businesslogic.ireport.IReportConnectionEditor;
012: import it.businesslogic.ireport.connection.JRSpringLoadedHibernateConnection;
013: import it.businesslogic.ireport.util.I18n;
014:
015: /**
016: *
017: * @author gtoffoli
018: */
019: public class JRSpringLoadedHibernateConnectionEditor extends
020: javax.swing.JPanel implements IReportConnectionEditor {
021:
022: private IReportConnection iReportConnection = null;
023: private boolean init = false;
024:
025: /** Creates new form EJBQLConnectionEditor */
026: public JRSpringLoadedHibernateConnectionEditor() {
027: initComponents();
028: applyI18n();
029: }
030:
031: /** This method is called from within the constructor to
032: * initialize the form.
033: * WARNING: Do NOT modify this code. The content of this method is
034: * always regenerated by the Form Editor.
035: */
036: // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
037: private void initComponents() {
038: java.awt.GridBagConstraints gridBagConstraints;
039:
040: jPanelSpringLoadedHibernate = new javax.swing.JPanel();
041: jLabel21 = new javax.swing.JLabel();
042: jTextFieldSLHSpringConfig = new javax.swing.JTextField();
043: jLabel22 = new javax.swing.JLabel();
044: jTextFieldSLHSessionFactory = new javax.swing.JTextField();
045: jLabel16 = new javax.swing.JLabel();
046:
047: setLayout(new java.awt.BorderLayout());
048:
049: jPanelSpringLoadedHibernate
050: .setLayout(new java.awt.GridBagLayout());
051:
052: jLabel21.setText("Spring configuration");
053: gridBagConstraints = new java.awt.GridBagConstraints();
054: gridBagConstraints.gridx = 0;
055: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
056: gridBagConstraints.insets = new java.awt.Insets(4, 4, 0, 4);
057: jPanelSpringLoadedHibernate.add(jLabel21, gridBagConstraints);
058:
059: gridBagConstraints = new java.awt.GridBagConstraints();
060: gridBagConstraints.gridx = 0;
061: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
062: gridBagConstraints.insets = new java.awt.Insets(2, 4, 4, 4);
063: jPanelSpringLoadedHibernate.add(jTextFieldSLHSpringConfig,
064: gridBagConstraints);
065:
066: jLabel22.setText("Session Factory Bean ID");
067: gridBagConstraints = new java.awt.GridBagConstraints();
068: gridBagConstraints.gridx = 0;
069: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
070: gridBagConstraints.insets = new java.awt.Insets(4, 4, 0, 4);
071: jPanelSpringLoadedHibernate.add(jLabel22, gridBagConstraints);
072:
073: gridBagConstraints = new java.awt.GridBagConstraints();
074: gridBagConstraints.gridx = 0;
075: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
076: gridBagConstraints.insets = new java.awt.Insets(2, 4, 4, 4);
077: jPanelSpringLoadedHibernate.add(jTextFieldSLHSessionFactory,
078: gridBagConstraints);
079:
080: jLabel16
081: .setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
082: jLabel16
083: .setIcon(new javax.swing.ImageIcon(
084: getClass()
085: .getResource(
086: "/it/businesslogic/ireport/icons/hibernate.png")));
087: jLabel16
088: .setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);
089: jLabel16
090: .setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
091: gridBagConstraints = new java.awt.GridBagConstraints();
092: gridBagConstraints.gridx = 0;
093: gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
094: gridBagConstraints.weightx = 1.0;
095: gridBagConstraints.weighty = 1.0;
096: jPanelSpringLoadedHibernate.add(jLabel16, gridBagConstraints);
097:
098: add(jPanelSpringLoadedHibernate, java.awt.BorderLayout.CENTER);
099:
100: }// </editor-fold>//GEN-END:initComponents
101:
102: // Variables declaration - do not modify//GEN-BEGIN:variables
103: private javax.swing.JLabel jLabel16;
104: private javax.swing.JLabel jLabel21;
105: private javax.swing.JLabel jLabel22;
106: private javax.swing.JPanel jPanelSpringLoadedHibernate;
107: private javax.swing.JTextField jTextFieldSLHSessionFactory;
108: private javax.swing.JTextField jTextFieldSLHSpringConfig;
109:
110: // End of variables declaration//GEN-END:variables
111:
112: public void setIReportConnection(IReportConnection c) {
113:
114: this .iReportConnection = c;
115: if (iReportConnection instanceof JRSpringLoadedHibernateConnection) {
116: this .jTextFieldSLHSpringConfig
117: .setText(((JRSpringLoadedHibernateConnection) iReportConnection)
118: .getSpringConfig());
119: this .jTextFieldSLHSessionFactory
120: .setText(((JRSpringLoadedHibernateConnection) iReportConnection)
121: .getSessionFactoryBeanId());
122: }
123: }
124:
125: public IReportConnection getIReportConnection() {
126:
127: IReportConnection irConn = new JRSpringLoadedHibernateConnection();
128: ((JRSpringLoadedHibernateConnection) irConn)
129: .setSessionFactoryBeanId(jTextFieldSLHSessionFactory
130: .getText());
131: ((JRSpringLoadedHibernateConnection) irConn)
132: .setSpringConfig(jTextFieldSLHSpringConfig.getText());
133:
134: iReportConnection = irConn;
135: return iReportConnection;
136: }
137:
138: public void applyI18n() {
139:
140: jLabel21.setText(I18n.getString("connectionDialog.label21",
141: "Spring configuration"));
142: jLabel22.setText(I18n.getString("connectionDialog.label22",
143: "Session Factory Bean ID"));
144:
145: }
146:
147: }
|