1 26 27 package org.objectweb.openccm.explorer.Components; 28 29 30 import java.util.List ; 31 import java.util.Vector ; 32 import java.util.Iterator ; 33 34 35 import org.omg.Components.CCMObject; 36 import org.omg.Components.ComponentPortDescription; 37 import org.omg.Components.FacetDescription; 38 import org.omg.Components.ConsumerDescription; 39 40 import org.objectweb.openccm.explorer.CORBA.TypageCORBA; 41 import org.objectweb.openccm.explorer.util.ior.IorPrinter; 42 import org.objectweb.util.explorer.api.Table; 43 import org.objectweb.util.explorer.api.TreeView; 44 import org.objectweb.util.explorer.core.naming.lib.DefaultEntry; 45 46 53 public class ProvidedInterfacesTable 54 implements Table 55 { 56 57 63 69 75 protected String getName(org.omg.CORBA.Object o) { 76 TypageCORBA tc = new TypageCORBA(o, org.objectweb.openccm.corba.TheORB.getORB()); 77 return tc.getTypeID(); 78 } 79 80 86 89 public String [] getHeaders(TreeView treeView) { 90 return new String []{"Port","Interface"}; 91 } 92 93 96 public Object [][] getRows(TreeView treeView) { 97 org.omg.CORBA.ORB orb = org.objectweb.openccm.corba.TheORB.getORB(); 98 IorPrinter iorPrinter = null; 99 List l = new Vector (); 100 101 CCMObject component = (CCMObject) treeView.getSelectedObject(); 102 ComponentPortDescription cpd = component.get_all_ports(); 103 104 FacetDescription[] fd = cpd.facets; 105 for (int i = 0; i < fd.length; i++) 106 l.add(new Object []{ 107 new DefaultEntry(fd[i].name, fd[i]), 108 new DefaultEntry(getName(fd[i].facet_ref), fd[i].facet_ref) 109 }); 110 111 ConsumerDescription[] cd = cpd.consumers; 112 for (int i = 0; i < cd.length; i++) 113 l.add(new Object []{ 114 new DefaultEntry(cd[i].name, cd[i]), 115 new DefaultEntry(getName(cd[i].consumer), cd[i].consumer) 116 }); 117 118 Object [][] contenu = new Object [l.size()][3]; 119 Iterator it = l.iterator(); 120 int cpt = 0; 121 while(it.hasNext()){ 122 contenu[cpt] = (Object [])it.next(); 123 cpt++; 124 } 125 126 return contenu; 127 128 } 129 } 130 | Popular Tags |