1 28 package org.objectweb.openccm.explorer; 29 30 import org.objectweb.fractal.adl.ADLException; 31 import org.objectweb.fractal.adl.Factory; 32 import org.objectweb.fractal.adl.FactoryFactory; 33 import org.objectweb.fractal.api.Component; 34 import org.objectweb.fractal.api.NoSuchInterfaceException; 35 import org.objectweb.fractal.api.control.IllegalLifeCycleException; 36 import org.objectweb.fractal.util.Fractal; 37 import org.objectweb.openccm.explorer.CORBA.ConsoleFactory; 38 import org.objectweb.openccm.explorer.menu.Menu; 39 import org.objectweb.util.explorer.api.Tree; 40 import org.objectweb.util.explorer.context.api.ContextParser; 41 import org.objectweb.util.explorer.parser.api.ParserConfiguration; 42 import org.objectweb.util.explorer.swing.api.Explorer; 43 import org.objectweb.util.explorer.swing.api.StatusBar; 44 import org.objectweb.util.explorer.swing.api.ViewPanel; 45 import org.objectweb.util.explorer.swing.lib.DefaultTreePanel; 46 47 48 import java.awt.Dimension ; 49 import java.awt.BorderLayout ; 50 52 import javax.swing.JTabbedPane ; 53 54 60 public class MainPDA 61 extends Main 62 { 63 64 67 protected void init(String contextPropertyFile, String [] browserPropertyFile){ 68 69 try { 70 Factory f = FactoryFactory.getFactory(FactoryFactory.FRACTAL_BACKEND); 72 Component explorer = (Component)f.newComponent("org.objectweb.openccm.explorer.SwingCCMExplorer",null); 73 Fractal.getLifeCycleController(explorer).startFc(); 74 75 ParserConfiguration parser = (ParserConfiguration)explorer.getFcInterface(ParserConfiguration.PARSER_CONFIGURATION); 77 for (int i = 0; i < browserPropertyFile.length; i++) { 78 parser.addPropertyFile(browserPropertyFile[i]); 79 } 80 parser.parse(); 81 82 ContextParser cParser = (ContextParser)explorer.getFcInterface(ContextParser.CONTEXT_PARSER); 84 cParser.parse(contextPropertyFile); 85 86 Explorer explorerItf = (Explorer)explorer.getFcInterface(Explorer.EXPLORER); 87 Tree treeItf = (Tree)explorer.getFcInterface(Tree.TREE); 88 89 91 Menu menu = new Menu(this, explorer); 93 94 explorerItf.setMultipleRoles(true); 95 explorerItf.setCurrentRoles(new String []{"user view","Deployment administrator","Components administrator","CORBA Administrator","CosNaming administrator"}); 96 explorerItf.setMenuBar(menu.getMenuBar()); 97 explorerItf.setToolBar(menu.getToolBar()); 98 populateTree(treeItf); 99 100 ViewPanel viewPanelItf = (ViewPanel)explorer.getFcInterface(ViewPanel.VIEW_PANEL); 101 StatusBar statusBarItf = (StatusBar)explorer.getFcInterface(StatusBar.STATUS_BAR); 102 103 initializeTreeDialog(treeItf); 105 106 setJMenuBar(menu.getMenuBar()); 107 108 getContentPane().setLayout(new BorderLayout ()); 109 getContentPane().add(menu.getToolBar(),BorderLayout.NORTH); 110 JTabbedPane tabbedPane = new JTabbedPane (); 111 tabbedPane.addTab("Tree", new DefaultTreePanel(explorerItf.getTree())); 112 tabbedPane.addTab("View", viewPanelItf.getViewPanel()); 113 getContentPane().add(tabbedPane, BorderLayout.CENTER); 114 getContentPane().add(statusBarItf.getStatusBar(),BorderLayout.SOUTH); 115 116 addWindowListener(new OpenCCMWindowListener(treeItf)); 118 pack(); 119 120 Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize(); 122 setLocation((screenSize.width - getWidth()) / 2, (screenSize.height - getHeight()) / 2); 123 124 setVisible(true); 125 } catch (ADLException e) { 126 ConsoleFactory.getDebugConsole().add(e.getMessage()); 127 } catch (IllegalLifeCycleException e) { 128 ConsoleFactory.getDebugConsole().add(e.getMessage()); 129 } catch (NoSuchInterfaceException e) { 130 ConsoleFactory.getDebugConsole().add(e.getMessage()); 131 } 132 catch (Exception e) { 133 ConsoleFactory.getDebugConsole().add(e.getMessage()); 134 } 135 } 136 137 140 public MainPDA(String contextPropertyFile, String [] browserPropertyFile) { 141 super(contextPropertyFile, browserPropertyFile); 142 } 143 144 } 145 | Popular Tags |