[opencoe-cvs] coekernel/src/COE/src/COE/java/org/opencoe/coe/kernel/apps COEDialog.java,1.2,1.3 COEI
Status: Alpha
Brought to you by:
rbroberg
From: <rbr...@us...> - 2003-10-26 17:13:51
|
Update of /cvsroot/opencoe/coekernel/src/COE/src/COE/java/org/opencoe/coe/kernel/apps In directory sc8-pr-cvs1:/tmp/cvs-serv763/java/org/opencoe/coe/kernel/apps Modified Files: COEDialog.java COEInstaller.java Log Message: 20031026:rb:829389 - COEInstaller Requires,Conflicts, and Release includes new classes _OpenCOESegment and _OpenCOETextDialog Index: COEDialog.java =================================================================== RCS file: /cvsroot/opencoe/coekernel/src/COE/src/COE/java/org/opencoe/coe/kernel/apps/COEDialog.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** COEDialog.java 16 Aug 2003 23:19:39 -0000 1.2 --- COEDialog.java 26 Oct 2003 17:12:49 -0000 1.3 *************** *** 32,35 **** --- 32,41 ---- import java.beans.*; //Property change stuff + import java.io.*; + import java.awt.*; + import java.awt.event.*; + import javax.swing.*; + + public class COEDialog extends WindowAdapter { private int maxX = 500; *************** *** 474,475 **** --- 480,540 ---- } + class COETextDialog extends JDialog + { + // Instance attributes used in this dialog + private JFrame parentFrame; + private JScrollPane scrollPane1; + + + // Dialog constructor + public COETextDialog(JFrame parentFrame, String title, JTextArea ta ) + { + // Make sure we call the parent + super( parentFrame ); + + // Save the owner frame in case we need it later + this.parentFrame = parentFrame; + + // Set the characteristics for this dialog instance + setTitle( title ); + setSize( 300, 400 ); + setDefaultCloseOperation( DISPOSE_ON_CLOSE ); + + + // Create a panel for the components + JPanel topPanel = new JPanel(); + topPanel.setLayout( new BorderLayout() ); + getContentPane().add( topPanel ); + + // Populate the panel with something the user + // can play with + CreateTopPane( topPanel, ta ); + + } + + + private void CreateTopPane( JPanel topPanel, JTextArea ta ) + { + // Create a text area + JTextArea area = ta; + + // Create the scrolling pane for the text area + scrollPane1 = new JScrollPane(); + scrollPane1.getViewport().add( area ); + topPanel.add( scrollPane1, BorderLayout.CENTER ); + + // Create button panel + JPanel buttonPanel = new JPanel(); + //buttonPanel.setLayout( new BoxLayout() ); + JButton okButton = new JButton("OK"); + okButton.addActionListener( + new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + hide(); + } + }); + //buttonPanel.add( okButton, BorderLayout.CENTER ); + buttonPanel.add( okButton ); + topPanel.add( buttonPanel, BorderLayout.SOUTH ); + } + } Index: COEInstaller.java =================================================================== RCS file: /cvsroot/opencoe/coekernel/src/COE/src/COE/java/org/opencoe/coe/kernel/apps/COEInstaller.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** COEInstaller.java 25 Oct 2003 05:21:54 -0000 1.11 --- COEInstaller.java 26 Oct 2003 17:12:49 -0000 1.12 *************** *** 16,31 **** import org.opencoe.coe.kernel.util.*; ! /* ! * JFrame.java * ! * @author rbroberg ! * @created January 29, 2001, 1:01 PM ! * @version ! * @history 20031024:rb:829386 - COEInstaller Menu Source items are nonfunctional ! * @history 20031019:rb:821280 - COEInstaller handles URI poorly ! * @history 20031018:rb:825985 - COEInstaller S/W row cells should not be editable ! * @history 20031018:rb:825973 - COEInstaller Available Disks not used */ - public class COEInstaller extends javax.swing.JFrame { --- 16,31 ---- import org.opencoe.coe.kernel.util.*; ! /** ! * COEInstaller.java * ! *@author rbroberg ! *@created January 29, 2001, 1:01 PM ! *@version ! *@history 20031026:rb:829389 - COEInstaller Requires,Conflicts, and Release ! *@history 20031024:rb:829386 - COEInstaller Menu Source items are ! *@history 20031019:rb:821280 - COEInstaller handles URI poorly ! *@history 20031018:rb:825985 - COEInstaller S/W row cells should not be ! *@history 20031018:rb:825973 - COEInstaller Available Disks not used */ public class COEInstaller extends javax.swing.JFrame { *************** *** 47,50 **** --- 47,51 ---- */ private void initComponents() { + thisinstaller = this; jMenuBar1 = new javax.swing.JMenuBar(); fileMenu = new javax.swing.JMenu(); *************** *** 108,112 **** buttonInstallButton = new javax.swing.JButton(); buttonExitButton = new javax.swing.JButton(); ! // 20031019:rb:821280 - COEInstaller handles URI poorly srcDialog = new COEInstallerSourceDialog(this, true); --- 109,113 ---- buttonInstallButton = new javax.swing.JButton(); buttonExitButton = new javax.swing.JButton(); ! // 20031019:rb:821280 - COEInstaller handles URI poorly srcDialog = new COEInstallerSourceDialog(this, true); *************** *** 117,120 **** --- 118,124 ---- coeEnv = new _OpenCOEEnv(); + //20031025:rb - + tocpath = new String(); + //# +----|----+----|----+----|----+----|----+----|----+----|----+----|----+----| //# Set up the Menu *************** *** 194,198 **** new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { ! jMenuItem6ActionPerformed(evt); } } --- 198,202 ---- new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { ! showReleaseNotes("Installed"); } } *************** *** 217,224 **** --- 221,249 ---- contentsMenu.setText("Contents"); relnotesContentsMenuItem.setText("Release Notes"); + relnotesContentsMenuItem.addActionListener( + new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + showReleaseNotes("Available"); + } + } + ); contentsMenu.add(relnotesContentsMenuItem); requiredContentsMenuItem.setText("Required SW"); + requiredContentsMenuItem.addActionListener( + new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + showRequires("Available"); + } + } + ); contentsMenu.add(requiredContentsMenuItem); conflictsContentsMenuItem.setText("Conflicts"); + conflictsContentsMenuItem.addActionListener( + new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + showConflicts("Available"); + } + } + ); contentsMenu.add(conflictsContentsMenuItem); jMenuBar1.add(contentsMenu); *************** *** 514,517 **** --- 539,549 ---- swInstalledRelnotesButton.setText("Release Notes"); swInstalledButtonPanel.add(swInstalledRelnotesButton); + //20031025:rb:829389 - COEInstaller Requires,Conflicts, and Release Notes + swInstalledRelnotesButton.addActionListener( + new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + showReleaseNotes("Installed"); + } + }); //# -------------------------------------------------------------- *************** *** 555,559 **** tocArray[i][9], tocArray[i][10], ! "/h"}; availArray[i][0] = newrow[0]; availArray[i][1] = newrow[1]; --- 587,591 ---- tocArray[i][9], tocArray[i][10], ! coeEnv.getCoeApps()}; availArray[i][0] = newrow[0]; availArray[i][1] = newrow[1]; *************** *** 561,564 **** --- 593,601 ---- availArray[i][3] = newrow[3]; availArray[i][4] = newrow[4]; + if (newrow[0].equals("COTS")) { + newrow[5] = coeEnv.getCoeCots(); + } else if (newrow[0].equals("ACCOUNT GROUP")) { + newrow[5] = coeEnv.getCoeAcct(); + } availArray[i][5] = newrow[5]; swAvailableTableModel.addRow(newrow); *************** *** 634,637 **** --- 671,681 ---- swAvailableRelnotesButton.setText("Release Notes"); swAvailableButtonPanel.add(swAvailableRelnotesButton); + //20031025:rb:829389 - COEInstaller Requires,Conflicts, and Release Notes + swAvailableRelnotesButton.addActionListener( + new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + showReleaseNotes("Available"); + } + }); //# -------------------------------------------------------------- *************** *** 640,643 **** --- 684,694 ---- swAvailableRequiresButton.setText("Requires"); swAvailableButtonPanel.add(swAvailableRequiresButton); + //20031025:rb:829389 - COEInstaller Requires,Conflicts, and Release Notes + swAvailableRequiresButton.addActionListener( + new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + showRequires("Available"); + } + }); //# -------------------------------------------------------------- *************** *** 646,649 **** --- 697,707 ---- swAvailableConflictsButton.setText("Conflicts"); swAvailableButtonPanel.add(swAvailableConflictsButton); + //20031025:rb:829389 - COEInstaller Requires,Conflicts, and Release Notes + swAvailableConflictsButton.addActionListener( + new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + showConflicts("Available"); + } + }); swAvailablePanel.add(swAvailableButtonPanel, java.awt.BorderLayout.SOUTH); *************** *** 824,828 **** } else { for (int i = 0; i < rows.length; i++) { ! String sep = "-"; String segstr = tocarr[rows[i]][4] + sep + tocarr[rows[i]][7] + sep + --- 882,887 ---- } else { for (int i = 0; i < rows.length; i++) { ! //String sep = "-"; ! String sep = coeEnv.getFileSep(); String segstr = tocarr[rows[i]][4] + sep + tocarr[rows[i]][7] + sep + *************** *** 843,847 **** // get seginfo FtpDownload ftpsrc = new FtpDownload("rhinohide.cx", cfgSourceLabel6.getText() + "/" + segstr + "/SegDescrip/SegInfo", segdesc); ! 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"; --- 902,906 ---- // get seginfo FtpDownload ftpsrc = new FtpDownload("rhinohide.cx", cfgSourceLabel6.getText() + "/" + segstr + "/SegDescrip/SegInfo", segdesc); ! //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"; *************** *** 898,914 **** String cmdstr = "COE_HOME/bin/COESegInstall"; String flagstr = "-d"; ! Integer cnt = new Integer(rows[i]); ! String disk = (String) swInstalledTable.getValueAt(cnt.intValue(), 5); ! java.util.StringTokenizer st = new java.util.StringTokenizer(disk, "/"); ! // the first token is null ! st.nextToken(); ! String pathstr = "/" + st.nextToken(); ! String segstr = st.nextToken(); ! while (st.hasMoreTokens()) { ! pathstr = pathstr + "/" + segstr; ! segstr = st.nextToken(); ! } ! //20030816:rb - remove whitespace on end of line ! segstr = segstr.trim(); String[] cmd3 = {sudostr, cmdstr, flagstr, pathstr, segstr}; System.out.println(sudostr + " " + cmdstr + " " + flagstr + " " + pathstr + " " + segstr); --- 957,965 ---- String cmdstr = "COE_HOME/bin/COESegInstall"; String flagstr = "-d"; ! //Integer cnt = new Integer(rows[i]); ! //java.io.File disk = new java.io.File ((String) swInstalledTable.getValueAt(cnt.intValue(), 5)); ! java.io.File disk = new java.io.File((String) swInstalledTable.getValueAt(rows[i], 5)); ! String segstr = disk.getName(); ! String pathstr = disk.getParent(); String[] cmd3 = {sudostr, cmdstr, flagstr, pathstr, segstr}; System.out.println(sudostr + " " + cmdstr + " " + flagstr + " " + pathstr + " " + segstr); *************** *** 949,960 **** final String[][] newArray = new String[tmptoc.size()][6]; for (int i = 0; i < tmptoc.size(); i++) { ! String str = (String) tmptoc.get(i); ! java.util.StringTokenizer st = new java.util.StringTokenizer(str, ":"); ! String type = st.nextToken(); ! String name = st.nextToken(); ! String version = st.nextToken(); ! String classi = st.nextToken(); ! String size = st.nextToken(); ! String disk = st.nextToken(); String[] newstr = new String[]{type, name, version, classi, size, disk}; --- 1000,1011 ---- final String[][] newArray = new String[tmptoc.size()][6]; for (int i = 0; i < tmptoc.size(); i++) { ! String[] str = ((String) tmptoc.get(i)).split(":"); ! String type = str[0]; ! String name = str[1]; ! String version = str[2]; ! String classi = str[3]; ! String size = str[4]; ! str = str[5].split("\\s"); ! String disk = str[1]; String[] newstr = new String[]{type, name, version, classi, size, disk}; *************** *** 992,996 **** * get the new stuff */ ! tocArray = getTOC(cfgSourceLabel6.getText()); for (int i = 0; i < tocArray.length; i++) { String[] newrow = new String[]{tocArray[i][7], --- 1043,1048 ---- * get the new stuff */ ! tocpath = cfgSourceLabel6.getText(); ! tocArray = getTOC(tocpath); for (int i = 0; i < tocArray.length; i++) { String[] newrow = new String[]{tocArray[i][7], *************** *** 1015,1020 **** 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"); } --- 1067,1073 ---- if (cfgSourceLabel2.getText().equals("ftp")) { System.out.println("FTP download start"); ! tocpath = coeEnv.getCoeData() + "/local/SysAdm/NET_SERVER"; ! FtpDownload ftpsrc = new FtpDownload("rhinohide.cx", path + "/toc", tocpath); ! path = tocpath; System.out.println("FTP download end"); } *************** *** 1074,1078 **** //new String(reppath+"/"+segment+"/TOC/"+segment+"/SegDescrip/SegName"); String segnamepath = ! new String(reppath + "/" + segment + "/SegDescrip/SegName"); /* --- 1127,1131 ---- //new String(reppath+"/"+segment+"/TOC/"+segment+"/SegDescrip/SegName"); String segnamepath = ! new String(tocpath + "/" + segment + "/SegDescrip/SegName"); /* *************** *** 1321,1327 **** //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 /** --- 1374,1384 ---- //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; + private javax.swing.JFrame thisinstaller; + private String tocpath; + + // 20031018:rb:825985 - COEInstaller S/W row cells should not be editable /** *************** *** 1338,1341 **** --- 1395,1399 ---- private boolean DEBUG = false; + /** * Sets the data attribute of the COEInstallerTableModel object *************** *** 1493,1496 **** --- 1551,1666 ---- } + + /** + * Description of the Method + * + *@param mode Description of the Parameter 20031025:rb:829389 - COEInstaller + * Requires,Conflicts, and Release Notes + */ + private void showReleaseNotes(String mode) { + + String path = new String(); + if (mode.equals("Installed")) { + // get first selected Installed segment + int[] rows = swInstalledTable.getSelectedRows(); + path = (String) swInstalledTable.getValueAt(rows[0], 5); + path.trim(); + path = path + "/SegDescrip"; + } else { + // get first selected Available segment + int[] rows = swAvailableTable.getSelectedRows(); + String segtype = (String) swAvailableTable.getValueAt(rows[0], 0); + // Segdir: PREFIX-TYPE-VERSION-ARCH + String sep = coeEnv.getFileSep(); + String segstr = tocArray[rows[0]][4] + sep + + tocArray[rows[0]][7] + sep + + tocArray[rows[0]][8] + sep + + tocArray[rows[0]][3]; + path = tocpath + "/" + segstr + "/SegDescrip"; + } + + // create segment object + System.out.println("COEInstaller::showReleaseNotes::path=" + path); + _OpenCOESegment thisseg = new _OpenCOESegment(new java.io.File(path)); + COETextDialog dialog = new COETextDialog(thisinstaller, "Release Notes", + new javax.swing.JTextArea(thisseg.getReleaseNotes())); + dialog.show(); + } + + + /** + * Description of the Method + * + *@param mode Description of the Parameter 20031025:rb:829389 - COEInstaller + * Requires,Conflicts, and Release Notes + */ + private void showRequires(String mode) { + + String path = new String(); + + if (mode.equals("Installed")) { + path = path + "/SegDescrip"; + } else { + // get first selected Available segment + int[] rows = swAvailableTable.getSelectedRows(); + String segtype = (String) swAvailableTable.getValueAt(rows[0], 0); + // Segdir: PREFIX-TYPE-VERSION-ARCH + String sep = coeEnv.getFileSep(); + String segstr = tocArray[rows[0]][4] + sep + + tocArray[rows[0]][7] + sep + + tocArray[rows[0]][8] + sep + + tocArray[rows[0]][3]; + path = tocpath + "/" + segstr + "/SegDescrip"; + } + + // create segment object + _OpenCOESegment thisseg = new _OpenCOESegment(new java.io.File(path)); + String requires = new String(); + for (java.util.Enumeration e = thisseg.getRequires().elements(); e.hasMoreElements(); ) { + requires = requires + "\n" + (String) e.nextElement(); + } + + COETextDialog dialog = new COETextDialog(thisinstaller, "Requires", + new javax.swing.JTextArea(requires)); + dialog.show(); + } + + + /** + * Description of the Method + * + *@param mode Description of the Parameter 20031025:rb:829389 - COEInstaller + * Requires,Conflicts, and Release Notes + */ + private void showConflicts(String mode) { + + String path = new String(); + + if (mode.equals("Installed")) { + path = path + "/SegDescrip"; + } else { + // get first selected Available segment + int[] rows = swAvailableTable.getSelectedRows(); + String segtype = (String) swAvailableTable.getValueAt(rows[0], 0); + // Segdir: PREFIX-TYPE-VERSION-ARCH + String sep = coeEnv.getFileSep(); + String segstr = tocArray[rows[0]][4] + sep + + tocArray[rows[0]][7] + sep + + tocArray[rows[0]][8] + sep + + tocArray[rows[0]][3]; + path = tocpath + "/" + segstr + "/SegDescrip"; + } + + // create segment object + _OpenCOESegment thisseg = new _OpenCOESegment(new java.io.File(path)); + String conflicts = new String(); + for (java.util.Enumeration e = thisseg.getConflicts().elements(); e.hasMoreElements(); ) { + conflicts = conflicts + "\n" + (String) e.nextElement(); + } + + COETextDialog dialog = new COETextDialog(thisinstaller, "Conflicts", + new javax.swing.JTextArea(conflicts)); + dialog.show(); + } } |