Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: javatools/swing/DBMSSpecificationPanel.java


1   /*
2    * DBMSSpecificationPanel.java
3    *
4    * Created on 13 gennaio 2002, 19.47
5       Javatools (modified version) - Some useful general classes.
6       Copyright (C) 2002-2003  Chris Bitmead (original) Antonio Petrelli (modified)
7   
8       This program is free software; you can redistribute it and/or modify
9       it under the terms of the GNU General Public License as published by
10      the Free Software Foundation; either version 2 of the License, or
11      (at your option) any later version.
12  
13      This program is distributed in the hope that it will be useful,
14      but WITHOUT ANY WARRANTY; without even the implied warranty of
15      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16      GNU General Public License for more details.
17  
18      You should have received a copy of the GNU General Public License
19      along with this program; if not, write to the Free Software
20      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
21  
22      Contact me at: brenmcguire@users.sourceforge.net
23   */
24  
25  package javatools.swing;
26  
27  import java.lang.*;
28  import java.util.*;
29  import javatools.util.ScriptCatcher;
30  import javatools.util.Props;
31  import java.awt.Dimension;
32  import java.io.*;
33  
34  /** This panel is used to show DBMS specifications, just like DBMS name, address
35   * and TCP/IP port.
36   * @author Antonio Petrelli
37   * @version 0.2.0
38   */
39  public class DBMSSpecificationPanel extends javatools.swing.InputPanel {
40      
41      /** Creates new form DBMSSpecificationPanel */
42      public DBMSSpecificationPanel() {
43          javatoolsBundle = java.util.ResourceBundle.getBundle("res/JavatoolsBundle");
44          initComponents();
45          listData = new Vector();
46          tccPort = new PositiveTCChecker();
47          tccAddress = new NoSpacesTCChecker();
48          tccPort.setRefTextComponent(txtPort);
49          tccAddress.setRefTextComponent(txtAddress);
50          dbmsDescriptions = new LinkedList();
51      }
52      
53      /** Returns the number of managed values.
54       * @return Returns 5.
55       */    
56      public int getNumValues() {
57          return 8;
58      }
59      
60      /** Returns the value at a certain position.
61       * @param numValue <CODE>0</CODE>: The filename containing the list of managed DBMSs.
62       * <CODE>1</CODE>: The properties filename containing information about DBMS names and descriptions filenames (See the "HOW TO USE" file).
63       * <CODE>2</CODE>: The selected DBMS.
64       * <CODE>3</CODE>: The DBMS address.
65       * <CODE>4</CODE>: The Port to be used. <CODE>-1</CODE> means default.
66       * @throws WizardException If <CODE>numValue</CODE> is not valid.
67       * @return The needed value.
68       */    
69      public String getValue(int numValue) throws WizardException {
70          int numDbms;
71          
72          switch (numValue) {
73              case 0: return listFileName;
74              case 1: return propsFileName;
75              case 2:
76                  numDbms = lstDbms.getSelectedIndex();
77                  if (numDbms >= 0) {
78                      if (numDbms < dbmsCount)
79                          return dbmsList.getCommandText(numDbms);
80                      else
81                          return xList.getCommandText(numDbms - dbmsCount);
82                  }
83                  else
84                      return "";
85              case 3:
86                  if (radLocalhost.isSelected())
87                      return "localhost";
88                  else
89                      return txtAddress.getText();
90              case 4:
91                  if (radPortDefault.isSelected())
92                      return "-1";
93                  else
94                      return txtPort.getText();
95              case 5:
96                  return listFileNameX;
97              case 6:
98                  return propsFileNameX;
99              case 7:
100                 numDbms = lstDbms.getSelectedIndex();
101                 if (numDbms < dbmsCount)
102                     return "DBMS";
103                 else
104                     return "XML";
105             default:
106                 throw new WizardException(javatoolsBundle.getString("DBMS_value_index_not_valid!"));
107         }
108     }
109     
110     /** Returns a value whose name is specified.
111      * @param name The name of the needed value.
112      * @return <CODE>"ListFileName"</CODE>: The filename containing the list of managed DBMSs.
113      * <CODE>"PropsFileName"</CODE>: The properties filename containing information about DBMS names and descriptions filenames (See the "HOW TO USE" file).
114      * <CODE>"SelectedDBMS"</CODE>: The selected DBMS.
115      * <CODE>"DBMSAddress"</CODE>: The DBMS address.
116      * <CODE>"DBMSPort"</CODE>: The Port to be used. <CODE>-1</CODE> means default.
117      */    
118     public String getValue(String name) {
119         int pos;
120         
121         pos = getValuePos(name);
122         if (pos >= 0) {
123             try {
124                 return getValue(pos);
125             }
126             catch (WizardException e) {
127                 System.out.println(javatoolsBundle.getString("Something_weird_happened,_a_found_value_is_not_present_for_getting_operation!"));
128                 System.exit(1);
129             }
130         }
131         return "";
132     }
133     
134     /** Returns the name whose position is specified.
135      * @param numValue The position of the value.
136      * @throws WizardException If <CODE>numValue</CODE> is not valid.
137      * @return The name of the value.
138      */    
139     public String getValueName(int numValue) throws WizardException {
140         if (numValue >= 0 && numValue < 8)
141             return valueList[numValue];
142         else
143             throw new IndexOutOfBoundsException(javatoolsBundle.getString("Value_number_not_found!"));
144     }
145     
146     /** Returns the position of a value whose name is specified.
147      * @param name The name of the needed value.
148      * @return The position of the value.
149      */    
150     public int getValuePos(String name) {
151         int i, listLength, pos;
152         
153         listLength = valueList.length;
154         i = 0;
155         pos = -1;
156         while (i < listLength) {
157             if (valueList[i].equals(name)) {
158                 pos = i;
159                 i = listLength;
160             }
161             else
162                 i++;
163         }
164         return pos;
165     }
166     
167     /** Sets a value whose position is specified.
168      * @param numValue The position of the value.
169      * @param value <CODE>0</CODE>: The filename containing the list of managed DBMSs.
170      * <CODE>1</CODE>: The properties filename containing information about DBMS names and descriptions filenames (See the "HOW TO USE" file).
171      * <CODE>2</CODE>: The selected DBMS.
172      * <CODE>3</CODE>: The DBMS address.
173      * <CODE>4</CODE>: The Port to be used. <CODE>-1</CODE> means default.
174      * @throws WizardException If <CODE>numValue</CODE> is not valid.
175      */    
176     public void setValue(int numValue, String value) throws WizardException {
177         int numDbms, numPort;
178         
179         switch (numValue) {
180             case 0:
181                 listFileName = value;
182                 buildList();
183                 break;
184             case 1:
185                 propsFileName = value;
186                 buildList();
187                 break;
188             case 2:
189                 try {
190                     numDbms = Integer.decode(value).intValue();
191                 }
192                 catch (NumberFormatException e) {
193                     throw new WizardException(javatoolsBundle.getString("DBMS_index_is_not_a_number!"));
194                 }
195                 if (numDbms >= 0 && numDbms < lstDbms.getComponentCount())
196                     lstDbms.setSelectedIndex(numDbms);
197                 else
198                     throw new WizardException(javatoolsBundle.getString("DBMS_index_not_valid!"));
199                 break;
200             case 3:
201                 if (value.equals("localhost")) {
202                     radLocalhost.setSelected(true);
203                     txtAddress.setText("localhost");
204                     txtAddress.setEnabled(false);
205                 }
206                 else {
207                     radAddress.setSelected(true);
208                     txtAddress.setText(value);
209                     txtAddress.setEnabled(true);
210                 }
211                 break;
212             case 4:
213                 try {
214                     numPort = Integer.decode(value).intValue();
215                 }
216                 catch (NumberFormatException e) {
217                     throw new WizardException(javatoolsBundle.getString("Port_number_is_not_a_number!"));
218                 }
219                 if (numPort <= 0) {
220                     radPortDefault.setSelected(true);
221                     txtPort.setText("");
222                     txtPort.setEnabled(false);
223                 }
224                 else {
225                     radPort.setSelected(true);
226                     txtPort.setText(value);
227                     txtPort.setEnabled(true);
228                 }
229                 break;
230             case 5:
231                 listFileNameX = value;
232                 buildXList();
233                 break;
234             case 6:
235                 propsFileNameX = value;
236                 buildXList();
237                 break;
238             case 7:
239                 selectedServerType = value;
240             default:
241                 throw new WizardException(javatoolsBundle.getString("DBMS_value_index_not_valid!"));
242         }
243     }
244     
245     /** Sets a value whose name is specified.
246      * @param name The name of the value.
247      * @param value <CODE>"ListFileName"</CODE>: The filename containing the list of managed DBMSs.
248      * <CODE>"PropsFileName"</CODE>: The properties filename containing information about DBMS names and descriptions filenames (See the "HOW TO USE" file).
249      * <CODE>"SelectedDBMS"</CODE>: The selected DBMS.
250      * <CODE>"DBMSAddress"</CODE>: The DBMS address.
251      * <CODE>"DBMSPort"</CODE>: The Port to be used. <CODE>-1</CODE> means default.
252      */    
253     public void setValue(String name, String value) {
254         int pos;
255         
256         pos = getValuePos(name);
257         if (pos >= 0) {
258             try {
259                 setValue(pos, value);
260             }
261             catch (WizardException e) {
262                 System.out.println(javatoolsBundle.getString("Something_weird_happened,_a_found_value_is_not_present_for_setting_operation!"));
263                 System.out.println(e.getMessage());
264                 System.exit(1);
265             }
266         }
267     }
268 
269     /** This method is called from within the constructor to
270      * initialize the form.
271      * WARNING: Do NOT modify this code. The content of this method is
272      * always regenerated by the Form Editor.
273      */
274     private void initComponents() {//GEN-BEGIN:initComponents
275         java.awt.GridBagConstraints gridBagConstraints;
276 
277         btgAddress = new javax.swing.ButtonGroup();
278         btgPort = new javax.swing.ButtonGroup();
279         lblDbmsName = new javax.swing.JLabel();
280         lblDbmsAddress = new javax.swing.JLabel();
281         radLocalhost = new javax.swing.JRadioButton();
282         radAddress = new javax.swing.JRadioButton();
283         txtAddress = new javax.swing.JTextField();
284         lblPortNumber = new javax.swing.JLabel();
285         radPortDefault = new javax.swing.JRadioButton();
286         radPort = new javax.swing.JRadioButton();
287         txtPort = new javax.swing.JTextField();
288         sppDbms = new javax.swing.JSplitPane();
289         scpDbms = new javax.swing.JScrollPane();
290         lstDbms = new javax.swing.JList();
291         scpDbmsDescription = new javax.swing.JScrollPane();
292         lblDbmsDescription = new javax.swing.JLabel();
293 
294         setLayout(new java.awt.GridBagLayout());
295 
296         addComponentListener(new java.awt.event.ComponentAdapter() {
297             public void componentShown(java.awt.event.ComponentEvent evt) {
298                 formComponentShown(evt);
299             }
300         });
301 
302         lblDbmsName.setText(javatoolsBundle.getString("DBMS_name"));
303         gridBagConstraints = new java.awt.GridBagConstraints();
304         gridBagConstraints.gridx = 0;
305         gridBagConstraints.gridy = 0;
306         gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
307         add(lblDbmsName, gridBagConstraints);
308 
309         lblDbmsAddress.setText(javatoolsBundle.getString("DBMS_Address"));
310         gridBagConstraints = new java.awt.GridBagConstraints();
311         gridBagConstraints.gridx = 0;
312         gridBagConstraints.gridy = 2;
313         gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
314         gridBagConstraints.insets = new java.awt.Insets(10, 10, 0, 0);
315         add(lblDbmsAddress, gridBagConstraints);
316 
317         radLocalhost.setSelected(true);
318         radLocalhost.setText(javatoolsBundle.getString("Use_local_host"));
319         radLocalhost.setToolTipText(javatoolsBundle.getString("Check_this_to_choose_the_local_computer"));
320         btgAddress.add(radLocalhost);
321         radLocalhost.setPreferredSize(new java.awt.Dimension(115, 25));
322         radLocalhost.addActionListener(new java.awt.event.ActionListener() {
323             public void actionPerformed(java.awt.event.ActionEvent evt) {
324                 radLocalhostActionPerformed(evt);
325             }
326         });
327 
328         gridBagConstraints = new java.awt.GridBagConstraints();
329         gridBagConstraints.gridx = 0;
330         gridBagConstraints.gridy = 3;
331         gridBagConstraints.gridwidth = 2;
332         gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
333         gridBagConstraints.insets = new java.awt.Insets(3, 30, 0, 0);
334         add(radLocalhost, gridBagConstraints);
335 
336         radAddress.setText(javatoolsBundle.getString("Specific_address"));
337         radAddress.setToolTipText(javatoolsBundle.getString("Check_this_and_type_the_address_of_database_server"));
338         btgAddress.add(radAddress);
339         radAddress.addActionListener(new java.awt.event.ActionListener() {
340             public void actionPerformed(java.awt.event.ActionEvent evt) {
341                 radAddressActionPerformed(evt);
342             }
343         });
344 
345         gridBagConstraints = new java.awt.GridBagConstraints();
346         gridBagConstraints.gridx = 0;
347         gridBagConstraints.gridy = 4;
348         gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
349         gridBagConstraints.insets = new java.awt.Insets(5, 30, 0, 0);
350         add(radAddress, gridBagConstraints);
351 
352         txtAddress.setColumns(15);
353         txtAddress.setText("localhost");
354         txtAddress.setToolTipText(javatoolsBundle.getString("Address_of_the_database_server"));
355         txtAddress.addKeyListener(new java.awt.event.KeyAdapter() {
356             public void keyTyped(java.awt.event.KeyEvent evt) {
357                 txtAddressKeyTyped(evt);
358             }
359             public void keyPressed(java.awt.event.KeyEvent evt) {
360                 txtAddressKeyPressed(evt);
361             }
362             public void keyReleased(java.awt.event.KeyEvent evt) {
363                 txtAddressKeyReleased(evt);
364             }
365         });
366 
367         gridBagConstraints = new java.awt.GridBagConstraints();
368         gridBagConstraints.gridx = 1;
369         gridBagConstraints.gridy = 4;
370         gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
371         gridBagConstraints.insets = new java.awt.Insets(5, 9, 0, 0);
372         add(txtAddress, gridBagConstraints);
373 
374         lblPortNumber.setText(javatoolsBundle.getString("Port_Number"));
375         gridBagConstraints = new java.awt.GridBagConstraints();
376         gridBagConstraints.gridx = 0;
377         gridBagConstraints.gridy = 5;
378         gridBagConstraints.gridwidth = 2;
379         gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
380         gridBagConstraints.insets = new java.awt.Insets(15, 10, 0, 0);
381         add(lblPortNumber, gridBagConstraints);
382 
383         radPortDefault.setSelected(true);
384         radPortDefault.setText(javatoolsBundle.getString("Take_the_default"));
385         radPortDefault.setToolTipText(javatoolsBundle.getString("Check_this_to_choose_the_default_port"));
386         btgPort.add(radPortDefault);
387         radPortDefault.addActionListener(new java.awt.event.ActionListener() {
388             public void actionPerformed(java.awt.event.ActionEvent evt) {
389                 radPortDefaultActionPerformed(evt);
390             }
391         });
392 
393         gridBagConstraints = new java.awt.GridBagConstraints();
394         gridBagConstraints.gridx = 0;
395         gridBagConstraints.gridy = 6;
396         gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
397         gridBagConstraints.insets = new java.awt.Insets(13, 30, 0, 0);
398         add(radPortDefault, gridBagConstraints);
399 
400         radPort.setText(javatoolsBundle.getString("Specific_port"));
401         radPort.setToolTipText(javatoolsBundle.getString("Check_this_and_type_a_port_number"));
402         btgPort.add(radPort);
403         radPort.addActionListener(new java.awt.event.ActionListener() {
404             public void actionPerformed(java.awt.event.ActionEvent evt) {
405                 radPortActionPerformed(evt);
406             }
407         });
408 
409         gridBagConstraints = new java.awt.GridBagConstraints();
410         gridBagConstraints.gridx = 0;
411         gridBagConstraints.gridy = 7;
412         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
413         gridBagConstraints.insets = new java.awt.Insets(5, 30, 0, 0);
414         add(radPort, gridBagConstraints);
415 
416         txtPort.setColumns(10);
417         txtPort.setToolTipText(javatoolsBundle.getString("Type_here_your_custom_port_number"));
418         txtPort.addKeyListener(new java.awt.event.KeyAdapter() {
419             public void keyTyped(java.awt.event.KeyEvent evt) {
420                 txtPortKeyTyped(evt);
421             }
422             public void keyPressed(java.awt.event.KeyEvent evt) {
423                 txtPortKeyPressed(evt);
424             }
425             public void keyReleased(java.awt.event.KeyEvent evt) {
426                 txtPortKeyReleased(evt);
427             }
428         });
429 
430         gridBagConstraints = new java.awt.GridBagConstraints();
431         gridBagConstraints.gridx = 1;
432         gridBagConstraints.gridy = 7;
433         gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL;
434         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
435         gridBagConstraints.insets = new java.awt.Insets(5, 9, 0, 0);
436         add(txtPort, gridBagConstraints);
437 
438         sppDbms.setDividerLocation(150);
439         sppDbms.setPreferredSize(new java.awt.Dimension(300, 133));
440         lstDbms.setToolTipText(javatoolsBundle.getString("List_of_supported_DBMSs"));
441         lstDbms.setPreferredSize(new java.awt.Dimension(20, 20));
442         lstDbms.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
443             public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
444                 lstDbmsValueChanged(evt);
445             }
446         });
447 
448         scpDbms.setViewportView(lstDbms);
449 
450         sppDbms.setLeftComponent(scpDbms);
451 
452         lblDbmsDescription.setText(javatoolsBundle.getString("Here_goes_DBMS_description"));
453         lblDbmsDescription.setToolTipText(javatoolsBundle.getString("Description_of_selected_DBMS"));
454         lblDbmsDescription.setVerticalAlignment(javax.swing.SwingConstants.TOP);
455         scpDbmsDescription.setViewportView(lblDbmsDescription);
456 
457         sppDbms.setRightComponent(scpDbmsDescription);
458 
459         gridBagConstraints = new java.awt.GridBagConstraints();
460         gridBagConstraints.gridx = 0;
461         gridBagConstraints.gridy = 1;
462         gridBagConstraints.gridwidth = 2;
463         gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
464         gridBagConstraints.insets = new java.awt.Insets(3, 10, 0, 0);
465         add(sppDbms, gridBagConstraints);
466 
467     }//GEN-END:initComponents
468 
469     private void txtAddressKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtAddressKeyReleased
470         // Add your handling code here:
471         tccAddress.dispatchEvent(evt);
472         setEnabledRefButton(checkValues());
473     }//GEN-LAST:event_txtAddressKeyReleased
474 
475     private void txtAddressKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtAddressKeyPressed
476         // Add your handling code here:
477         tccAddress.dispatchEvent(evt);
478         setEnabledRefButton(checkValues());
479     }//GEN-LAST:event_txtAddressKeyPressed
480 
481     private void txtAddressKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtAddressKeyTyped
482         // Add your handling code here:
483         tccAddress.dispatchEvent(evt);
484         setEnabledRefButton(checkValues());
485     }//GEN-LAST:event_txtAddressKeyTyped
486 
487     private void txtPortKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtPortKeyReleased
488         // Add your handling code here:
489         tccPort.dispatchEvent(evt);
490         setEnabledRefButton(checkValues());
491     }//GEN-LAST:event_txtPortKeyReleased
492 
493     private void txtPortKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtPortKeyPressed
494         // Add your handling code here:
495         tccPort.dispatchEvent(evt);
496         setEnabledRefButton(checkValues());
497     }//GEN-LAST:event_txtPortKeyPressed
498 
499     private void txtPortKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtPortKeyTyped
500         // Add your handling code here:
501         tccPort.dispatchEvent(evt);
502         setEnabledRefButton(checkValues());
503     }//GEN-LAST:event_txtPortKeyTyped
504         
505     private void lstDbmsValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_lstDbmsValueChanged
506         // Add your handling code here:
507         int selInd;
508         
509         selInd = lstDbms.getSelectedIndex();
510         if (selInd >= 0)
511             lblDbmsDescription.setText((String) dbmsDescriptions.get(selInd));
512         setEnabledRefButton(checkValues());
513     }//GEN-LAST:event_lstDbmsValueChanged
514     
515     private void radPortActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_radPortActionPerformed
516         // Add your handling code here:
517         txtPort.setEnabled(true);
518         setEnabledRefButton(checkValues());
519     }//GEN-LAST:event_radPortActionPerformed
520     
521     private void radPortDefaultActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_radPortDefaultActionPerformed
522         // Add your handling code here:
523         txtPort.setEnabled(false);
524         setEnabledRefButton(checkValues());
525     }//GEN-LAST:event_radPortDefaultActionPerformed
526     
527     private void radAddressActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_radAddressActionPerformed
528         // Add your handling code here:
529         txtAddress.setEnabled(true);
530         setEnabledRefButton(checkValues());
531     }//GEN-LAST:event_radAddressActionPerformed
532     
533     private void radLocalhostActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_radLocalhostActionPerformed
534         // Add your handling code here:
535         txtAddress.setEnabled(false);
536         setEnabledRefButton(checkValues());
537     }//GEN-LAST:event_radLocalhostActionPerformed
538     
539     private void formComponentShown(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_formComponentShown
540         if (lstDbms.getSelectedIndex() < 0)
541             lstDbms.setListData(listData);
542         setEnabledRefButton(checkValues());
543     }//GEN-LAST:event_formComponentShown
544         
545     
546     // Variables declaration - do not modify//GEN-BEGIN:variables
547     private javax.swing.JTextField txtPort;
548     private javax.swing.JTextField txtAddress;
549     private javax.swing.JSplitPane sppDbms;
550     private javax.swing.JRadioButton radPort;
551     private javax.swing.JLabel lblPortNumber;
552     private javax.swing.JRadioButton radLocalhost;
553     private javax.swing.ButtonGroup btgAddress;
554     private javax.swing.JLabel lblDbmsDescription;
555     private javax.swing.JList lstDbms;
556     private javax.swing.JRadioButton radAddress;
557     private javax.swing.JScrollPane scpDbmsDescription;
558     private javax.swing.JScrollPane scpDbms;
559     private javax.swing.JLabel lblDbmsName;
560     private javax.swing.JRadioButton radPortDefault;
561     private javax.swing.JLabel lblDbmsAddress;
562     private javax.swing.ButtonGroup btgPort;
563     // End of variables declaration//GEN-END:variables
564 
565     private TextComponentChecker tccPort, tccAddress;
566     
567     private int dbmsCount, xCount;
568     private String listFileName, propsFileName;
569     private String listFileNameX, propsFileNameX;
570     private String selectedServerType;
571     private ScriptCatcher dbmsList;
572     private ScriptCatcher xList;
573     private LinkedList dbmsDescriptions;
574     private LinkedList xDescriptions;
575     private Vector listData;
576     private String valueList[] =
577         {"ListFileName", "PropsFileName", "SelectedDBMS", "DBMSAddress", "DBMSPort",
578          "ListFileNameX", "PropsFileNameX", "SelectedServerType"};
579     private java.util.ResourceBundle javatoolsBundle;
580     
581     private void buildList() throws WizardException {
582         Props dbmsProps;
583         Vector dbmsNameList;
584         String dbmsName, descriptionFileName, localConfigDir;
585         int i, numDbms;
586         
587         if (listFileName != null && propsFileName != null) {
588             dbmsNameList = new Vector();
589             dbmsList = new ScriptCatcher();
590             try {
591                 dbmsProps = Props.singleton(propsFileName);
592 /*                localConfigDir = Props.getLocalConfigDir();
593                 if (!localConfigDir.equals(""))
594                     localConfigDir += "/";
595                 dbmsList.loadScript(localConfigDir+listFileName);*/
596                 dbmsList.loadScript(getClass().getClassLoader().getResourceAsStream("res/" + listFileName));
597             }
598             catch (FileNotFoundException e) {
599                 throw new WizardException(e.getMessage());
600             }
601             catch (IOException e) {
602                 throw new WizardException(e.getMessage());
603             }
604             numDbms = dbmsList.getNumCommands();
605             dbmsCount = numDbms;
606             for (i=0; i<numDbms; i++) {
607                 dbmsName = dbmsList.getCommandText(i);
608                 dbmsNameList.add(dbmsProps.getProperty(dbmsName+".name"));
609                 descriptionFileName = dbmsProps.getProperty(dbmsName+".description");
610                 try {
611                     dbmsDescriptions.add(ScriptCatcher.inputStream2String(getClass().getClassLoader().getResourceAsStream("res/" + descriptionFileName)));
612                 }
613                 catch (FileNotFoundException e) {
614                     dbmsDescriptions.add("");
615                 }
616                 catch (IOException e) {
617                     dbmsDescriptions.add("");
618                 }
619             }
620             listData.addAll(dbmsNameList);
621         }
622     }
623     
624     private void buildXList() throws WizardException {
625         Props dbmsProps;
626         Vector dbmsNameList;
627         String dbmsName, descriptionFileName, localConfigDir;
628         int i, numDbms;
629         
630         if (listFileNameX != null && propsFileNameX != null) {
631             dbmsNameList = new Vector();
632             xList = new ScriptCatcher();
633             try {
634                 dbmsProps = Props.singleton(propsFileNameX);
635 /*                localConfigDir = Props.getLocalConfigDir();
636                 if (!localConfigDir.equals(""))
637                     localConfigDir += "/";
638                 xList.loadScript(localConfigDir+listFileNameX);*/
639                 xList.loadScript(getClass().getClassLoader().getResourceAsStream("res/" + listFileNameX));
640                 numDbms = xList.getNumCommands();
641                 xCount = numDbms;
642                 for (i=0; i<numDbms; i++) {
643                     dbmsName = xList.getCommandText(i);
644                     dbmsNameList.add(dbmsProps.getProperty(dbmsName+".name"));
645                     descriptionFileName = dbmsProps.getProperty(dbmsName+".description");
646                     try {
647                         dbmsDescriptions.add(ScriptCatcher.inputStream2String(getClass().getClassLoader().getResourceAsStream("res/" + descriptionFileName)));
648 //                        dbmsDescriptions.add(ScriptCatcher.textFile2String(localConfigDir + descriptionFileName));
649                     }
650                     catch (FileNotFoundException e) {
651                         dbmsDescriptions.add("");
652                     }
653                 }
654                 listData.addAll(dbmsNameList);
655             }
656             catch (FileNotFoundException e) {
657                 System.out.println("X server list not found, working without it!");
658             }
659             catch (IOException e) {
660                 System.out.println("X server list not found, working without it!");
661             }
662         }
663     }
664     
665     private boolean checkValues() {
666         int numPort;
667         boolean retResult;
668         
669         retResult = true;
670         if (radPort.isSelected()) {
671             if (!tccPort.isValid())
672                 retResult = false;
673         }
674         if (lstDbms.getSelectedIndex() < 0)
675             retResult = false;
676         if (radAddress.isSelected() && !tccAddress.isValid())
677             retResult = false;
678         return retResult;
679     }
680 }