View Javadoc

1   /*   Copyright (C) 2003 Finalist IT Group
2    *
3    *   This file is part of JAG - the Java J2EE Application Generator
4    *
5    *   JAG is free software; you can redistribute it and/or modify
6    *   it under the terms of the GNU General Public License as published by
7    *   the Free Software Foundation; either version 2 of the License, or
8    *   (at your option) any later version.
9    *   JAG is distributed in the hope that it will be useful,
10   *   but WITHOUT ANY WARRANTY; without even the implied warranty of
11   *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12   *   GNU General Public License for more details.
13   *   You should have received a copy of the GNU General Public License
14   *   along with JAG; if not, write to the Free Software
15   *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16   */
17  package com.finalist.jaggenerator;
18  
19  /***
20   *
21   * @author  hillie
22   */
23  public class ConnectView extends javax.swing.JDialog {
24     private JagGenerator jg;
25  
26  
27     /*** Creates new form DTOGenView */
28     public ConnectView(JagGenerator jg) {
29        this.jg = jg;
30        initComponents();
31        UrlTextField.setText("jdbc:oracle:thin:@192.168.0.60:1521:sample");
32        UsernameTextField.setText("FACTURENONLINE");
33        PasswordTextField.setText("FACTURENONLINE");
34     }
35  
36  
37     public void setUndecorated(boolean val) {
38     }
39  
40  
41     /*** This method is called from within the constructor to
42      * initialize the form.
43      * WARNING: Do NOT modify this code. The content of this method is
44      * always regenerated by the Form Editor.
45      */
46     private void initComponents() {//GEN-BEGIN:initComponents
47        UrlLabel = new javax.swing.JLabel();
48        UsernameLabel = new javax.swing.JLabel();
49        PasswordLabel = new javax.swing.JLabel();
50        UrlTextField = new javax.swing.JTextField();
51        UsernameTextField = new javax.swing.JTextField();
52        PasswordTextField = new javax.swing.JTextField();
53        ConnectButton = new javax.swing.JButton();
54  
55        getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
56  
57        setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
58        setUndecorated(true);
59        addWindowListener(new java.awt.event.WindowAdapter() {
60           public void windowClosing(java.awt.event.WindowEvent evt) {
61              exitForm(evt);
62           }
63        });
64  
65        UrlLabel.setText("Database URL");
66        getContentPane().add(UrlLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 20, 120, -1));
67  
68        UsernameLabel.setText("Username");
69        getContentPane().add(UsernameLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 40, 100, -1));
70  
71        PasswordLabel.setText("Password");
72        getContentPane().add(PasswordLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 60, -1, -1));
73  
74        getContentPane().add(UrlTextField, new org.netbeans.lib.awtextra.AbsoluteConstraints(110, 20, 370, -1));
75  
76        getContentPane().add(UsernameTextField, new org.netbeans.lib.awtextra.AbsoluteConstraints(110, 40, 170, -1));
77  
78        getContentPane().add(PasswordTextField, new org.netbeans.lib.awtextra.AbsoluteConstraints(110, 60, 170, -1));
79  
80        ConnectButton.setText("Connect");
81        ConnectButton.addActionListener(new java.awt.event.ActionListener() {
82           public void actionPerformed(java.awt.event.ActionEvent evt) {
83              ConnectButtonActionPerformed(evt);
84           }
85        });
86  
87        getContentPane().add(ConnectButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(150, 100, -1, -1));
88  
89        pack();
90     }//GEN-END:initComponents
91  
92  
93     private void ConnectButtonActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_ConnectButtonActionPerformed
94     {//GEN-HEADEREND:event_ConnectButtonActionPerformed
95        String url = UrlTextField.getText();
96        String username = UsernameTextField.getText();
97        String password = PasswordTextField.getText();
98        String[] showTableTypes = {"TABLE"};
99        jg.setConManager(
100             new GenericJdbcManager(url, username, password, jg.root.datasource.getDatabase().getDriverClass(), showTableTypes));
101       this.dispose();
102    }//GEN-LAST:event_ConnectButtonActionPerformed
103 
104 
105    /*** Exit the Application */
106    private void exitForm(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_exitForm
107       System.exit(-1);
108    }//GEN-LAST:event_exitForm
109 
110 
111    // Variables declaration - do not modify//GEN-BEGIN:variables
112    private javax.swing.JTextField UrlTextField;
113    private javax.swing.JLabel PasswordLabel;
114    private javax.swing.JTextField UsernameTextField;
115    private javax.swing.JLabel UrlLabel;
116    private javax.swing.JLabel UsernameLabel;
117    private javax.swing.JButton ConnectButton;
118    private javax.swing.JTextField PasswordTextField;
119    // End of variables declaration//GEN-END:variables
120 
121 }