1 28 29 package org.objectweb.fractal.explorer.icon; 30 31 import javax.swing.Icon ; 32 33 import org.objectweb.fractal.api.NoSuchInterfaceException; 34 import org.objectweb.fractal.api.control.LifeCycleController; 35 import org.objectweb.fractal.explorer.FcExplorer; 36 import org.objectweb.fractal.explorer.api.FractalIconProvider; 37 import org.objectweb.util.explorer.api.IconProvider; 38 import org.objectweb.util.explorer.swing.icon.StringIcon; 39 40 45 public abstract class DefaultFractalIconProvider 46 implements IconProvider, 47 FractalIconProvider 48 { 49 55 56 protected Icon unknownIcon; 57 58 64 public DefaultFractalIconProvider() { 65 unknownIcon = new StringIcon("?"); 66 } 67 68 74 80 83 public Object newIcon(Object object) { 84 LifeCycleController lcc = null; 85 try{ 86 lcc = FcExplorer.getLifeCycleController(FcExplorer.getComponent(object)); 87 } catch(NoSuchInterfaceException e) { 88 try { 89 return newStartedIcon(object); 90 } catch (Exception e1) { 91 return newStoppedIcon(object); 92 } 93 } 94 if(lcc.getFcState().equals(LifeCycleController.STARTED)) 95 return newStartedIcon(object); 96 else 97 return newStoppedIcon(object); 98 } 99 100 105 public Object newStoppedIcon(Object object){ 106 return unknownIcon; 107 } 108 109 114 public abstract Object newStartedIcon(Object object); 115 } | Popular Tags |