Načítání připojovacích řetězců z proměnných prostředí.
4 * Created on 30.12.2009, 2:22:41
6 package cz.frantovo.abcDrupal.gui;
8 import com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel;
9 import cz.frantovo.abcDrupal.Konvertor;
10 import cz.frantovo.abcDrupal.PosluchacLogu;
11 import cz.frantovo.abcDrupal.PromenneProstredi;
12 import java.util.logging.Level;
13 import java.util.logging.Logger;
14 import javax.swing.UIManager;
15 import javax.swing.UnsupportedLookAndFeelException;
21 public class HlavniOkno extends javax.swing.JFrame implements PosluchacLogu {
23 private static final Logger log = Logger.getLogger(HlavniOkno.class.getName());
25 /** Creates new form HlavniOkno */
28 nactiPromenneProstredi();
31 private void nactiPromenneProstredi() {
32 String zdroj = System.getenv(PromenneProstredi.MIGRACE_ZDROJ.toString());
34 jdbcZdroj.setText(zdroj);
36 String cil = System.getenv(PromenneProstredi.MIGRACE_CIL.toString());
42 /** This method is called from within the constructor to
43 * initialize the form.
44 * WARNING: Do NOT modify this code. The content of this method is
45 * always regenerated by the Form Editor.
47 @SuppressWarnings("unchecked")
48 // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
49 private void initComponents() {
51 jLabel1 = new javax.swing.JLabel();
52 jLabel2 = new javax.swing.JLabel();
53 jdbcZdroj = new javax.swing.JTextField();
54 jdbcCil = new javax.swing.JTextField();
55 jScrollPane1 = new javax.swing.JScrollPane();
56 vystup = new javax.swing.JTextArea();
57 jButton1 = new javax.swing.JButton();
59 setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
60 setTitle("ABC-Drupal");
62 jLabel1.setText("Zdroj");
64 jLabel2.setText("Cíl");
66 jdbcZdroj.setText("jdbcZdroj");
68 jdbcCil.setText("jdbcCil");
70 vystup.setColumns(20);
71 vystup.setEditable(false);
73 vystup.setEnabled(false);
74 jScrollPane1.setViewportView(vystup);
76 jButton1.setText("Nahrát data");
77 jButton1.addActionListener(new java.awt.event.ActionListener() {
78 public void actionPerformed(java.awt.event.ActionEvent evt) {
79 jButton1ActionPerformed(evt);
83 javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
84 getContentPane().setLayout(layout);
85 layout.setHorizontalGroup(
86 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
87 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
89 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
90 .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 599, Short.MAX_VALUE)
91 .addGroup(layout.createSequentialGroup()
92 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
93 .addComponent(jLabel1)
94 .addComponent(jLabel2))
95 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
96 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
97 .addComponent(jdbcCil, javax.swing.GroupLayout.DEFAULT_SIZE, 560, Short.MAX_VALUE)
98 .addComponent(jdbcZdroj, javax.swing.GroupLayout.DEFAULT_SIZE, 560, Short.MAX_VALUE)))
99 .addComponent(jButton1))
102 layout.setVerticalGroup(
103 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
104 .addGroup(layout.createSequentialGroup()
106 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
107 .addComponent(jLabel1)
108 .addComponent(jdbcZdroj, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
109 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
110 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
111 .addComponent(jdbcCil, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
112 .addComponent(jLabel2))
113 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
114 .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 152, Short.MAX_VALUE)
115 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
116 .addComponent(jButton1)
121 }// </editor-fold>//GEN-END:initComponents
123 private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
124 Konvertor k = new Konvertor(jdbcZdroj.getText(), jdbcCil.getText(), this);
126 }//GEN-LAST:event_jButton1ActionPerformed
129 * @param args the command line arguments
131 public static void main(String args[]) {
134 java.awt.EventQueue.invokeLater(new Runnable() {
137 new HlavniOkno().setVisible(true);
142 private static void nastavLaF() {
144 UIManager.setLookAndFeel(new NimbusLookAndFeel());
145 } catch (UnsupportedLookAndFeelException e) {
146 log.log(Level.FINE, "Nepodařilo se načíst LaF. Nevadí.");
149 // Variables declaration - do not modify//GEN-BEGIN:variables
150 private javax.swing.JButton jButton1;
151 private javax.swing.JLabel jLabel1;
152 private javax.swing.JLabel jLabel2;
153 private javax.swing.JScrollPane jScrollPane1;
154 private javax.swing.JTextField jdbcCil;
155 private javax.swing.JTextField jdbcZdroj;
156 private javax.swing.JTextArea vystup;
157 // End of variables declaration//GEN-END:variables
159 public void vypis(String zprava) {
160 vystup.append(zprava + "\n");