1 26 package org.objectweb.util.explorer.swing.panel; 27 28 import java.awt.Color ; 29 import java.util.Iterator ; 30 import java.util.Vector ; 31 32 import javax.swing.BoxLayout ; 33 import javax.swing.JPanel ; 34 35 import org.objectweb.util.explorer.api.Panel; 36 import org.objectweb.util.explorer.api.TreeView; 37 import org.objectweb.util.explorer.swing.api.CompositePanel; 38 39 47 public class BasicCompositePanel 48 extends JPanel 49 implements CompositePanel, Panel 50 { 51 52 58 59 protected Vector panelList_; 60 61 67 public BasicCompositePanel(){ 68 panelList_ = new Vector (); 69 setBackground(Color.white); 70 setLayout(new BoxLayout (this, BoxLayout.Y_AXIS)); 71 } 72 73 79 85 88 public void add(Panel panel) { 89 if(panel!=null){ 90 panelList_.add(panel); 91 } 92 } 93 94 100 103 public void selected(TreeView treeView) { 104 Iterator it = panelList_.iterator(); 105 while (it.hasNext()) { 106 Panel element = (Panel ) it.next(); 107 element.selected(treeView); 108 } 109 } 110 111 114 public Object getPanel() { 115 Iterator it = panelList_.iterator(); 116 while (it.hasNext()) { 117 Panel element = (Panel ) it.next(); 118 add((JPanel )element.getPanel()); 119 } 120 return this; 121 } 122 123 126 public void unselected(TreeView treeView) { 127 Iterator it = panelList_.iterator(); 128 while (it.hasNext()) { 129 Panel element = (Panel ) it.next(); 130 element.unselected(treeView); 131 } 132 } 133 134 } 135 | Popular Tags |