1 26 27 package org.objectweb.util.browser.core.panel; 28 29 30 import org.objectweb.util.browser.api.Context; 31 import org.objectweb.util.browser.api.Entry; 32 import org.objectweb.util.browser.api.TreeView; 33 import org.objectweb.util.browser.api.Panel; 34 35 36 import java.awt.Color ; 37 import javax.swing.Box ; 38 import javax.swing.JPanel ; 39 import javax.swing.JTextField ; 40 import javax.swing.border.TitledBorder ; 41 42 48 public class ContextPanel 49 implements Panel { 50 51 57 58 protected JPanel panel_ = null; 59 60 61 protected Box box_ = null; 62 63 69 72 public ContextPanel() { 73 panel_ = new JPanel (); 74 panel_.setBackground(Color.white); 75 box_ = Box.createVerticalBox(); 76 panel_.add(box_); 77 } 78 79 85 91 94 public void selected(TreeView treeView) { 95 Context context = (Context) treeView.getSelectedEntry().getValue(); 96 if (context != null) { 97 Entry[] entries = context.getEntries(); 98 for (int i = 0; i < entries.length; i++) { 99 Entry entry = entries[i]; 100 String text = entry.getValue().toString(); 101 JTextField textField = new JTextField (text); 102 textField.setEditable(false); 103 textField.setBackground(Color.white); 104 textField.setBorder(new TitledBorder (null, entry.getName().toString(), TitledBorder.LEFT, TitledBorder.TOP)); 105 box_.add(textField); 106 } 107 } 108 } 109 110 114 public JPanel getPanel(){ 115 return panel_; 116 } 117 118 121 public void unselected(TreeView treeView) { 122 } 123 124 } 125 | Popular Tags |