1 28 29 package org.objectweb.fractal.explorer.icon; 30 31 import javax.swing.Icon ; 32 import javax.swing.ImageIcon ; 33 34 import org.objectweb.fractal.api.control.LifeCycleController; 35 import org.objectweb.util.explorer.api.IconProvider; 36 37 42 public class LifeCycleControllerIconProvider 43 implements IconProvider 44 { 45 51 52 protected Icon startIcon, stopIcon; 53 54 60 61 public LifeCycleControllerIconProvider() { 62 try{ 63 startIcon = new ImageIcon (Thread.currentThread().getContextClassLoader().getResource("icons/Started.png")); 64 stopIcon = new ImageIcon (Thread.currentThread().getContextClassLoader().getResource("icons/Stopped.png")); 65 } catch (Exception e) { 66 System.err.println("Resource not found: " + e); 67 } 68 } 69 70 76 82 85 public Object newIcon(Object object) { 86 LifeCycleController lcc = (LifeCycleController) object; 87 String status = lcc.getFcState(); 88 if (status.equals(LifeCycleController.STARTED)) 89 return startIcon; 90 else if (status.equals(LifeCycleController.STOPPED)) 91 return stopIcon; 92 else 93 return null; 94 } 95 } 96 | Popular Tags |