Revize 1db49a97
Přidáno uživatelem Marek Sobota před téměř 6 roky(ů)
src/gui/Window.java | ||
---|---|---|
51 | 51 |
private static final Dimension OUTPUT_WINDOW_MIN_DIM = new Dimension(320, 160); |
52 | 52 |
|
53 | 53 |
/**konstanta pro oznaceni souboru se spoji*/ |
54 |
private static final int SPOJ_FILE = 0;
|
|
54 |
private static final int SEZNAM_LINEK_FILE = 0;
|
|
55 | 55 |
|
56 | 56 |
/**konstanta pro oznaceni slozky JDF*/ |
57 | 57 |
private static final int JDF_DIR = 1; |
... | ... | |
71 | 71 |
/**konstanta pro nazev souboru caskody*/ |
72 | 72 |
private static final String CASKODY = "caskody.txt"; |
73 | 73 |
|
74 |
/**konstanta pro nazev souboru linky*/ |
|
75 |
private static final String LINKY = "linky.txt"; |
|
76 |
|
|
77 | 74 |
/**konstanta pro nazev souboru pevnykod*/ |
78 | 75 |
private static final String PEVNY_KOD = "pevnykod.txt"; |
79 | 76 |
|
... | ... | |
84 | 81 |
public static final DateFormat df = new SimpleDateFormat("yyyy/MM/dd"); |
85 | 82 |
|
86 | 83 |
/**atribut se souborem se spoji*/ |
87 |
private File spojFile = null;
|
|
84 |
private File linkyFile = null;
|
|
88 | 85 |
|
89 | 86 |
/**atribut se slozkou JDF*/ |
90 | 87 |
private File jdfDir = null; |
... | ... | |
117 | 114 |
private JDatePickerImpl datePickerTo; |
118 | 115 |
|
119 | 116 |
/**TextField pro zobrazeni cesty k souboru se spojema*/ |
120 |
private JTextField spojPathTF;
|
|
117 |
private JTextField linkyPathTF;
|
|
121 | 118 |
|
122 | 119 |
/**TextField pro zobrazeni cesty k slozce JDF*/ |
123 | 120 |
private JTextField jdfPathTF; |
... | ... | |
169 | 166 |
JButton spojBT = new JButton("Vybrat spoj soubor"); |
170 | 167 |
JButton jdfBT = new JButton("Vybrat JDF slozku"); |
171 | 168 |
JButton outputBT = new JButton("Vybrat vystupni slozku"); |
172 |
spojPathTF = new JTextField(TEXT_FIELD_LENGTH);
|
|
169 |
linkyPathTF = new JTextField(TEXT_FIELD_LENGTH);
|
|
173 | 170 |
jdfPathTF = new JTextField(TEXT_FIELD_LENGTH); |
174 | 171 |
outputPathTF = new JTextField(TEXT_FIELD_LENGTH); |
175 | 172 |
outputNameTF = new JTextField(TEXT_FIELD_LENGTH); |
... | ... | |
179 | 176 |
initDatePicker(); |
180 | 177 |
|
181 | 178 |
//nastaveni komponent |
182 |
spojPathTF.setEditable(false);
|
|
179 |
linkyPathTF.setEditable(false);
|
|
183 | 180 |
jdfPathTF.setEditable(false); |
184 | 181 |
outputPathTF.setEditable(false); |
185 | 182 |
outputNameTF.setText("Nazev souboru"); |
... | ... | |
201 | 198 |
System.exit(0); |
202 | 199 |
} |
203 | 200 |
}); |
204 |
spojBT.addActionListener(new FileChooserListener(SPOJ_FILE));
|
|
201 |
spojBT.addActionListener(new FileChooserListener(SEZNAM_LINEK_FILE));
|
|
205 | 202 |
jdfBT.addActionListener(new FileChooserListener(JDF_DIR)); |
206 | 203 |
outputBT.addActionListener(new FileChooserListener(OUTPUT_DIR)); |
207 | 204 |
|
... | ... | |
216 | 213 |
dateToP.add(dateToLB); |
217 | 214 |
dateToP.add(datePickerTo); |
218 | 215 |
spojPathP.add(spojPathLB); |
219 |
spojPathP.add(spojPathTF);
|
|
216 |
spojPathP.add(linkyPathTF);
|
|
220 | 217 |
spojPathP.add(spojBT); |
221 | 218 |
jdfPathP.add(jdfPathLB); |
222 | 219 |
jdfPathP.add(jdfPathTF); |
... | ... | |
334 | 331 |
* kontrola jestli jsou obdobi zadana a ve spravnem poradi a jestli jsou cesty vyplněny |
335 | 332 |
*/ |
336 | 333 |
private boolean inputCheck(){ |
337 |
if(spojFile == null || jdfDir == null || outputFile == null){
|
|
334 |
if(linkyFile == null || jdfDir == null || outputFile == null){
|
|
338 | 335 |
JOptionPane.showMessageDialog(null, "Nejsou vybrany potrebne soubory/slozky", |
339 | 336 |
"Varovani", JOptionPane.WARNING_MESSAGE); |
340 | 337 |
return false; |
... | ... | |
400 | 397 |
if(option == JFileChooser.APPROVE_OPTION){ |
401 | 398 |
File selectedFile = fileChooser.getSelectedFile(); |
402 | 399 |
|
403 |
if(selectedFile.isFile() && fileType == SPOJ_FILE && selectedFile.getName().endsWith(".txt")){
|
|
404 |
spojFile = selectedFile;
|
|
405 |
spojPathTF.setText(spojFile.getAbsolutePath());
|
|
400 |
if(selectedFile.isFile() && fileType == SEZNAM_LINEK_FILE && selectedFile.getName().endsWith(".txt")){
|
|
401 |
linkyFile = selectedFile;
|
|
402 |
linkyPathTF.setText(linkyFile.getAbsolutePath());
|
|
406 | 403 |
} |
407 | 404 |
else if(selectedFile.isDirectory() && fileType == JDF_DIR){ |
408 | 405 |
//overi existenci potrebnych souboru ve slozce |
409 | 406 |
File caskody = new File(selectedFile.getAbsolutePath() + File.separator + CASKODY); |
410 |
File linky = new File(selectedFile.getAbsolutePath() + File.separator + LINKY); |
|
411 | 407 |
File pevnyKod = new File(selectedFile.getAbsolutePath() + File.separator + PEVNY_KOD); |
412 | 408 |
File spoje = new File(selectedFile.getAbsolutePath() + File.separator + SPOJE); |
413 | 409 |
if(!caskody.exists()){ |
... | ... | |
415 | 411 |
"Varovani", JOptionPane.WARNING_MESSAGE); |
416 | 412 |
return; |
417 | 413 |
} |
418 |
if(!linky.exists()){ |
|
419 |
JOptionPane.showMessageDialog(null, "Ve slozce se nenachazi soubor " + LINKY, |
|
420 |
"Varovani", JOptionPane.WARNING_MESSAGE); |
|
421 |
return; |
|
422 |
} |
|
423 | 414 |
if(!pevnyKod.exists()){ |
424 | 415 |
JOptionPane.showMessageDialog(null, "Ve slozce se nenachazi soubor " + PEVNY_KOD, |
425 | 416 |
"Varovani", JOptionPane.WARNING_MESSAGE); |
Také k dispozici: Unified diff
Uprava terminologie a odstraneni prebytecnych souboru (Re #7320)