1 26 27 package org.objectweb.openccm.explorer.CosTrading.gui; 28 29 30 import javax.swing.JPanel ; 31 import java.awt.Color ; 32 import javax.swing.BoxLayout ; 33 import javax.swing.Box ; 34 import javax.swing.border.TitledBorder ; 35 import javax.swing.JLabel ; 36 37 38 import org.omg.CosTrading.LinkPackage.LinkInfo; 39 import org.omg.CosTrading.FollowOption; 40 41 47 public class LinkInfoPanel extends DefaultNodeViewPanel { 48 49 55 56 protected LinkInfo linkInfo_; 57 58 64 67 public LinkInfoPanel() { 68 setBackground(Color.white); 69 setLayout(new BoxLayout (this, BoxLayout.Y_AXIS)); 70 } 71 72 78 83 protected String optionToString(FollowOption o) { 84 if (o.value() == FollowOption._local_only) return "local_only"; 85 if (o.value() == FollowOption._if_no_local) return "if_no_local"; 86 return "always"; 87 } 88 89 95 98 public void onSetTreeView() { 99 if (getTreeView() == null) return; 100 linkInfo_ = (LinkInfo)getTreeView().getSelectedObject(); 101 String name = getTreeView().getSelectedEntry().getName().toString(); 102 if (linkInfo_ != null) { 103 104 JPanel infoPanel = new JPanel (); 105 infoPanel.setBackground(Color.white); 106 infoPanel.setBorder(new TitledBorder (null," " + name + " ",TitledBorder.CENTER,TitledBorder.TOP)); 107 108 Box box = Box.createVerticalBox(); 109 110 box.add(Box.createVerticalGlue()); 111 112 JLabel def = new JLabel (); 113 def.setText("Default Follow Link Rule: " + optionToString(linkInfo_.def_pass_on_follow_rule) + "."); 114 box.add(def); 115 116 box.add(Box.createVerticalStrut(10)); 117 118 JLabel limit = new JLabel (); 119 limit.setText("Limiting Follow Link Rule: " + optionToString(linkInfo_.limiting_follow_rule) + "."); 120 box.add(limit); 121 122 box.add(Box.createVerticalGlue()); 123 infoPanel.add(box); 124 125 add(infoPanel); 126 } 127 } 128 } 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | Popular Tags |