[opencoe-cvs] coekernel/src/COE/src/COE/java/org/opencoe/coe/kernel/apps ApplicationManager.java,1.2
Status: Alpha
Brought to you by:
rbroberg
Update of /cvsroot/opencoe/coekernel/src/COE/src/COE/java/org/opencoe/coe/kernel/apps In directory sc8-pr-cvs1:/tmp/cvs-serv25433/java/org/opencoe/coe/kernel/apps Modified Files: ApplicationManager.java ProfileSelector.java _ApplicationManagerModel.java _ApplicationManagerTree.java Log Message: [ 841518 ] COESegInstall incorrectly parses args in Icons [ 841521 ] ApplicationManager mishandles arguments for commands Index: ApplicationManager.java =================================================================== RCS file: /cvsroot/opencoe/coekernel/src/COE/src/COE/java/org/opencoe/coe/kernel/apps/ApplicationManager.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ApplicationManager.java 21 Jun 2002 22:43:57 -0000 1.2 --- ApplicationManager.java 15 Nov 2003 19:49:34 -0000 1.3 *************** *** 1,28 **** /** ! * 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.*; /* ! * An example provided by tutorial reader Olivier Berlanger. */ import javax.swing.*; --- 1,21 ---- /** ! * 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.*; /* ! * An example provided by tutorial reader Olivier Berlanger. */ import javax.swing.*; *************** *** 31,134 **** import java.util.*; public class ApplicationManager extends JFrame { ! _ApplicationManagerTree tree; - public ApplicationManager() { - super("ApplicationManager tree demo"); - // add window listener - addWindowListener(new WindowAdapter() { - public void windowClosing(WindowEvent e) { - System.exit(0); - } - }); - // construct the tree - tree = new _ApplicationManagerTree(getProfileGraph()); - JScrollPane scrollPane = new JScrollPane(tree); - scrollPane.setPreferredSize(new Dimension(200, 200)); ! // construct the content pane ! JPanel contentPane = new JPanel(new BorderLayout()); ! contentPane.add(scrollPane, BorderLayout.CENTER); ! setContentPane(contentPane); ! } ! public _OpenCOEProfile getProfileGraph(){ ! _OpenCOEProfile p; // tmp variable for a profile ! _OpenCOEApp a; // tmp variable for an application ! String t; // tmp variable for profile name ! ArrayList profile = new ArrayList(); ! ArrayList apps = new ArrayList(); - // Create the top level (root) Profile - _OpenCOEProfile rootProfile = - new _OpenCOEProfile("OpenCOE Profile Manager", - "Dummy Profile for App Manager"); ! // get current profiles from COE tool ! _OpenCOECmdExec COE_get_current_profiles = ! new _OpenCOECmdExec("COE_HOME/bin/COE_get_current_profiles"); ! // load profile names into an Array ! ArrayList tmp=COE_get_current_profiles.getOutput(); ! // for every profile name ! // create a profile ! // and assign it to the root profile ! for (int i=0; i<tmp.size(); i++) { ! t=(String)tmp.get(i); ! StringTokenizer st = new StringTokenizer(t, ":"); ! p = new _OpenCOEProfile ! (st.nextToken(),"Test Profile", st.nextToken()); ! profile.add(p); ! rootProfile.assignProfile(p); ! } ! // for every profile, get COE assigned applications ! for (int i=0; i<profile.size(); i++) ! { ! // construct the command line for the COE call ! p = (_OpenCOEProfile)profile.get(i); ! //"\""+p.getName()+"\"", ! String[] cmd = new String[]{"COE_HOME/bin/COE_get_profileapp_data", ! p.getName(), ! p.getScope() }; ! _OpenCOECmdExec COE_get_current_apps = new _OpenCOECmdExec(cmd); ! // flush the temp array and load it with a list of apps ! tmp.clear(); ! tmp=COE_get_current_apps.getOutput(); ! // for every application in the list, ! // create an application ! // and assign to it to the profile ! for (int j=0; j<tmp.size(); j++) { ! t=(String)tmp.get(j); ! System.out.println("testout: "+t); ! StringTokenizer st = new StringTokenizer(t, ":"); ! a = new _OpenCOEApp (st.nextToken(), st.nextToken(), ! st.nextToken(), st.nextToken(), ! st.nextToken()); ! p.assignApp(a); } - } - - // Create and Assign default Applications (root level apps) - _OpenCOEApp rootApp1 = - new _OpenCOEApp("Web Browser"); - _OpenCOEApp rootApp2 = - new _OpenCOEApp("Chat Client"); - rootApp1.setExecPath("COE_HOME/COTS/WEBBr/bin/netscape"); - rootApp2.setExecPath("COE_HOME/COTS/IRCC/bin/IRCC_zircon.init"); - rootProfile.assignApp(rootApp1); - rootProfile.assignApp(rootApp2); ! return rootProfile; ! } ! public static void main(String[] args) { ! // create a frame ! JFrame mainFrame = new ApplicationManager(); ! mainFrame.pack(); ! mainFrame.setVisible(true); ! } } --- 24,165 ---- import java.util.*; + /** + * Description of the Class + * + *@author rbroberg + *@created November 14, 2003 + *@history 20031113:rb - reformatted + */ public class ApplicationManager extends JFrame { ! _ApplicationManagerTree tree; ! ArrayList profile; ! ArrayList apps; ! _OpenCOEProfile rootProfile; ! /** ! * Constructor for the ApplicationManager object ! */ ! public ApplicationManager() { ! super("ApplicationManager tree demo"); ! // add window listener ! addWindowListener( ! new WindowAdapter() { ! public void windowClosing(WindowEvent e) { ! System.exit(0); ! } ! }); ! // construct the tree ! tree = new _ApplicationManagerTree(getProfileGraph()); ! JScrollPane scrollPane = new JScrollPane(tree); ! scrollPane.setPreferredSize(new Dimension(200, 200)); ! // construct the content pane ! JPanel contentPane = new JPanel(new BorderLayout()); ! contentPane.add(scrollPane, BorderLayout.CENTER); ! setContentPane(contentPane); ! } ! /** ! * Gets the profileGraph attribute of the ApplicationManager object ! * ! *@return The profileGraph value ! */ ! public _OpenCOEProfile getProfileGraph() { ! _OpenCOEProfile p; ! // tmp variable for a profile ! _OpenCOEApp a; ! // tmp variable for an application ! String t; ! // tmp variable for profile name ! profile = new ArrayList(); ! apps = new ArrayList(); ! // Create the top level (root) Profile ! rootProfile = ! new _OpenCOEProfile("OpenCOE Profile Manager", ! "Dummy Profile for App Manager"); ! // get current profiles from COE tool ! _OpenCOECmdExec COE_get_current_profiles = ! new _OpenCOECmdExec("COE_HOME/bin/COE_get_current_profiles"); ! // load profile names into an Array ! ArrayList tmp = COE_get_current_profiles.getOutput(); ! // for every profile name ! // create a profile ! // and assign it to the root profile ! for (int i = 0; i < tmp.size(); i++) { ! t = (String) tmp.get(i); ! StringTokenizer st = new StringTokenizer(t, ":"); ! p = new _OpenCOEProfile ! (st.nextToken(), "Test Profile", st.nextToken()); ! profile.add(p); ! rootProfile.assignProfile(p); ! } ! for (int i = 0; i < profile.size(); i++) { ! // construct the command line for the COE call ! p = (_OpenCOEProfile) profile.get(i); ! //"\""+p.getName()+"\"", ! String[] cmd = new String[]{"COE_HOME/bin/COE_get_profileapp_data", ! p.getName(), ! p.getScope()}; ! _OpenCOECmdExec COE_get_current_apps = new _OpenCOECmdExec(cmd); ! ! // flush the temp array and load it with a list of apps ! tmp.clear(); ! tmp = COE_get_current_apps.getOutput(); ! ! // for every application in the list, ! // create an application ! // and assign to it to the profile ! for (int j = 0; j < tmp.size(); j++) { ! t = (String) tmp.get(j); ! System.out.println("testout: " + t); ! StringTokenizer st = new StringTokenizer(t, ":"); ! a = new _OpenCOEApp(st.nextToken(), st.nextToken(), ! st.nextToken(), st.nextToken(), ! st.nextToken()); ! if (st.hasMoreElements()) { ! a.setArgs(st.nextToken()); ! } ! p.assignApp(a); ! } } ! // Create and Assign default Applications (root level apps) ! // for every profile, get COE assigned applications ! _OpenCOEApp rootApp0 = ! new _OpenCOEApp("Profile Selector"); ! rootApp0.setExecPath("COE_HOME/bin/ProfileSelector"); ! rootApp0.setInitClass("org.opencoe.coe.kernel.apps.ProfileSelector"); ! rootProfile.assignApp(rootApp0); ! _OpenCOEApp rootApp1 = ! new _OpenCOEApp("Web Browser"); ! //_OpenCOEApp rootApp2 = ! //new _OpenCOEApp("Chat Client"); ! rootApp1.setExecPath("COE_APPS/MOZILLA/mozilla"); ! //rootApp2.setExecPath("COE_HOME/COTS/IRCC/bin/IRCC_zircon.init"); ! rootProfile.assignApp(rootApp1); ! //rootProfile.assignApp(rootApp2); ! ! return rootProfile; ! } ! ! /** ! * The main program for the ApplicationManager class ! * ! *@param args The command line arguments ! */ ! public static void main(String[] args) { ! // create a frame ! JFrame mainFrame = new ApplicationManager(); ! mainFrame.pack(); ! mainFrame.setVisible(true); ! } } + Index: ProfileSelector.java =================================================================== RCS file: /cvsroot/opencoe/coekernel/src/COE/src/COE/java/org/opencoe/coe/kernel/apps/ProfileSelector.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ProfileSelector.java 16 Aug 2003 23:19:39 -0000 1.3 --- ProfileSelector.java 15 Nov 2003 19:49:34 -0000 1.4 *************** *** 41,44 **** --- 41,45 ---- initComponents (); pack (); + show(); } *************** *** 220,229 **** for (int i=0; i<selectedList.getItemCount(); i++) System.out.println(selectedList.getItem(i)); ! System.exit (0); } else if (source == applyButton) { for (int i=0; i<selectedList.getItemCount(); i++) System.out.println(selectedList.getItem(i)); } else if (source == quitButton) { ! System.exit (0); } else if (source == selectButton) { // this might be kinda of stupid --- 221,232 ---- for (int i=0; i<selectedList.getItemCount(); i++) System.out.println(selectedList.getItem(i)); ! //System.exit (0); ! close(); } else if (source == applyButton) { for (int i=0; i<selectedList.getItemCount(); i++) System.out.println(selectedList.getItem(i)); } else if (source == quitButton) { ! // System.exit (0); ! close(); } else if (source == selectButton) { // this might be kinda of stupid *************** *** 286,290 **** this_list.deselect(i); } - public void refreshAll () { --- 289,292 ---- *************** *** 329,332 **** --- 331,338 ---- + private void close() { + dispose(); + } + /** * @param args the command line arguments *************** *** 336,341 **** } - - // Variables declaration - do not modify private JPanel assignPanel; private JLabel assignLabel; --- 342,345 ---- Index: _ApplicationManagerModel.java =================================================================== RCS file: /cvsroot/opencoe/coekernel/src/COE/src/COE/java/org/opencoe/coe/kernel/apps/_ApplicationManagerModel.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** _ApplicationManagerModel.java 19 Apr 2002 15:18:00 -0000 1.1.1.1 --- _ApplicationManagerModel.java 15 Nov 2003 19:49:34 -0000 1.2 *************** *** 1,24 **** /** ! * 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.*; --- 1,17 ---- /** ! * 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.*; *************** *** 27,108 **** import java.util.Vector; public class _ApplicationManagerModel implements TreeModel { ! private boolean showAncestors; ! private Vector treeModelListeners = new Vector(); ! private _OpenCOEProfile rootProfile; - public _ApplicationManagerModel(_OpenCOEProfile root) { - showAncestors = false; - rootProfile = root; - } //////////////// TreeModel interface implementation /////////////////////// ! /** ! * Adds a listener for the TreeModelEvent posted after the tree changes. ! */ ! public void addTreeModelListener(TreeModelListener l) { ! treeModelListeners.addElement(l); ! } - /** - * Returns the child of parent at index index in the parent's child array. - */ - public Object getChild(Object parent, int index) { - _OpenCOEProfile p = (_OpenCOEProfile)parent; - return p.getCombined(index); - } ! /** ! * Returns the number of children of parent. ! */ ! public int getChildCount(Object parent) { ! _OpenCOEProfile p = (_OpenCOEProfile)parent; ! return p.getCombinedCount(); ! } - /** - * Returns the index of child in parent. - */ - public int getIndexOfChild(Object parent, Object child) { - _OpenCOEProfile p = (_OpenCOEProfile)parent; - return p.getIndexOfCombined(child); - } ! /** ! * Returns the root of the tree. ! */ ! public Object getRoot() { ! return rootProfile; ! } ! /** ! * Returns true if node is a leaf. ! */ ! public boolean isLeaf(Object node) { ! String nodename = node.getClass().getName(); ! //System.out.println("isLeaf nodename: "+nodename); ! if (nodename.equals("org.opencoe.coe.kernel.util._OpenCOEProfile")){ ! return false; ! } else { ! return true; } - } ! /** ! * Removes a listener previously added with addTreeModelListener(). ! */ ! public void removeTreeModelListener(TreeModelListener l) { ! treeModelListeners.removeElement(l); ! } ! /** ! * Messaged when the user has altered the value for the item ! * identified by path to newValue. Not used by this model. ! */ ! public void valueForPathChanged(TreePath path, Object newValue) { ! System.out.println("*** valueForPathChanged : " ! + path + " --> " + newValue); ! } } --- 20,146 ---- import java.util.Vector; + /** + * Description of the Class + * + *@author rbroberg + *@created November 14, 2003 + *@history 20031113:rb - reformatted + */ public class _ApplicationManagerModel implements TreeModel { ! private boolean showAncestors; ! private Vector treeModelListeners = new Vector(); ! private _OpenCOEProfile rootProfile; ! ! ! /** ! * Constructor for the _ApplicationManagerModel object ! * ! *@param root Description of the Parameter ! */ ! public _ApplicationManagerModel(_OpenCOEProfile root) { ! showAncestors = false; ! rootProfile = root; ! } //////////////// TreeModel interface implementation /////////////////////// ! /** ! * Adds a listener for the TreeModelEvent posted after the tree changes. ! * ! *@param l The feature to be added to the TreeModelListener attribute ! */ ! public void addTreeModelListener(TreeModelListener l) { ! treeModelListeners.addElement(l); ! } ! /** ! * Returns the child of parent at index index in the parent's child array. ! * ! *@param parent Description of the Parameter ! *@param index Description of the Parameter ! *@return The child value ! */ ! public Object getChild(Object parent, int index) { ! _OpenCOEProfile p = (_OpenCOEProfile) parent; ! return p.getCombined(index); ! } ! /** ! * Returns the number of children of parent. ! * ! *@param parent Description of the Parameter ! *@return The childCount value ! */ ! public int getChildCount(Object parent) { ! _OpenCOEProfile p = (_OpenCOEProfile) parent; ! return p.getCombinedCount(); ! } ! ! /** ! * Returns the index of child in parent. ! * ! *@param parent Description of the Parameter ! *@param child Description of the Parameter ! *@return The indexOfChild value ! */ ! public int getIndexOfChild(Object parent, Object child) { ! _OpenCOEProfile p = (_OpenCOEProfile) parent; ! return p.getIndexOfCombined(child); } ! /** ! * Returns the root of the tree. ! * ! *@return The root value ! */ ! public Object getRoot() { ! return rootProfile; ! } ! ! /** ! * Returns true if node is a leaf. ! * ! *@param node Description of the Parameter ! *@return The leaf value ! */ ! public boolean isLeaf(Object node) { ! String nodename = node.getClass().getName(); ! //System.out.println("isLeaf nodename: "+nodename); ! if (nodename.equals("org.opencoe.coe.kernel.util._OpenCOEProfile")) { ! return false; ! } else { ! return true; ! } ! ! } ! ! ! /** ! * Removes a listener previously added with addTreeModelListener(). ! * ! *@param l Description of the Parameter ! */ ! public void removeTreeModelListener(TreeModelListener l) { ! treeModelListeners.removeElement(l); ! } ! ! ! /** ! * Messaged when the user has altered the value for the item identified by ! * path to newValue. Not used by this model. ! * ! *@param path Description of the Parameter ! *@param newValue Description of the Parameter ! */ ! public void valueForPathChanged(TreePath path, Object newValue) { ! System.out.println("*** valueForPathChanged : " ! + path + " --> " + newValue); ! } } + Index: _ApplicationManagerTree.java =================================================================== RCS file: /cvsroot/opencoe/coekernel/src/COE/src/COE/java/org/opencoe/coe/kernel/apps/_ApplicationManagerTree.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** _ApplicationManagerTree.java 19 Apr 2002 15:18:00 -0000 1.1.1.1 --- _ApplicationManagerTree.java 15 Nov 2003 19:49:34 -0000 1.2 *************** *** 1,24 **** /** ! * 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.*; --- 1,17 ---- /** ! * 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.*; *************** *** 27,71 **** import javax.swing.event.*; public class _ApplicationManagerTree extends JTree { ! _ApplicationManagerModel model; - public _ApplicationManagerTree(_OpenCOEProfile graphNode) { - super(new _ApplicationManagerModel(graphNode)); - getSelectionModel().setSelectionMode( - TreeSelectionModel.SINGLE_TREE_SELECTION); - DefaultTreeCellRenderer renderer = new DefaultTreeCellRenderer(); - Icon appIcon = new ImageIcon("/h/COE/data/Icons/gnome-run.png"); - Icon profIcon = new ImageIcon("/h/COE/data/Icons/gnome-folder.png"); - renderer.setLeafIcon(appIcon); - renderer.setClosedIcon(profIcon); - renderer.setOpenIcon(profIcon); - setCellRenderer(renderer); ! //Listen for when the selection changes. ! addTreeSelectionListener(new TreeSelectionListener() { ! public void valueChanged(TreeSelectionEvent e) { ! //DefaultMutableTreeNode node = (DefaultMutableTreeNode) ! //getLastSelectedPathComponent(); ! Object node = (Object) ! getLastSelectedPathComponent(); ! ! if (node == null) return; ! // Object nodeInfo = node.getUserObject(); ! //if (_ApplicationManagerModel.isLeaf(node)) { ! String nodename = node.getClass().getName(); ! //System.out.println("2 - nodename = "+nodename); ! if (nodename.equals("org.opencoe.coe.kernel.util._OpenCOEApp")){ ! _OpenCOEApp n = (_OpenCOEApp)node; ! String c = n.getExecPath(); ! System.out.println("Application node: "+c); ! _OpenCOECmdExec launch_app = new _OpenCOECmdExec(c, true); ! } else { ! System.out.println("Profile node:"); ! } } ! }); ! } } --- 20,110 ---- import javax.swing.event.*; + /** + * Description of the Class + * + *@author rbroberg + *@created November 14, 2003 + *@history 20031113:rb - reformatted + */ public class _ApplicationManagerTree extends JTree { ! _ApplicationManagerModel model; ! /** ! * Constructor for the _ApplicationManagerTree object ! * ! *@param graphNode Description of the Parameter ! */ ! public _ApplicationManagerTree(_OpenCOEProfile graphNode) { ! super(new _ApplicationManagerModel(graphNode)); ! getSelectionModel().setSelectionMode( ! TreeSelectionModel.SINGLE_TREE_SELECTION); ! DefaultTreeCellRenderer renderer = new DefaultTreeCellRenderer(); ! Icon appIcon = new ImageIcon("/h/COE/data/Icons/gnome-run.png"); ! Icon profIcon = new ImageIcon("/h/COE/data/Icons/gnome-folder.png"); ! renderer.setLeafIcon(appIcon); ! renderer.setClosedIcon(profIcon); ! renderer.setOpenIcon(profIcon); ! setCellRenderer(renderer); ! //Listen for when the selection changes. ! addTreeSelectionListener( ! new TreeSelectionListener() { ! ! public void valueChanged(TreeSelectionEvent e) { ! //DefaultMutableTreeNode node = (DefaultMutableTreeNode) ! //getLastSelectedPathComponent(); ! Object node = (Object) ! getLastSelectedPathComponent(); ! ! if (node == null) { ! return; ! } ! ! // Object nodeInfo = node.getUserObject(); ! //if (_ApplicationManagerModel.isLeaf(node)) { ! String nodename = node.getClass().getName(); ! //System.out.println("2 - nodename = "+nodename); ! if (nodename.equals("org.opencoe.coe.kernel.util._OpenCOEApp")) { ! _OpenCOEApp n = (_OpenCOEApp) node; ! String c; ! if (n.getInitClass() != null) { ! c = n.getInitClass(); ! System.out.println("Node::initclass::"+c); ! //ClassLoader cl = new ClassLoader(); ! initLoadClass(c); ! ! } else { ! if (n.getArgs() != null) { ! c = n.getExecPath() + " " + n.getArgs(); ! } else { ! c = n.getExecPath(); ! } ! System.out.println("Application node: " + c); ! _OpenCOECmdExec launch_app = new _OpenCOECmdExec(c, true); ! } ! } else { ! System.out.println("Profile node:"); ! } ! } ! }); ! } ! private static Class initLoadClass (String c) { ! Class cc = null; ! ClassLoader cl = ClassLoader.getSystemClassLoader(); ! try { ! Object co = cl.loadClass(c).newInstance(); ! //cc = (Class)co; ! //co.getClass().show(); ! } catch (ClassNotFoundException cnfe) { ! System.err.println("_ApplicationManagerTree::initLoadClass::ClassNotFound::"+c); ! } catch (java.lang.InstantiationException ie) { ! System.err.println("_ApplicationManagerTree::initLoadClass::InstantiationException::"+c); ! } catch (java.lang.IllegalAccessException ie) { ! System.err.println("_ApplicationManagerTree::initLoadClass::IllegalAccessException::"+c); } ! return cc; ! } } |