1 28 29 package org.objectweb.util.browser.plugins.fractal.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.util.browser.api.IconProvider; 36 import org.objectweb.util.browser.core.icon.StringIcon; 37 import org.objectweb.util.browser.plugins.fractal.FcBrowser; 38 import org.objectweb.util.browser.plugins.fractal.api.FractalIconProvider; 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 Icon newIcon(Object object) { 84 LifeCycleController lcc = null; 85 try{ 86 lcc = FcBrowser.getLifeCycleController(FcBrowser.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 Icon newStoppedIcon(Object object){ 106 return unknownIcon; 107 } 108 109 114 public abstract Icon newStartedIcon(Object object); 115 } | Popular Tags |