franta-hg@0
|
1 |
/*
|
franta-hg@0
|
2 |
* HlavniOkno.java
|
franta-hg@0
|
3 |
*
|
franta-hg@0
|
4 |
* Created on 30.12.2009, 2:22:41
|
franta-hg@0
|
5 |
*/
|
franta-hg@0
|
6 |
package cz.frantovo.abcDrupal.gui;
|
franta-hg@0
|
7 |
|
franta-hg@0
|
8 |
import com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel;
|
franta-hg@2
|
9 |
import cz.frantovo.abcDrupal.Konvertor;
|
franta-hg@2
|
10 |
import cz.frantovo.abcDrupal.PosluchacLogu;
|
franta-hg@3
|
11 |
import cz.frantovo.abcDrupal.PromenneProstredi;
|
franta-hg@0
|
12 |
import java.util.logging.Level;
|
franta-hg@0
|
13 |
import java.util.logging.Logger;
|
franta-hg@0
|
14 |
import javax.swing.UIManager;
|
franta-hg@0
|
15 |
import javax.swing.UnsupportedLookAndFeelException;
|
franta-hg@0
|
16 |
|
franta-hg@0
|
17 |
/**
|
franta-hg@0
|
18 |
*
|
franta-hg@0
|
19 |
* @author fiki
|
franta-hg@0
|
20 |
*/
|
franta-hg@2
|
21 |
public class HlavniOkno extends javax.swing.JFrame implements PosluchacLogu {
|
franta-hg@0
|
22 |
|
franta-hg@0
|
23 |
private static final Logger log = Logger.getLogger(HlavniOkno.class.getName());
|
franta-hg@0
|
24 |
|
franta-hg@0
|
25 |
/** Creates new form HlavniOkno */
|
franta-hg@0
|
26 |
public HlavniOkno() {
|
franta-hg@0
|
27 |
initComponents();
|
franta-hg@4
|
28 |
setLocationRelativeTo(null);
|
franta-hg@3
|
29 |
nactiPromenneProstredi();
|
franta-hg@3
|
30 |
}
|
franta-hg@3
|
31 |
|
franta-hg@3
|
32 |
private void nactiPromenneProstredi() {
|
franta-hg@3
|
33 |
String zdroj = System.getenv(PromenneProstredi.MIGRACE_ZDROJ.toString());
|
franta-hg@3
|
34 |
if (zdroj != null) {
|
franta-hg@3
|
35 |
jdbcZdroj.setText(zdroj);
|
franta-hg@3
|
36 |
}
|
franta-hg@3
|
37 |
String cil = System.getenv(PromenneProstredi.MIGRACE_CIL.toString());
|
franta-hg@3
|
38 |
if (cil != null) {
|
franta-hg@3
|
39 |
jdbcCil.setText(cil);
|
franta-hg@3
|
40 |
}
|
franta-hg@0
|
41 |
}
|
franta-hg@0
|
42 |
|
franta-hg@0
|
43 |
/** This method is called from within the constructor to
|
franta-hg@0
|
44 |
* initialize the form.
|
franta-hg@0
|
45 |
* WARNING: Do NOT modify this code. The content of this method is
|
franta-hg@0
|
46 |
* always regenerated by the Form Editor.
|
franta-hg@0
|
47 |
*/
|
franta-hg@0
|
48 |
@SuppressWarnings("unchecked")
|
franta-hg@0
|
49 |
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
franta-hg@0
|
50 |
private void initComponents() {
|
franta-hg@0
|
51 |
|
franta-hg@2
|
52 |
jLabel1 = new javax.swing.JLabel();
|
franta-hg@2
|
53 |
jLabel2 = new javax.swing.JLabel();
|
franta-hg@2
|
54 |
jdbcZdroj = new javax.swing.JTextField();
|
franta-hg@2
|
55 |
jdbcCil = new javax.swing.JTextField();
|
franta-hg@2
|
56 |
jScrollPane1 = new javax.swing.JScrollPane();
|
franta-hg@2
|
57 |
vystup = new javax.swing.JTextArea();
|
franta-hg@4
|
58 |
nahratData = new javax.swing.JButton();
|
franta-hg@0
|
59 |
|
franta-hg@0
|
60 |
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
|
franta-hg@2
|
61 |
setTitle("ABC-Drupal");
|
franta-hg@0
|
62 |
|
franta-hg@2
|
63 |
jLabel1.setText("Zdroj");
|
franta-hg@0
|
64 |
|
franta-hg@2
|
65 |
jLabel2.setText("Cíl");
|
franta-hg@2
|
66 |
|
franta-hg@4
|
67 |
jdbcZdroj.setText("jdbc:mysql://127.0.0.1:3306/itbiz?user=itbiz&password=nbusr123");
|
franta-hg@2
|
68 |
|
franta-hg@4
|
69 |
jdbcCil.setText("jdbc:mysql://127.0.0.1:3306/abclinuxu?user=abclinuxu&password=nbusr123");
|
franta-hg@2
|
70 |
|
franta-hg@2
|
71 |
vystup.setColumns(20);
|
franta-hg@2
|
72 |
vystup.setEditable(false);
|
franta-hg@2
|
73 |
vystup.setRows(5);
|
franta-hg@2
|
74 |
vystup.setEnabled(false);
|
franta-hg@2
|
75 |
jScrollPane1.setViewportView(vystup);
|
franta-hg@2
|
76 |
|
franta-hg@4
|
77 |
nahratData.setText("Nahrát data");
|
franta-hg@5
|
78 |
nahratData.addMouseWheelListener(new java.awt.event.MouseWheelListener() {
|
franta-hg@5
|
79 |
public void mouseWheelMoved(java.awt.event.MouseWheelEvent evt) {
|
franta-hg@5
|
80 |
nahratDataMouseWheelMoved(evt);
|
franta-hg@5
|
81 |
}
|
franta-hg@5
|
82 |
});
|
franta-hg@4
|
83 |
nahratData.addActionListener(new java.awt.event.ActionListener() {
|
franta-hg@2
|
84 |
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
franta-hg@4
|
85 |
nahratDataActionPerformed(evt);
|
franta-hg@2
|
86 |
}
|
franta-hg@2
|
87 |
});
|
franta-hg@0
|
88 |
|
franta-hg@0
|
89 |
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
franta-hg@0
|
90 |
getContentPane().setLayout(layout);
|
franta-hg@0
|
91 |
layout.setHorizontalGroup(
|
franta-hg@0
|
92 |
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
franta-hg@2
|
93 |
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
franta-hg@0
|
94 |
.addContainerGap()
|
franta-hg@2
|
95 |
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
franta-hg@2
|
96 |
.addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 599, Short.MAX_VALUE)
|
franta-hg@2
|
97 |
.addGroup(layout.createSequentialGroup()
|
franta-hg@2
|
98 |
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
franta-hg@2
|
99 |
.addComponent(jLabel1)
|
franta-hg@2
|
100 |
.addComponent(jLabel2))
|
franta-hg@2
|
101 |
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
franta-hg@2
|
102 |
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
franta-hg@2
|
103 |
.addComponent(jdbcCil, javax.swing.GroupLayout.DEFAULT_SIZE, 560, Short.MAX_VALUE)
|
franta-hg@2
|
104 |
.addComponent(jdbcZdroj, javax.swing.GroupLayout.DEFAULT_SIZE, 560, Short.MAX_VALUE)))
|
franta-hg@4
|
105 |
.addComponent(nahratData))
|
franta-hg@0
|
106 |
.addContainerGap())
|
franta-hg@0
|
107 |
);
|
franta-hg@0
|
108 |
layout.setVerticalGroup(
|
franta-hg@0
|
109 |
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
franta-hg@2
|
110 |
.addGroup(layout.createSequentialGroup()
|
franta-hg@0
|
111 |
.addContainerGap()
|
franta-hg@2
|
112 |
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
franta-hg@2
|
113 |
.addComponent(jLabel1)
|
franta-hg@2
|
114 |
.addComponent(jdbcZdroj, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
franta-hg@2
|
115 |
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
franta-hg@2
|
116 |
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
franta-hg@2
|
117 |
.addComponent(jdbcCil, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
franta-hg@2
|
118 |
.addComponent(jLabel2))
|
franta-hg@2
|
119 |
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
franta-hg@2
|
120 |
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 152, Short.MAX_VALUE)
|
franta-hg@2
|
121 |
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
franta-hg@4
|
122 |
.addComponent(nahratData)
|
franta-hg@0
|
123 |
.addContainerGap())
|
franta-hg@0
|
124 |
);
|
franta-hg@0
|
125 |
|
franta-hg@0
|
126 |
pack();
|
franta-hg@0
|
127 |
}// </editor-fold>//GEN-END:initComponents
|
franta-hg@0
|
128 |
|
franta-hg@4
|
129 |
private void nahratDataActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_nahratDataActionPerformed
|
franta-hg@2
|
130 |
Konvertor k = new Konvertor(jdbcZdroj.getText(), jdbcCil.getText(), this);
|
franta-hg@5
|
131 |
nahratData.setEnabled(false);
|
franta-hg@5
|
132 |
nahratData.setToolTipText("Pokud chcete spustit migraci ještě jednou, pootočte kolečkem myši :-)");
|
franta-hg@2
|
133 |
k.konvertuj();
|
franta-hg@4
|
134 |
}//GEN-LAST:event_nahratDataActionPerformed
|
franta-hg@2
|
135 |
|
franta-hg@5
|
136 |
private void nahratDataMouseWheelMoved(java.awt.event.MouseWheelEvent evt) {//GEN-FIRST:event_nahratDataMouseWheelMoved
|
franta-hg@5
|
137 |
nahratData.setEnabled(true);
|
franta-hg@5
|
138 |
nahratData.setToolTipText(null);
|
franta-hg@5
|
139 |
}//GEN-LAST:event_nahratDataMouseWheelMoved
|
franta-hg@5
|
140 |
|
franta-hg@0
|
141 |
/**
|
franta-hg@0
|
142 |
* @param args the command line arguments
|
franta-hg@0
|
143 |
*/
|
franta-hg@0
|
144 |
public static void main(String args[]) {
|
franta-hg@0
|
145 |
nastavLaF();
|
franta-hg@0
|
146 |
|
franta-hg@0
|
147 |
java.awt.EventQueue.invokeLater(new Runnable() {
|
franta-hg@0
|
148 |
|
franta-hg@0
|
149 |
public void run() {
|
franta-hg@0
|
150 |
new HlavniOkno().setVisible(true);
|
franta-hg@0
|
151 |
}
|
franta-hg@0
|
152 |
});
|
franta-hg@0
|
153 |
}
|
franta-hg@0
|
154 |
|
franta-hg@0
|
155 |
private static void nastavLaF() {
|
franta-hg@0
|
156 |
try {
|
franta-hg@0
|
157 |
UIManager.setLookAndFeel(new NimbusLookAndFeel());
|
franta-hg@0
|
158 |
} catch (UnsupportedLookAndFeelException e) {
|
franta-hg@0
|
159 |
log.log(Level.FINE, "Nepodařilo se načíst LaF. Nevadí.");
|
franta-hg@0
|
160 |
}
|
franta-hg@0
|
161 |
}
|
franta-hg@0
|
162 |
// Variables declaration - do not modify//GEN-BEGIN:variables
|
franta-hg@2
|
163 |
private javax.swing.JLabel jLabel1;
|
franta-hg@2
|
164 |
private javax.swing.JLabel jLabel2;
|
franta-hg@2
|
165 |
private javax.swing.JScrollPane jScrollPane1;
|
franta-hg@2
|
166 |
private javax.swing.JTextField jdbcCil;
|
franta-hg@2
|
167 |
private javax.swing.JTextField jdbcZdroj;
|
franta-hg@4
|
168 |
private javax.swing.JButton nahratData;
|
franta-hg@2
|
169 |
private javax.swing.JTextArea vystup;
|
franta-hg@0
|
170 |
// End of variables declaration//GEN-END:variables
|
franta-hg@2
|
171 |
|
franta-hg@2
|
172 |
public void vypis(String zprava) {
|
franta-hg@2
|
173 |
vystup.append(zprava + "\n");
|
franta-hg@2
|
174 |
}
|
franta-hg@0
|
175 |
}
|