1 23 24 package org.objectweb.clif.console.lib.gui; 25 26 27 import org.objectweb.clif.supervisor.api.TestControl; 28 import org.objectweb.clif.console.lib.ClifDeployDefinition; 29 import javax.swing.JTabbedPane ; 30 import java.awt.event.ContainerListener ; 31 import java.awt.event.ContainerEvent ; 32 import java.util.Map ; 33 import java.util.Iterator ; 34 import java.util.HashMap ; 35 36 37 41 public class GuiMonitorPanel 42 extends JTabbedPane 43 implements ContainerListener 44 { 45 static private final String INJECTOR_LABEL = "injector"; 46 47 48 public GuiMonitorPanel(Map testPlan, TestControl testCtl) 49 { 50 super(); 51 Map bladeKinds = new HashMap (); 52 Iterator iter = testPlan.entrySet().iterator(); 53 while (iter.hasNext()) 54 { 55 Map.Entry entry = (Map.Entry )iter.next(); 56 ClifDeployDefinition def = (ClifDeployDefinition)entry.getValue(); 57 String key; 58 if (def.isProbe()) 59 { 60 key = (String )def.getContext().get("insert"); 61 key = key.substring(0, key.lastIndexOf('.')); 62 key = key.substring(1 + key.lastIndexOf('.')); 63 } 64 else 65 { 66 key = INJECTOR_LABEL; 67 } 68 Map blades = (Map )bladeKinds.get(key); 69 if (blades == null) 70 { 71 blades = new HashMap (); 72 bladeKinds.put(key, blades); 73 } 74 blades.put(entry.getKey(), entry.getValue()); 75 } 76 iter = bladeKinds.entrySet().iterator(); 77 while (iter.hasNext()) 78 { 79 Map.Entry entry = (Map.Entry )iter.next(); 80 String arbitraryBladeId = (String )((Map )entry.getValue()).keySet().iterator().next(); 81 GuiMonitorCard monitorCard = new GuiMonitorCard( 82 (Map )entry.getValue(), 83 testCtl.getStatLabels(arbitraryBladeId), 84 testCtl); 85 this.addContainerListener(monitorCard); 86 add(monitorCard, entry.getKey()); 87 } 88 } 89 90 91 95 96 public void componentAdded(ContainerEvent ev) 97 { 98 } 99 100 101 public void componentRemoved(ContainerEvent ev) 102 { 103 removeAll(); 104 } 105 } 106 | Popular Tags |