1 26 package org.objectweb.util.explorer.core.panel.lib; 27 28 import java.util.Iterator ; 29 import java.util.List ; 30 import java.util.Vector ; 31 32 import org.objectweb.util.explorer.core.panel.api.CompositePanelDescription; 33 import org.objectweb.util.explorer.core.panel.api.PanelDescription; 34 35 43 public class BasicCompositePanelDescription 44 extends AbstractPanelDescription 45 implements CompositePanelDescription 46 { 47 48 54 protected List panels_ = null; 55 56 62 public BasicCompositePanelDescription(){ 63 panels_ = new Vector (); 64 } 65 66 72 78 81 public String getPanelType() { 82 return COMPOSITE_PANEL; 83 } 84 85 88 public void addPanelDescription(PanelDescription panelDesc) { 89 if(panelDesc!=null && !panelDesc.isEmpty()){ 90 if(panelDesc.inheritTypePanel()) 91 inheritTypePanel_ = true; 92 try{ 93 CompositePanelDescription source = (CompositePanelDescription)panelDesc; 94 addPanelDescriptions(source.getPanelDescriptions()); 95 } catch(ClassCastException e){ 96 panels_.add(panelDesc); 97 } 98 } 99 } 100 101 104 public void addPanelDescriptions(PanelDescription[] panelDescs) { 105 if(panelDescs != null){ 106 for (int i = 0; i < panelDescs.length; i++) { 107 addPanelDescription(panelDescs[i]); 108 } 109 } 110 } 111 112 115 public PanelDescription[] getPanelDescriptions() { 116 return (PanelDescription[])panels_.toArray(new PanelDescription[panels_.size()]); 117 } 118 119 120 123 public boolean isEmpty() { 124 return panels_.isEmpty(); 125 } 126 127 130 public String toString(){ 131 StringBuffer buf = new StringBuffer (); 132 buf.append("BasicCompositePanelDescription[panels="); 133 Iterator it = panels_.iterator(); 134 while (it.hasNext()) { 135 buf.append(it.next() + ", "); 136 } 137 buf.append("]"); 138 return buf.toString(); 139 } 140 } 141 142 143 | Popular Tags |