1 23 24 package org.objectweb.fractal.julia.control.content; 25 26 import org.objectweb.fractal.api.Component; 27 import org.objectweb.fractal.api.NoSuchInterfaceException; 28 import org.objectweb.fractal.api.control.ContentController; 29 import org.objectweb.fractal.api.control.IllegalContentException; 30 import org.objectweb.fractal.api.control.IllegalLifeCycleException; 31 32 43 44 public abstract class SuperContentMixin implements ContentController { 45 46 50 private SuperContentMixin () { 51 } 52 53 57 69 70 public void addFcSubComponent (final Component subComponent) 71 throws IllegalContentException, IllegalLifeCycleException 72 { 73 _super_addFcSubComponent(subComponent); 74 SuperControllerNotifier scn = getFcSuperControllerNotifier(subComponent); 75 if (scn != null) { 76 try { 77 Component c = (Component)_this_weaveableC.getFcInterface("component"); 78 scn.addedToFc(c); 79 } catch (NoSuchInterfaceException ignored) { 80 } 81 } 82 } 83 84 97 98 public void removeFcSubComponent (final Component subComponent) 99 throws IllegalContentException, IllegalLifeCycleException 100 { 101 _super_removeFcSubComponent(subComponent); 102 SuperControllerNotifier scn = getFcSuperControllerNotifier(subComponent); 103 if (scn != null) { 104 try { 105 Component c = (Component)_this_weaveableC.getFcInterface("component"); 106 scn.removedFromFc(c); 107 } catch (NoSuchInterfaceException ignored) { 108 } 109 } 110 } 111 112 120 121 private SuperControllerNotifier getFcSuperControllerNotifier ( 122 final Component c) 123 { 124 try { 125 return (SuperControllerNotifier)c.getFcInterface("super-controller"); 126 } catch (Exception e) { 127 try { 128 return (SuperControllerNotifier)c. 129 getFcInterface("/super-controller-notifier"); 130 } catch (NoSuchInterfaceException ignored) { 131 return null; 132 } 133 } 134 } 135 139 144 145 public Component _this_weaveableC; 146 147 158 159 public abstract void _super_addFcSubComponent (Component subComponent) 160 throws IllegalContentException, IllegalLifeCycleException; 161 162 173 174 public abstract void _super_removeFcSubComponent (Component subComponent) 175 throws IllegalContentException, IllegalLifeCycleException; 176 } 177 | Popular Tags |