1 26 27 package org.objectweb.openccm.explorer.CosTrading.gui; 28 29 import java.awt.Color ; 30 31 import javax.swing.Box ; 32 import javax.swing.BoxLayout ; 33 import javax.swing.JPanel ; 34 import javax.swing.JScrollPane ; 35 import javax.swing.JTable ; 36 import javax.swing.border.TitledBorder ; 37 import javax.swing.table.TableModel ; 38 39 import org.omg.CosTradingRepos.ServiceTypeRepositoryPackage.TypeStruct; 40 41 47 public class ServiceTypePanel extends DefaultNodeViewPanel { 48 49 55 protected TypeStruct type_; 56 57 63 66 public ServiceTypePanel() { 67 setBackground(Color.white); 68 setLayout(new BoxLayout (this, BoxLayout.Y_AXIS)); 69 } 70 71 77 82 protected JPanel addProperties() { 83 JPanel propertiesPanel = new JPanel (); 84 propertiesPanel.setBackground(Color.white); 85 propertiesPanel.setBorder(new TitledBorder (null," Properties ",TitledBorder.CENTER,TitledBorder.TOP)); 86 propertiesPanel.setLayout(new java.awt.GridLayout (1, 1)); 87 88 Box box = Box.createVerticalBox(); 89 90 box.add(Box.createVerticalGlue()); 91 TableModel dataModel = new ServiceTypePropsTableModel(type_.props); 93 JTable table = new JTable (dataModel); 94 table.setBackground(Color.white); 95 table.setPreferredScrollableViewportSize(table.getMaximumSize()); 96 97 JScrollPane scrollpane = new JScrollPane (table); 98 scrollpane.getViewport().setBackground(Color.white); 99 scrollpane.setBackground(Color.white); 100 101 box.add(scrollpane); 102 box.add(Box.createVerticalGlue()); 103 104 propertiesPanel.add(box); 105 106 return propertiesPanel; 107 } 108 109 114 protected JPanel addInterface() { 115 JPanel itfPanel = new JPanel (); 116 itfPanel.setBackground(Color.white); 117 itfPanel.setBorder(new TitledBorder (null," IDL interface ",TitledBorder.CENTER,TitledBorder.TOP)); 118 119 Box box = Box.createVerticalBox(); 120 String if_name = type_.if_name; 121 box.add(new ItfGUI(if_name)); 122 itfPanel.add(box); 123 124 return itfPanel; 125 } 126 127 132 protected JPanel addSuperTypes() { 133 JPanel stPanel = new JPanel (); 134 stPanel.setBackground(Color.white); 135 stPanel.setBorder(new TitledBorder (null," Super types ",TitledBorder.CENTER,TitledBorder.TOP)); 136 137 Box box = Box.createVerticalBox(); 138 String [] st = type_.super_types; 139 box.add(new SuperTypesGUI(st)); 140 stPanel.add(box); 141 142 return stPanel; 143 } 144 145 151 154 public void onSetTreeView() { 155 if (getTreeView() != null) { 156 type_ = (TypeStruct)getTreeView().getSelectedObject(); 157 if (type_ != null) { 158 add(addSuperTypes()); 159 add(addInterface()); 160 add(addProperties()); 161 } 162 } 163 } 164 } 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 | Popular Tags |