1 28 29 package org.objectweb.fractal.explorer.panel; 30 31 import org.objectweb.fractal.api.Component; 32 import org.objectweb.fractal.api.Interface; 33 import org.objectweb.fractal.api.NoSuchInterfaceException; 34 import org.objectweb.fractal.api.control.BindingController; 35 import org.objectweb.fractal.api.control.ContentController; 36 import org.objectweb.fractal.api.control.NameController; 37 import org.objectweb.fractal.api.type.InterfaceType; 38 import org.objectweb.fractal.explorer.FcExplorer; 39 import org.objectweb.fractal.explorer.context.InterfaceWrapperFactory; 40 import org.objectweb.fractal.explorer.lib.SignatureWrapper; 41 import org.objectweb.util.explorer.api.Entry; 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 51 public class InternalInterfacesTable 52 implements Table 53 { 54 55 61 67 68 protected NameController nameController_; 69 70 76 79 protected Entry getBoundInterface(Interface itf, BindingController bc){ 80 if(bc!=null){ 81 try{ 82 Interface bindInterface = (Interface)bc.lookupFc(itf.getFcItfName()); 83 if(bindInterface!=null) 84 return new DefaultEntry(FcExplorer.getPrefixedName(bindInterface), bindInterface); 85 } catch(NoSuchInterfaceException e) { 86 return null; 87 } 88 } 89 return null; 90 } 91 92 95 protected BindingController getBindingController(Interface itf){ 96 Component comp = itf.getFcItfOwner(); 97 try{ 98 return FcExplorer.getBindingController(comp); 99 }catch(NoSuchInterfaceException e){ 100 return null; 101 } 102 } 103 104 107 protected NameController getNameController(Interface itf){ 108 Component comp = itf.getFcItfOwner(); 109 try{ 110 return FcExplorer.getNameController(comp); 111 }catch(NoSuchInterfaceException e){ 112 return null; 113 } 114 } 115 116 119 protected Object [] getValues(Interface itf, BindingController bc){ 120 Object [] values = new Object [3]; 121 String sign = ((InterfaceType)itf.getFcItfType()).getFcItfSignature(); 122 values[0] = new DefaultEntry(FcExplorer.getName(itf), InterfaceWrapperFactory.singleton().getWrapper(itf)); 123 values[1] = new DefaultEntry(sign, new SignatureWrapper(sign)); 124 values[2] = getBoundInterface(itf,bc); 125 return values; 126 } 127 128 131 protected ContentController provideContentController(TreeView treeView){ 132 return (ContentController)treeView.getSelectedObject(); 133 } 134 135 141 145 public String [] getHeaders(TreeView treeView) { 146 return new String []{"Interface", "Type", "Connected"}; 147 } 148 149 153 public Object [][] getRows(TreeView treeView) { 154 ContentController cc = provideContentController(treeView); 155 BindingController bc = getBindingController((Interface)cc); 156 nameController_ = getNameController((Interface)cc); 157 Object [] interfaces = cc.getFcInternalInterfaces(); 158 Object [][] values = new Object [interfaces.length][1]; 159 for (int i = 0 ; i < interfaces.length ; i++){ 160 values[i] = getValues((Interface)interfaces[i],bc); 161 } 162 return values; 163 } 164 } 165 | Popular Tags |