[opencoe-cvs] coekernel/src/COE/src/COE/java/org/opencoe/coe/kernel/apps COEInstaller.java,1.9,1.10
Status: Alpha
Brought to you by:
rbroberg
|
From: <rbr...@us...> - 2003-10-19 17:23:20
|
Update of /cvsroot/opencoe/coekernel/src/COE/src/COE/java/org/opencoe/coe/kernel/apps
In directory sc8-pr-cvs1:/tmp/cvs-serv15293/java/org/opencoe/coe/kernel/apps
Modified Files:
COEInstaller.java COEInstallerSourceDialog.java
Log Message:
20031019:rb:821280 - COEInstaller handles URI poorly
Index: COEInstaller.java
===================================================================
RCS file: /cvsroot/opencoe/coekernel/src/COE/src/COE/java/org/opencoe/coe/kernel/apps/COEInstaller.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** COEInstaller.java 18 Oct 2003 18:00:38 -0000 1.9
--- COEInstaller.java 19 Oct 2003 17:04:24 -0000 1.10
***************
*** 19,34 ****
* JFrame.java
*
! * Created on January 29, 2001, 1:02 PM
* 20031018:rb:825985 - COEInstaller S/W row cells should not be editable
* 20031018:rb:825973 - COEInstaller Available Disks not used
*/
- /**
- *@author rbroberg
- *@created October 6, 2003
- *@version
- */
-
-
public class COEInstaller extends javax.swing.JFrame {
--- 19,30 ----
* JFrame.java
*
! * @author rbroberg
! * @created January 29, 2001, 1:01 PM
! * @version
! * 20031019:rb:821280 - COEInstaller handles URI poorly
* 20031018:rb:825985 - COEInstaller S/W row cells should not be editable
* 20031018:rb:825973 - COEInstaller Available Disks not used
*/
public class COEInstaller extends javax.swing.JFrame {
***************
*** 111,114 ****
--- 107,115 ----
buttonInstallButton = new javax.swing.JButton();
buttonExitButton = new javax.swing.JButton();
+
+ // 20031019:rb:821280 - COEInstaller handles URI poorly
+ srcDialog = new COEInstallerSourceDialog(this, true);
+ srcDialog.setResizable(true);
+ srcDialog.setSize(450, 250);
//20031006:rb - Use Coe Env Variables to set install path
***************
*** 497,501 ****
instArray = getInstalled();
swInstalledTableModel.setData(instArray);
! swInstalledTable= new javax.swing.JTable(swInstalledTableModel);
swInstalledTable.tableChanged(new javax.swing.event.TableModelEvent(swInstalledTableModel));
swInstalledScrollPanel.setViewportView(swInstalledTable);
--- 498,502 ----
instArray = getInstalled();
swInstalledTableModel.setData(instArray);
! swInstalledTable = new javax.swing.JTable(swInstalledTableModel);
swInstalledTable.tableChanged(new javax.swing.event.TableModelEvent(swInstalledTableModel));
swInstalledScrollPanel.setViewportView(swInstalledTable);
***************
*** 532,538 ****
//20031018:rb:825985 - COEInstaller S/W row cells should not be editable
! swAvailableTableModel = new javax.swing.table.DefaultTableModel(
! new String[]{"Type", "Name", "Version", "Class", "Size", "Dir"}, 0)
! { public boolean isCellEditable(int row, int column) { return false;} };
swAvailableTable = new javax.swing.JTable(swAvailableTableModel);
--- 533,543 ----
//20031018:rb:825985 - COEInstaller S/W row cells should not be editable
! swAvailableTableModel =
! new javax.swing.table.DefaultTableModel(
! new String[]{"Type", "Name", "Version", "Class", "Size", "Dir"}, 0) {
! public boolean isCellEditable(int row, int column) {
! return false;
! }
! };
swAvailableTable = new javax.swing.JTable(swAvailableTableModel);
***************
*** 687,690 ****
--- 692,696 ----
}
+
//# +----|----+----|----+----|----+----|----+----|----+----|----+----|----+----|
//# End the graphical init for COE Installer
***************
*** 827,831 ****
if (cfgSourceLabel2.getText().equals("ftp")) {
// make dir for seginfo
! String segdesc = coeEnv.getCoeData()+"/local/SysAdm/NET_SERVER/" + segstr + "/SegDescrip";
String mkdirstr = "/bin/mkdir -p " + segdesc;
_OpenCOECmdExec mkdir = new _OpenCOECmdExec(mkdirstr);
--- 833,837 ----
if (cfgSourceLabel2.getText().equals("ftp")) {
// make dir for seginfo
! String segdesc = coeEnv.getCoeData() + "/local/SysAdm/NET_SERVER/" + segstr + "/SegDescrip";
String mkdirstr = "/bin/mkdir -p " + segdesc;
_OpenCOECmdExec mkdir = new _OpenCOECmdExec(mkdirstr);
***************
*** 834,839 ****
ftpsrc = new FtpDownload("rhinohide.cx", cfgSourceLabel6.getText() + "/" + segstr + "/SegDescrip/SegName", segdesc);
System.out.println("FTP seg download start");
! repstr = coeEnv.getCoeData()+"/local/SysAdm/NET_SERVER";
!
//20031006:rb - set path based on Coe Env variables.
//pathstr = pathstr + getTypePath(repstr, segstr);
--- 840,845 ----
ftpsrc = new FtpDownload("rhinohide.cx", cfgSourceLabel6.getText() + "/" + segstr + "/SegDescrip/SegName", segdesc);
System.out.println("FTP seg download start");
! repstr = coeEnv.getCoeData() + "/local/SysAdm/NET_SERVER";
!
//20031006:rb - set path based on Coe Env variables.
//pathstr = pathstr + getTypePath(repstr, segstr);
***************
*** 916,922 ****
*/
private void showCOEInstallerSourceDialog() {
- COEInstallerSourceDialog srcDialog = new COEInstallerSourceDialog(this, true);
- srcDialog.setResizable(true);
- srcDialog.setSize(450, 250);
srcDialog.show();
//System.out.println(srcDialog.getSource());
--- 922,925 ----
***************
*** 1007,1012 ****
if (cfgSourceLabel2.getText().equals("ftp")) {
System.out.println("FTP download start");
! FtpDownload ftpsrc = new FtpDownload("rhinohide.cx", path + "/toc", coeEnv.getCoeData()+"/local/SysAdm/NET_SERVER");
! path = coeEnv.getCoeData()+"/local/SysAdm/NET_SERVER";
System.out.println("FTP download end");
}
--- 1010,1015 ----
if (cfgSourceLabel2.getText().equals("ftp")) {
System.out.println("FTP download start");
! FtpDownload ftpsrc = new FtpDownload("rhinohide.cx", path + "/toc", coeEnv.getCoeData() + "/local/SysAdm/NET_SERVER");
! path = coeEnv.getCoeData() + "/local/SysAdm/NET_SERVER";
System.out.println("FTP download end");
}
***************
*** 1120,1125 ****
/*
* set type install path based on type (subtype)
! */
! //20031006:rb - Use Coe Env Variables to set install path based on type
if (type.equals("COTS")) {
--- 1123,1128 ----
/*
* set type install path based on type (subtype)
! */
! //20031006:rb - Use Coe Env Variables to set install path based on type
if (type.equals("COTS")) {
***************
*** 1282,1286 ****
private javax.swing.JScrollPane cfgDiskTableScrollPane;
private javax.swing.JTable cfgDiskTable;
! private javax.swing.table.TableModel cfgDiskTableModel;
private javax.swing.ListSelectionModel cfgDiskTableLSM;
private javax.swing.JPanel cfgDiskButtonPanel;
--- 1285,1289 ----
private javax.swing.JScrollPane cfgDiskTableScrollPane;
private javax.swing.JTable cfgDiskTable;
! private javax.swing.table.TableModel cfgDiskTableModel;
private javax.swing.ListSelectionModel cfgDiskTableLSM;
private javax.swing.JPanel cfgDiskButtonPanel;
***************
*** 1313,1428 ****
//20031006:rb - Use Coe Env Variables to set install path
private org.opencoe.coe.kernel.util._OpenCOEEnv coeEnv;
!
! // 20031018:rb:825985 - COEInstaller S/W row cells should not be editable
! class COEInstallerTableModel extends javax.swing.table.AbstractTableModel {
! final String[] columnNames = {"Type", "Name", "Version", "Class", "Size", "Dir"};
! private Object[][] data = {{"", "", "", "", "", ""}};
!
! private boolean DEBUG = true;
!
! public void setData (Object[][] tmp) {
! data = tmp;
! }
! public int getColumnCount() {
! return columnNames.length;
! }
!
! public int getRowCount() {
! //return data.length/columnNames.length;
! return data.length;
! }
! public String getColumnName(int col) {
! return columnNames[col];
! }
! public Object getValueAt(int row, int col) {
! System.out.println("row: "+row);
! System.out.println("col: "+col);
! System.out.println("rowcnt: "+getRowCount());
! System.out.println("colcnt: "+getColumnCount());
! if (row < getRowCount() && col <getColumnCount()) {
! return data[row][col];
! } else {
! return null;
}
- }
- /*
- * JTable uses this method to determine the default renderer/
- * editor for each cell. If we didn't implement this method,
- * then the last column would contain text ("true"/"false"),
- * rather than a check box.
- */
- public Class getColumnClass(int c) {
- return getValueAt(0, c).getClass();
- }
! /*
! * Don't need to implement this method unless your table's
! * editable.
! */
! public boolean isCellEditable(int row, int col) {
! return false;
! }
- /*
- * Don't need to implement this method unless your table's
- * data can change.
- */
- public void setValueAt(Object value, int row, int col) {
- if (DEBUG) {
- System.out.println("Setting value at " + row + "," + col
- + " to " + value
- + " (an instance of "
- + value.getClass() + ")");
- }
! if (data[0][col] instanceof Integer
! && !(value instanceof Integer)) {
! //With JFC/Swing 1.1 and JDK 1.2, we need to create
! //an Integer from the value; otherwise, the column
! //switches to contain Strings. Starting with v 1.3,
! //the table automatically converts value to an Integer,
! //so you only need the code in the 'else' part of this
! //'if' block.
! //XXX: See TableEditDemo.java for a better solution!!!
! try {
! data[row][col] = new Integer(value.toString());
! fireTableCellUpdated(row, col);
! } catch (NumberFormatException e) {
! System.err.println("The \"" + getColumnName(col) + "\" column accepts only integer values.");
! }
! } else {
! data[row][col] = value;
! fireTableCellUpdated(row, col);
! }
- if (DEBUG) {
- System.out.println("New value of data:");
- printDebugData();
- }
- }
! private void printDebugData() {
! int numRows = getRowCount();
! int numCols = getColumnCount();
- for (int i=0; i < numRows; i++) {
- System.out.print(" row " + i + ":");
- for (int j=0; j < numCols; j++) {
- System.out.print(" " + data[i][j]);
- }
- System.out.println();
- }
- System.out.println("--------------------------");
- }
- }
- }
--- 1316,1492 ----
//20031006:rb - Use Coe Env Variables to set install path
private org.opencoe.coe.kernel.util._OpenCOEEnv coeEnv;
! // 20031019:rb:821280 - COEInstaller handles URI poorly
! private org.opencoe.coe.kernel.apps.COEInstallerSourceDialog srcDialog;
! // 20031018:rb:825985 - COEInstaller S/W row cells should not be editable
! /**
! * Description of the Class
! *
! *@author rbroberg
! *@created October 18, 2003
! */
! class COEInstallerTableModel extends javax.swing.table.AbstractTableModel {
! final String[] columnNames = {"Type", "Name", "Version", "Class", "Size", "Dir"};
! private Object[][] data = {{"", "", "", "", "", ""}};
! private boolean DEBUG = false;
! /**
! * Sets the data attribute of the COEInstallerTableModel object
! *
! *@param tmp The new data value
! */
! public void setData(Object[][] tmp) {
! data = tmp;
}
! /**
! * Gets the columnCount attribute of the COEInstallerTableModel object
! *
! *@return The columnCount value
! */
! public int getColumnCount() {
! return columnNames.length;
! }
! /**
! * Gets the rowCount attribute of the COEInstallerTableModel object
! *
! *@return The rowCount value
! */
! public int getRowCount() {
! //return data.length/columnNames.length;
! return data.length;
! }
! /**
! * Gets the columnName attribute of the COEInstallerTableModel object
! *
! *@param col Description of the Parameter
! *@return The columnName value
! */
! public String getColumnName(int col) {
! return columnNames[col];
! }
+ /**
+ * Gets the valueAt attribute of the COEInstallerTableModel object
+ *
+ *@param row Description of the Parameter
+ *@param col Description of the Parameter
+ *@return The valueAt value
+ */
+ public Object getValueAt(int row, int col) {
+ if (row < getRowCount() && col < getColumnCount()) {
+ return data[row][col];
+ } else {
+ return null;
+ }
+ }
+
+
+ /*
+ * JTable uses this method to determine the default renderer/
+ * editor for each cell. If we didn't implement this method,
+ * then the last column would contain text ("true"/"false"),
+ * rather than a check box.
+ */
+ /**
+ * Gets the columnClass attribute of the COEInstallerTableModel object
+ *
+ *@param c Description of the Parameter
+ *@return The columnClass value
+ */
+ public Class getColumnClass(int c) {
+ return getValueAt(0, c).getClass();
+ }
+
+
+ /*
+ * Don't need to implement this method unless your table's
+ * editable.
+ */
+ /**
+ * Gets the cellEditable attribute of the COEInstallerTableModel object
+ *
+ *@param row Description of the Parameter
+ *@param col Description of the Parameter
+ *@return The cellEditable value
+ */
+ public boolean isCellEditable(int row, int col) {
+ return false;
+ }
+
+
+ /*
+ * Don't need to implement this method unless your table's
+ * data can change.
+ */
+ /**
+ * Sets the valueAt attribute of the COEInstallerTableModel object
+ *
+ *@param value The new valueAt value
+ *@param row The new valueAt value
+ *@param col The new valueAt value
+ */
+ public void setValueAt(Object value, int row, int col) {
+ if (DEBUG) {
+ System.out.println("Setting value at " + row + "," + col
+ + " to " + value
+ + " (an instance of "
+ + value.getClass() + ")");
+ }
+
+ if (data[0][col] instanceof Integer
+ && !(value instanceof Integer)) {
+ //With JFC/Swing 1.1 and JDK 1.2, we need to create
+ //an Integer from the value; otherwise, the column
+ //switches to contain Strings. Starting with v 1.3,
+ //the table automatically converts value to an Integer,
+ //so you only need the code in the 'else' part of this
+ //'if' block.
+ //XXX: See TableEditDemo.java for a better solution!!!
+ try {
+ data[row][col] = new Integer(value.toString());
+ fireTableCellUpdated(row, col);
+ } catch (NumberFormatException e) {
+ System.err.println("The \"" + getColumnName(col) + "\" column accepts only integer values.");
+ }
+ } else {
+ data[row][col] = value;
+ fireTableCellUpdated(row, col);
+ }
+
+ if (DEBUG) {
+ System.out.println("New value of data:");
+ printDebugData();
+ }
+ }
+ /**
+ * Description of the Method
+ */
+ private void printDebugData() {
+ int numRows = getRowCount();
+ int numCols = getColumnCount();
+
+ for (int i = 0; i < numRows; i++) {
+ System.out.print(" row " + i + ":");
+ for (int j = 0; j < numCols; j++) {
+ System.out.print(" " + data[i][j]);
+ }
+ System.out.println();
+ }
+ System.out.println("--------------------------");
+ }
+ }
+
+ }
Index: COEInstallerSourceDialog.java
===================================================================
RCS file: /cvsroot/opencoe/coekernel/src/COE/src/COE/java/org/opencoe/coe/kernel/apps/COEInstallerSourceDialog.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** COEInstallerSourceDialog.java 20 May 2002 22:41:20 -0000 1.2
--- COEInstallerSourceDialog.java 19 Oct 2003 17:04:24 -0000 1.3
***************
*** 1,326 ****
/**
! * Copyright (C) 2002, Federal Linux Systems
! *
! * The project home for this software is http://www.opencoe.org
! *
! * This segment is free software; you can redistribute it and/or
! * modify it under the terms of the GNU Lesser General Public
! * License as published by the Free Software Foundation; either
! * version 2.1 of the License, or (at your option) any later version.
! *
! * This segment is distributed in the hope that it will be useful,
! * but WITHOUT ANY WARRANTY; without even the implied warranty of
! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
! * Lesser General Public License for more details.
! *
! * You should have received a copy of the GNU Lesser General Public
* License along with this segment; if not, write to the Free Software
! * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
! *
! **/
! package org.opencoe.coe.kernel.apps;
import org.opencoe.coe.kernel.util.*;
/*
! * COEInstallerSourceDialog.java
*
! * Created on March 24, 2001, 12:24 PM
*/
-
-
/**
! *
! * @author root
! * @version
*/
! public class COEInstallerSourceDialog
! extends java.awt.Dialog implements java.awt.event.ActionListener{
! /** Creates new form COEInstallerSourceDialog */
! public COEInstallerSourceDialog(java.awt.Frame parent,boolean modal) {
! super (parent, modal);
! initComponents ();
! pack ();
! }
- /** This method is called from within the init() method to
- * initialize the form.
- * WARNING: Do NOT modify this code. The content of this method is
- * always regenerated by the FormEditor.
- */
- private void initComponents () {//GEN-BEGIN:initComponents
- sdMainPanel = new javax.swing.JPanel ();
- //sdCheckBoxGroup = new javax.swing.CheckBoxGroup();
- cdromPanel = new javax.swing.JPanel ();
- cdromCheckBox = new javax.swing.JCheckBox ();
- cdromTextField = new javax.swing.JTextField ();
- diskPanel = new javax.swing.JPanel ();
- diskCheckBox = new javax.swing.JCheckBox ();
- diskTextField = new javax.swing.JTextField ();
- ftpPanel = new javax.swing.JPanel ();
- ftpCheckBox = new javax.swing.JCheckBox ();
- ftpTextField = new javax.swing.JTextField ();
- scpPanel = new javax.swing.JPanel ();
- scpCheckBox = new javax.swing.JCheckBox ();
- scpTextField = new javax.swing.JTextField ();
- sdButtonPanel = new javax.swing.JPanel ();
- sdOkButton = new javax.swing.JButton ();
- sdCancelButton = new javax.swing.JButton ();
- setLayout (new javax.swing.BoxLayout (this, 1));
- addWindowListener (new java.awt.event.WindowAdapter () {
- public void windowClosing (java.awt.event.WindowEvent evt) {
- closeDialog (evt);
- }
- }
- );
! sdMainPanel.setLayout (new javax.swing.BoxLayout (sdMainPanel, 1));
! cdromPanel.setLayout (new javax.swing.BoxLayout (cdromPanel, 0));
!
! cdromCheckBox.setText ("CDROM");
! cdromCheckBox.setEnabled (false);
! cdromCheckBox.setActionCommand ("CDROM");
! //cdromCheckBox.addActionListener (this);
!
! cdromPanel.add (cdromCheckBox);
!
! cdromTextField.setEditable (false);
! cdromTextField.setColumns (16);
! cdromTextField.setText ("/cdrom");
!
! cdromPanel.add (cdromTextField);
!
! sdMainPanel.add (cdromPanel);
!
! diskPanel.setLayout (new javax.swing.BoxLayout (diskPanel, 0));
!
! diskCheckBox.setText ("DISK");
! diskCheckBox.setSelected(true);
! diskCheckBox.addActionListener (this);
!
! diskPanel.add (diskCheckBox);
!
! diskTextField.setPreferredSize (new java.awt.Dimension(176, 20));
! diskTextField.setColumns (16);
! diskTextField.setText ("file://localhost/h/NET_SERVER");
!
! diskPanel.add (diskTextField);
!
! sdMainPanel.add (diskPanel);
!
! ftpPanel.setLayout (new javax.swing.BoxLayout (ftpPanel, 0));
!
! ftpCheckBox.setText ("FTP");
! ftpCheckBox.addActionListener (this);
!
! ftpPanel.add (ftpCheckBox);
!
! ftpTextField.setEditable (false);
! ftpTextField.setColumns (16);
! ftpTextField.setText ("ftp://rhinohide.cx/usr/rhinohide/NET_SERVER");
!
! ftpPanel.add (ftpTextField);
!
! sdMainPanel.add (ftpPanel);
!
! scpPanel.setLayout (new javax.swing.BoxLayout (scpPanel, 0));
!
! scpCheckBox.setLabel ("SCP");
! scpCheckBox.setText ("SCP");
! scpCheckBox.setEnabled (false);
! //scpCheckBox.addActionListener (this);
!
! scpPanel.add (scpCheckBox);
!
! scpTextField.setEditable (false);
! scpTextField.setColumns (16);
! scpTextField.setText ("scp://<hostname>/<directory>");
!
! scpPanel.add (scpTextField);
!
! sdMainPanel.add (scpPanel);
!
! add (sdMainPanel);
! sdOkButton.setText ("OK");
! sdOkButton.addActionListener (this);
! sdButtonPanel.add (sdOkButton);
!
! sdCancelButton.setText ("Cancel");
! sdCancelButton.addActionListener (this);
! sdButtonPanel.add (sdCancelButton);
!
! add (sdButtonPanel);
! }//GEN-END:initComponents
! /** Closes the dialog */
! private void closeDialog(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_closeDialog
! setVisible (false);
! dispose ();
! }//GEN-LAST:event_closeDialog
! public String getHost () {
! java.util.StringTokenizer st=new java.util.StringTokenizer(currSource, "/");
! st.nextToken();
! return (st.nextToken());
! }
!
! public String getType () {
! java.util.StringTokenizer st=new java.util.StringTokenizer(currSource, "/");
! java.util.StringTokenizer stt=new java.util.StringTokenizer(st.nextToken(), ":");
! return (stt.nextToken());
! }
!
! public String getDir () {
! java.util.StringTokenizer st=new java.util.StringTokenizer(currSource, "/", true);
! st.nextToken(); //type
! st.nextToken(); // first slash
! st.nextToken(); // second slash
! st.nextToken(); // hostname
! String s = new String("");
! while (st.hasMoreTokens()) {
! s=s+st.nextToken();
! }
! return (s);
! }
!
! private void setDevice (String dev) {
! currDevice = dev;
! }
!
! public String getDevice () {
! return (currDevice);
! }
!
! private void setSource (String src) {
! currSource = src;
! }
!
! public String getSource () {
! return (currSource);
! }
!
! private void setURI (String src) {
! currSource = src;
! }
! public String getURI () {
! return (currSource);
! }
!
! public void actionPerformed (java.awt.event.ActionEvent evt) {
! Object source = evt.getSource();
! if (source == sdCancelButton) {
! setVisible (false);
! dispose ();
! } else if (source == sdOkButton) {
! if (cdromCheckBox.isSelected()) {
! setDevice("CDROM");
! setSource(cdromTextField.getText());
! } else if (diskCheckBox.isSelected()) {
! setDevice("DISK");
! setSource(diskTextField.getText());
! } else if (ftpCheckBox.isSelected()) {
! setDevice("FTP");
! setSource(ftpTextField.getText());
! } else if (scpCheckBox.isSelected()) {
! setDevice("SCP");
! setSource(scpTextField.getText());
! }
! System.out.println(diskTextField.getText());
! setVisible (false);
! dispose ();
! } else if (source == cdromCheckBox) {
! setDevice("CDROM");
! setSource(cdromTextField.getText());
! diskCheckBox.setSelected (false);
! ftpCheckBox.setSelected (false);
! scpCheckBox.setSelected (false);
! cdromTextField.setEditable (true);
! diskTextField.setEditable (false);
! ftpTextField.setEditable (false);
! scpTextField.setEditable (false);
! } else if (source == diskCheckBox) {
! setDevice("DISK");
! setSource(diskTextField.getText());
!
! cdromCheckBox.setSelected (false);
! ftpCheckBox.setSelected (false);
! scpCheckBox.setSelected (false);
! cdromTextField.setEditable (false);
! diskTextField.setEditable (true);
! ftpTextField.setEditable (false);
! scpTextField.setEditable (false);
! } else if (source == ftpCheckBox) {
! setDevice("FTP");
! setSource(ftpTextField.getText());
! cdromCheckBox.setSelected (false);
! diskCheckBox.setSelected (false);
! scpCheckBox.setSelected (false);
! cdromTextField.setEditable (false);
! diskTextField.setEditable (false);
! ftpTextField.setEditable (true);
! scpTextField.setEditable (false);
! } else if (source == scpCheckBox) {
! setDevice("SCP");
! setSource(scpTextField.getText());
! cdromCheckBox.setSelected (false);
! diskCheckBox.setSelected (false);
! ftpCheckBox.setSelected (false);
! cdromTextField.setEditable (false);
! diskTextField.setEditable (false);
! ftpTextField.setEditable (false);
! scpTextField.setEditable (true);
! }
! }
! /**
! * @param args the command line arguments
! */
! public static void main (String args[]) {
! new COEInstallerSourceDialog (new java.awt.Frame (), true).show ();
! }
! // Variables declaration - do not modify//GEN-BEGIN:variables
! public String currSource;
! public String currDevice;
! private javax.swing.JPanel sdMainPanel;
! private javax.swing.JPanel cdromPanel;
! private javax.swing.JCheckBox cdromCheckBox;
! private javax.swing.JTextField cdromTextField;
! private javax.swing.JPanel diskPanel;
! private javax.swing.JCheckBox diskCheckBox;
! private javax.swing.JTextField diskTextField;
! private javax.swing.JPanel ftpPanel;
! private javax.swing.JCheckBox ftpCheckBox;
! private javax.swing.JTextField ftpTextField;
! private javax.swing.JPanel scpPanel;
! private javax.swing.JCheckBox scpCheckBox;
! private javax.swing.JTextField scpTextField;
! private javax.swing.JPanel sdButtonPanel;
! private javax.swing.JButton sdOkButton;
! private javax.swing.JButton sdCancelButton;
! // End of variables declaration//GEN-END:variables
}
--- 1,408 ----
/**
! * Copyright (C) 2002, Federal Linux Systems The project home for this software
! * is http://www.opencoe.org This segment is free software; you can
! * redistribute it and/or modify it under the terms of the GNU Lesser General
! * Public License as published by the Free Software Foundation; either version
! * 2.1 of the License, or (at your option) any later version. This segment is
! * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
! * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
! * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
! * details. You should have received a copy of the GNU Lesser General Public
* License along with this segment; if not, write to the Free Software
! * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
! */
! package org.opencoe.coe.kernel.apps;
import org.opencoe.coe.kernel.util.*;
/*
! * COEInstallerSourceDialog.java
*
! * Created on March 24, 2001, 12:24 PM
! * 20031019:rb:821280 - COEInstaller handles URI poorly
*/
/**
! *@author root
! *@created October 19, 2003
! *@version
*/
! public class COEInstallerSourceDialog
! extends java.awt.Dialog implements java.awt.event.ActionListener {
! /**
! * Creates new form COEInstallerSourceDialog
! *
! *@param parent Description of the Parameter
! *@param modal Description of the Parameter
! */
! public COEInstallerSourceDialog(java.awt.Frame parent, boolean modal) {
! super(parent, "COE Installer Source Dialog", modal);
! initComponents();
! pack();
! }
! /**
! * This method is called from within the init() method to initialize the form.
! * WARNING: Do NOT modify this code. The content of this method is always
! * regenerated by the FormEditor.
! */
! private void initComponents() {
! //GEN-BEGIN:initComponents
! sdMainPanel = new javax.swing.JPanel();
! //sdCheckBoxGroup = new javax.swing.CheckBoxGroup();
! cdromPanel = new javax.swing.JPanel();
! cdromCheckBox = new javax.swing.JCheckBox();
! cdromTextField = new javax.swing.JTextField();
! diskPanel = new javax.swing.JPanel();
! diskCheckBox = new javax.swing.JCheckBox();
! diskTextField = new javax.swing.JTextField();
! ftpPanel = new javax.swing.JPanel();
! ftpCheckBox = new javax.swing.JCheckBox();
! ftpTextField = new javax.swing.JTextField();
! scpPanel = new javax.swing.JPanel();
! scpCheckBox = new javax.swing.JCheckBox();
! scpTextField = new javax.swing.JTextField();
! sdButtonPanel = new javax.swing.JPanel();
! sdOkButton = new javax.swing.JButton();
! sdCancelButton = new javax.swing.JButton();
! setLayout(new javax.swing.BoxLayout(this, 1));
! addWindowListener(
! new java.awt.event.WindowAdapter() {
! public void windowClosing(java.awt.event.WindowEvent evt) {
! closeDialog(evt);
! }
! }
! );
! sdMainPanel.setLayout(new javax.swing.BoxLayout(sdMainPanel, 1));
! cdromPanel.setLayout(new javax.swing.BoxLayout(cdromPanel, 0));
+ cdromCheckBox.setText("CDROM");
+ cdromCheckBox.setEnabled(false);
+ cdromCheckBox.setActionCommand("CDROM");
+ //cdromCheckBox.addActionListener (this);
! cdromPanel.add(cdromCheckBox);
! cdromTextField.setEditable(false);
! cdromTextField.setColumns(16);
! cdromTextField.setText("/cdrom");
! cdromPanel.add(cdromTextField);
! sdMainPanel.add(cdromPanel);
! diskPanel.setLayout(new javax.swing.BoxLayout(diskPanel, 0));
! diskCheckBox.setText("DISK");
! diskCheckBox.setSelected(true);
! diskCheckBox.addActionListener(this);
! diskPanel.add(diskCheckBox);
! diskTextField.setPreferredSize(new java.awt.Dimension(176, 20));
! diskTextField.setColumns(16);
! //20031019:rb:821280 - COEInstaller handles URI poorly
! //diskTextField.setText("file://localhost/h/data/NET_SERVER");
! coeEnv = new _OpenCOEEnv();
! diskTextField.setText("file://localhost"+coeEnv.getCoeHome()+"/data/NET_SERVER");
! diskPanel.add(diskTextField);
! sdMainPanel.add(diskPanel);
! ftpPanel.setLayout(new javax.swing.BoxLayout(ftpPanel, 0));
! ftpCheckBox.setText("FTP");
! ftpCheckBox.addActionListener(this);
! ftpPanel.add(ftpCheckBox);
! ftpTextField.setEditable(false);
! ftpTextField.setColumns(16);
! ftpTextField.setText("ftp://rhinohide.cx/usr/rhinohide/NET_SERVER");
! ftpPanel.add(ftpTextField);
! sdMainPanel.add(ftpPanel);
! scpPanel.setLayout(new javax.swing.BoxLayout(scpPanel, 0));
! scpCheckBox.setLabel("SCP");
! scpCheckBox.setText("SCP");
! scpCheckBox.setEnabled(false);
! //scpCheckBox.addActionListener (this);
+ scpPanel.add(scpCheckBox);
! scpTextField.setEditable(false);
! scpTextField.setColumns(16);
! scpTextField.setText("scp://<hostname>/<directory>");
+ scpPanel.add(scpTextField);
! sdMainPanel.add(scpPanel);
!
! add(sdMainPanel);
!
! sdOkButton.setText("OK");
! sdOkButton.addActionListener(this);
! sdButtonPanel.add(sdOkButton);
!
! sdCancelButton.setText("Cancel");
! sdCancelButton.addActionListener(this);
! sdButtonPanel.add(sdCancelButton);
!
! add(sdButtonPanel);
!
! }
! //GEN-END:initComponents
!
!
! /**
! * Closes the dialog
! *
! *@param evt Description of the Parameter
! */
! private void closeDialog(java.awt.event.WindowEvent evt) {
! //GEN-FIRST:event_closeDialog
! setVisible(false);
! //20031019:rb:821280 - COEInstaller handles URI poorly
! //dispose();
! }
! //GEN-LAST:event_closeDialog
!
!
! /**
! * Gets the host attribute of the COEInstallerSourceDialog object
! *
! *@return The host value
! */
! public String getHost() {
! java.util.StringTokenizer st = new java.util.StringTokenizer(currSource, "/");
! st.nextToken();
! return (st.nextToken());
! }
!
!
! /**
! * Gets the type attribute of the COEInstallerSourceDialog object
! *
! *@return The type value
! */
! public String getType() {
! java.util.StringTokenizer st = new java.util.StringTokenizer(currSource, "/");
! java.util.StringTokenizer stt = new java.util.StringTokenizer(st.nextToken(), ":");
! return (stt.nextToken());
! }
!
!
! /**
! * Gets the dir attribute of the COEInstallerSourceDialog object
! *
! *@return The dir value
! */
! public String getDir() {
! java.util.StringTokenizer st = new java.util.StringTokenizer(currSource, "/", true);
! st.nextToken();
! //type
! st.nextToken();
! // first slash
! st.nextToken();
! // second slash
! st.nextToken();
! // hostname
! String s = new String("");
! while (st.hasMoreTokens()) {
! s = s + st.nextToken();
! }
! return (s);
! }
!
!
! /**
! * Sets the device attribute of the COEInstallerSourceDialog object
! *
! *@param dev The new device value
! */
! private void setDevice(String dev) {
! currDevice = dev;
! }
!
!
! /**
! * Gets the device attribute of the COEInstallerSourceDialog object
! *
! *@return The device value
! */
! public String getDevice() {
! return (currDevice);
! }
!
!
! /**
! * Sets the source attribute of the COEInstallerSourceDialog object
! *
! *@param src The new source value
! */
! private void setSource(String src) {
! currSource = src;
! }
!
!
! /**
! * Gets the source attribute of the COEInstallerSourceDialog object
! *
! *@return The source value
! */
! public String getSource() {
! return (currSource);
! }
!
!
! /**
! * Sets the URI attribute of the COEInstallerSourceDialog object
! *
! *@param src The new uRI value
! */
! private void setURI(String src) {
! currSource = src;
! }
!
!
! /**
! * Gets the URI attribute of the COEInstallerSourceDialog object
! *
! *@return The uRI value
! */
! public String getURI() {
! return (currSource);
! }
!
!
! /**
! * Description of the Method
! *
! *@param evt Description of the Parameter
! */
! public void actionPerformed(java.awt.event.ActionEvent evt) {
! Object source = evt.getSource();
! if (source == sdCancelButton) {
! setVisible(false);
! dispose();
! } else if (source == sdOkButton) {
! if (cdromCheckBox.isSelected()) {
! setDevice("CDROM");
! setSource(cdromTextField.getText());
! } else if (diskCheckBox.isSelected()) {
! setDevice("DISK");
! setSource(diskTextField.getText());
! } else if (ftpCheckBox.isSelected()) {
! setDevice("FTP");
! setSource(ftpTextField.getText());
! } else if (scpCheckBox.isSelected()) {
! setDevice("SCP");
! setSource(scpTextField.getText());
! }
!
! System.out.println(diskTextField.getText());
! setVisible(false);
! dispose();
! } else if (source == cdromCheckBox) {
! setDevice("CDROM");
! setSource(cdromTextField.getText());
!
! diskCheckBox.setSelected(false);
! ftpCheckBox.setSelected(false);
! scpCheckBox.setSelected(false);
!
! cdromTextField.setEditable(true);
! diskTextField.setEditable(false);
! ftpTextField.setEditable(false);
! scpTextField.setEditable(false);
!
! } else if (source == diskCheckBox) {
! setDevice("DISK");
! setSource(diskTextField.getText());
!
! cdromCheckBox.setSelected(false);
! ftpCheckBox.setSelected(false);
! scpCheckBox.setSelected(false);
!
! cdromTextField.setEditable(false);
! diskTextField.setEditable(true);
! ftpTextField.setEditable(false);
! scpTextField.setEditable(false);
!
! } else if (source == ftpCheckBox) {
! setDevice("FTP");
! setSource(ftpTextField.getText());
!
! cdromCheckBox.setSelected(false);
! diskCheckBox.setSelected(false);
! scpCheckBox.setSelected(false);
!
! cdromTextField.setEditable(false);
! diskTextField.setEditable(false);
! ftpTextField.setEditable(true);
! scpTextField.setEditable(false);
!
! } else if (source == scpCheckBox) {
! setDevice("SCP");
! setSource(scpTextField.getText());
!
! cdromCheckBox.setSelected(false);
! diskCheckBox.setSelected(false);
! ftpCheckBox.setSelected(false);
!
! cdromTextField.setEditable(false);
! diskTextField.setEditable(false);
! ftpTextField.setEditable(false);
! scpTextField.setEditable(true);
!
! }
! }
!
!
! /**
! *@param args the command line arguments
! */
! public static void main(String args[]) {
! new COEInstallerSourceDialog(new java.awt.Frame(), true).show();
! }
!
!
! // Variables declaration - do not modify//GEN-BEGIN:variables
! /**
! * Description of the Field
! */
! public String currSource;
! /**
! * Description of the Field
! */
! public String currDevice;
! private javax.swing.JPanel sdMainPanel;
! private javax.swing.JPanel cdromPanel;
! private javax.swing.JCheckBox cdromCheckBox;
! private javax.swing.JTextField cdromTextField;
! private javax.swing.JPanel diskPanel;
! private javax.swing.JCheckBox diskCheckBox;
! private javax.swing.JTextField diskTextField;
! private javax.swing.JPanel ftpPanel;
! private javax.swing.JCheckBox ftpCheckBox;
! private javax.swing.JTextField ftpTextField;
! private javax.swing.JPanel scpPanel;
! private javax.swing.JCheckBox scpCheckBox;
! private javax.swing.JTextField scpTextField;
! private javax.swing.JPanel sdButtonPanel;
! private javax.swing.JButton sdOkButton;
! private javax.swing.JButton sdCancelButton;
! //20031019:rb:821280 - COEInstaller handles URI poorly
! private org.opencoe.coe.kernel.util._OpenCOEEnv coeEnv;
! // End of variables declaration//GEN-END:variables
}
+
|