001: package org.apache.ojb.tools.mapping.reversedb.gui;
002:
003: /* Copyright 2002-2005 The Apache Software Foundation
004: *
005: * Licensed under the Apache License, Version 2.0 (the "License");
006: * you may not use this file except in compliance with the License.
007: * You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017:
018: /**
019: *
020: * @author <a href="mailto:bfl@florianbruckner.com">Florian Bruckner</a>
021: * @version $Id: JDlgDBConnection.java,v 1.1.2.1 2005/12/21 22:32:02 tomdz Exp $
022: */
023: public class JDlgDBConnection extends javax.swing.JDialog {
024:
025: JFrmMainFrame mainFrame;
026:
027: /** Creates new form JDlgDBConnection */
028: public JDlgDBConnection(java.awt.Frame parent, boolean modal,
029: JFrmMainFrame aMain) {
030: super (parent, modal);
031: initComponents();
032: mainFrame = aMain;
033: this .tfJDBCDriver.setText(mainFrame.getProperty(
034: JFrmMainFrame.JDBC_DRIVER, ""));
035: this .tfJDBCURL.setText(mainFrame.getProperty(
036: JFrmMainFrame.JDBC_URL, ""));
037: this .tfUsername.setText(mainFrame.getProperty(
038: JFrmMainFrame.JDBC_USER, ""));
039: this .tfPassword.setText(mainFrame.getProperty(
040: JFrmMainFrame.JDBC_PASSWORD, ""));
041: }
042:
043: /** This method is called from within the constructor to
044: * initialize the form.
045: * WARNING: Do NOT modify this code. The content of this method is
046: * always regenerated by the Form Editor.
047: */
048: private void initComponents()//GEN-BEGIN:initComponents
049: {
050: java.awt.GridBagConstraints gridBagConstraints;
051:
052: lblJDBCDriver = new javax.swing.JLabel();
053: tfJDBCDriver = new javax.swing.JTextField();
054: lblJDBCURL = new javax.swing.JLabel();
055: tfJDBCURL = new javax.swing.JTextField();
056: lblUsername = new javax.swing.JLabel();
057: tfUsername = new javax.swing.JTextField();
058: lblPassword = new javax.swing.JLabel();
059: tfPassword = new javax.swing.JPasswordField();
060: jPanel1 = new javax.swing.JPanel();
061: pbCancel = new javax.swing.JButton();
062: pbConnect = new javax.swing.JButton();
063:
064: getContentPane().setLayout(new java.awt.GridBagLayout());
065:
066: addWindowListener(new java.awt.event.WindowAdapter() {
067: public void windowClosing(java.awt.event.WindowEvent evt) {
068: closeDialog(evt);
069: }
070: });
071:
072: lblJDBCDriver.setText("JDBC Driver Class:");
073: lblJDBCDriver.setLabelFor(tfJDBCDriver);
074: gridBagConstraints = new java.awt.GridBagConstraints();
075: gridBagConstraints.gridx = 0;
076: gridBagConstraints.gridy = 0;
077: gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
078: getContentPane().add(lblJDBCDriver, gridBagConstraints);
079:
080: tfJDBCDriver.setText("jTextField1");
081: gridBagConstraints = new java.awt.GridBagConstraints();
082: gridBagConstraints.gridx = 1;
083: gridBagConstraints.gridy = 0;
084: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
085: gridBagConstraints.weightx = 1.0;
086: getContentPane().add(tfJDBCDriver, gridBagConstraints);
087:
088: lblJDBCURL.setText("JDBC URL:");
089: gridBagConstraints = new java.awt.GridBagConstraints();
090: gridBagConstraints.gridx = 0;
091: gridBagConstraints.gridy = 1;
092: gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
093: getContentPane().add(lblJDBCURL, gridBagConstraints);
094:
095: tfJDBCURL.setColumns(40);
096: tfJDBCURL.setText("jTextField2");
097: gridBagConstraints = new java.awt.GridBagConstraints();
098: gridBagConstraints.gridx = 1;
099: gridBagConstraints.gridy = 1;
100: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
101: gridBagConstraints.weightx = 1.0;
102: getContentPane().add(tfJDBCURL, gridBagConstraints);
103:
104: lblUsername.setText("Username:");
105: gridBagConstraints = new java.awt.GridBagConstraints();
106: gridBagConstraints.gridx = 0;
107: gridBagConstraints.gridy = 2;
108: gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
109: getContentPane().add(lblUsername, gridBagConstraints);
110:
111: tfUsername.setText("jTextField3");
112: gridBagConstraints = new java.awt.GridBagConstraints();
113: gridBagConstraints.gridx = 1;
114: gridBagConstraints.gridy = 2;
115: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
116: gridBagConstraints.weightx = 1.0;
117: getContentPane().add(tfUsername, gridBagConstraints);
118:
119: lblPassword.setText("Password:");
120: gridBagConstraints = new java.awt.GridBagConstraints();
121: gridBagConstraints.gridx = 0;
122: gridBagConstraints.gridy = 3;
123: gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
124: getContentPane().add(lblPassword, gridBagConstraints);
125:
126: gridBagConstraints = new java.awt.GridBagConstraints();
127: gridBagConstraints.gridx = 1;
128: gridBagConstraints.gridy = 3;
129: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
130: gridBagConstraints.weightx = 1.0;
131: getContentPane().add(tfPassword, gridBagConstraints);
132:
133: pbCancel.setText("Cancel");
134: pbCancel.addActionListener(new java.awt.event.ActionListener() {
135: public void actionPerformed(java.awt.event.ActionEvent evt) {
136: pbCancelActionPerformed(evt);
137: }
138: });
139:
140: jPanel1.add(pbCancel);
141:
142: pbConnect.setText("Connect");
143: pbConnect
144: .addActionListener(new java.awt.event.ActionListener() {
145: public void actionPerformed(
146: java.awt.event.ActionEvent evt) {
147: pbConnectActionPerformed(evt);
148: }
149: });
150:
151: jPanel1.add(pbConnect);
152:
153: gridBagConstraints = new java.awt.GridBagConstraints();
154: gridBagConstraints.gridx = 1;
155: gridBagConstraints.gridy = 4;
156: gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
157: getContentPane().add(jPanel1, gridBagConstraints);
158:
159: pack();
160: }//GEN-END:initComponents
161:
162: private void pbCancelActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_pbCancelActionPerformed
163: {//GEN-HEADEREND:event_pbCancelActionPerformed
164: // Add your handling code here:
165: dispose();
166: }//GEN-LAST:event_pbCancelActionPerformed
167:
168: private void pbConnectActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_pbConnectActionPerformed
169: {//GEN-HEADEREND:event_pbConnectActionPerformed
170: // Add your handling code here:
171: mainFrame.setProperty(JFrmMainFrame.JDBC_DRIVER, tfJDBCDriver
172: .getText());
173: mainFrame.setProperty(JFrmMainFrame.JDBC_URL, tfJDBCURL
174: .getText());
175: mainFrame.setProperty(JFrmMainFrame.JDBC_USER, tfUsername
176: .getText());
177: mainFrame.setProperty(JFrmMainFrame.JDBC_PASSWORD, new String(
178: this .tfPassword.getPassword()));
179: new org.apache.ojb.tools.mapping.reversedb.gui.actions.DBConnectAction(
180: mainFrame).actionPerformed(null);
181: dispose();
182: }//GEN-LAST:event_pbConnectActionPerformed
183:
184: /** Closes the dialog */
185: private void closeDialog(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_closeDialog
186: setVisible(false);
187: dispose();
188: }//GEN-LAST:event_closeDialog
189:
190: /**
191: * @param args the command line arguments
192: */
193: public static void main(String args[]) {
194: // new JDlgDBConnection(new javax.swing.JFrame(), true).show();
195: }
196:
197: // Variables declaration - do not modify//GEN-BEGIN:variables
198: private javax.swing.JLabel lblJDBCURL;
199: private javax.swing.JLabel lblJDBCDriver;
200: private javax.swing.JPanel jPanel1;
201: private javax.swing.JTextField tfJDBCDriver;
202: private javax.swing.JLabel lblPassword;
203: private javax.swing.JPasswordField tfPassword;
204: private javax.swing.JLabel lblUsername;
205: private javax.swing.JTextField tfUsername;
206: private javax.swing.JButton pbConnect;
207: private javax.swing.JButton pbCancel;
208: private javax.swing.JTextField tfJDBCURL;
209: // End of variables declaration//GEN-END:variables
210:
211: }
212:
213: /***************************** Changelog *****************************
214: // $Log: JDlgDBConnection.java,v $
215: // Revision 1.1.2.1 2005/12/21 22:32:02 tomdz
216: // Updated license
217: //
218: // Revision 1.1 2004/05/05 16:38:49 arminw
219: // fix fault
220: // wrong package structure used:
221: // org.apache.ojb.tools.reversdb
222: // org.apache.ojb.tools.reversdb2
223: //
224: // instead of
225: // org.apache.ojb.tools.mapping.reversdb
226: // org.apache.ojb.tools.mapping.reversdb2
227: //
228: // Revision 1.1 2004/05/04 13:44:59 arminw
229: // move reverseDB stuff
230: //
231: // Revision 1.6 2004/04/05 12:16:23 tomdz
232: // Fixed/updated license in files leftover from automatic license transition
233: //
234: // Revision 1.5 2004/04/04 23:53:42 brianm
235: // Fixed initial copyright dates to match cvs repository
236: //
237: // Revision 1.4 2004/03/11 18:16:22 brianm
238: // ASL 2.0
239: //
240: // Revision 1.3 2002/06/18 12:26:41 florianbruckner
241: // changes in Netbeans Form definitions after move to jakarta.
242: //
243: // Revision 1.2 2002/06/17 19:34:34 jvanzyl
244: // Correcting all the package references.
245: // PR:
246: // Obtained from:
247: // Submitted by:
248: // Reviewed by:
249: //
250: // Revision 1.1.1.1 2002/06/17 18:16:54 jvanzyl
251: // Initial OJB import
252: //
253: // Revision 1.2 2002/05/16 11:47:09 florianbruckner
254: // fix CR/LF issue, change license to ASL
255: //
256: // Revision 1.1 2002/04/18 11:44:16 mpoeschl
257: //
258: // move files to new location
259: //
260: // Revision 1.3 2002/04/07 09:05:17 thma
261: // *** empty log message ***
262: //
263: // Revision 1.2 2002/03/11 17:36:26 florianbruckner
264: // fix line break issue for these files that were previously checked in with -kb
265: //
266: // Revision 1.1 2002/03/04 17:19:32 thma
267: // initial checking for Florians Reverse engineering tool
268: //
269: // Revision 1.1.1.1 2002/02/20 13:35:25 Administrator
270: // initial import
271: //
272: /***************************** Changelog *****************************/
|