1 28 29 package org.objectweb.util.browser.plugins.fractal.menu; 30 31 import org.objectweb.fractal.api.NoSuchInterfaceException; 32 import org.objectweb.fractal.api.control.LifeCycleController; 33 import org.objectweb.util.browser.api.MenuItem; 34 import org.objectweb.util.browser.api.MenuItemTreeView; 35 import org.objectweb.util.browser.api.TreeView; 36 import org.objectweb.util.browser.plugins.fractal.FcBrowser; 37 import org.objectweb.util.browser.plugins.fractal.api.FractalMenuItem; 38 39 44 public abstract class DefaultFractalMenuItem 45 implements MenuItem, 46 FractalMenuItem 47 { 48 54 60 66 72 75 public int getStatus(TreeView arg0) { 76 LifeCycleController lcc = null; 77 try{ 78 lcc = FcBrowser.getLifeCycleController(FcBrowser.getComponent(arg0.getSelectedObject())); 79 } catch(NoSuchInterfaceException e) { 80 try { 81 return getStartedStatus(arg0); 82 } catch (Exception e1) { 83 return getStoppedStatus(arg0); 84 } 85 } 86 if(lcc.getFcState().equals(LifeCycleController.STARTED)) 87 return getStartedStatus(arg0); 88 else 89 return getStoppedStatus(arg0); 90 } 91 92 95 public void actionPerformed(MenuItemTreeView arg0) throws Exception { 96 LifeCycleController lcc = null; 97 try { 98 lcc = FcBrowser.getLifeCycleController(FcBrowser.getComponent(arg0.getSelectedObject())); 99 } catch(NoSuchInterfaceException e) { 100 try { 101 actionStartedPerformed(arg0); 102 } catch (Exception e1) { 103 actionStoppedPerformed(arg0); 104 } 105 } 106 if(lcc.getFcState().equals(LifeCycleController.STARTED)) 107 actionStartedPerformed(arg0); 108 else 109 actionStoppedPerformed(arg0); 110 } 111 112 public int getStartedStatus(TreeView arg0) { 113 return MenuItem.ENABLED_STATUS; 114 } 115 116 public int getStoppedStatus(TreeView arg0) { 117 return MenuItem.NOT_VISIBLE_STATUS; 118 } 119 120 public void actionStoppedPerformed(MenuItemTreeView arg0) throws Exception { 121 } 123 124 public abstract void actionStartedPerformed(MenuItemTreeView arg0) throws Exception ; 125 } | Popular Tags |