1 26 27 package org.objectweb.util.browser.core.panel; 28 29 import java.awt.Color ; 30 import java.util.Iterator ; 31 import java.util.Vector ; 32 33 import javax.swing.BoxLayout ; 34 import javax.swing.JPanel ; 35 36 import org.objectweb.util.browser.api.Panel; 37 import org.objectweb.util.browser.api.TreeView; 38 import org.objectweb.util.browser.core.api.Composite; 39 40 48 public class DefaultCompositePanel 49 extends JPanel 50 implements Composite, Panel { 51 52 58 59 protected Vector panelList_; 60 61 63 69 72 public DefaultCompositePanel(){ 73 panelList_ = new Vector (); 74 setBackground(Color.white); 75 setLayout(new BoxLayout (this, BoxLayout.Y_AXIS)); 76 77 } 80 81 87 93 97 public void add(Panel panel) { 98 if(panel!=null){ 99 panelList_.add(panel); 100 } 101 } 102 103 109 113 public void selected(TreeView treeView) { 114 Iterator it = panelList_.iterator(); 115 while (it.hasNext()) { 116 Panel element = (Panel ) it.next(); 117 element.selected(treeView); 118 } 119 } 120 121 125 public JPanel getPanel() { 126 Iterator it = panelList_.iterator(); 127 while (it.hasNext()) { 129 Panel element = (Panel ) it.next(); 130 add(element.getPanel()); 132 } 133 return this; 135 } 136 137 141 public void unselected(TreeView treeView) { 142 Iterator it = panelList_.iterator(); 143 while (it.hasNext()) { 144 Panel element = (Panel ) it.next(); 145 element.unselected(treeView); 146 } 147 } 148 149 } 150 151 | Popular Tags |