1 package org.objectweb.fractal.julia.control.content; 2 3 import org.objectweb.fractal.api.Component; 4 import org.objectweb.fractal.api.NoSuchInterfaceException; 5 import org.objectweb.fractal.api.control.ContentController; 6 7 import java.util.ArrayList ; 8 import java.util.List ; 9 10 13 14 public class Util { 15 16 private Util () { 17 } 18 19 25 26 public static List getAllSubComponents (final Component component) { 27 List allSubComponents = new ArrayList (); 28 List stack = new ArrayList (); 29 stack.add(component); 30 while (stack.size() > 0) { 31 int index = stack.size() - 1; 32 Component c = (Component)stack.get(index); 33 stack.remove(index); 34 if (!allSubComponents.contains(c)) { 35 try { 36 ContentController cc = 37 (ContentController)c.getFcInterface("content-controller"); 38 Component[] subComponents = cc.getFcSubComponents(); 39 for (int i = subComponents.length - 1; i >= 0; --i) { 40 stack.add(subComponents[i]); 41 } 42 } catch (NoSuchInterfaceException ignored) { 43 } 45 allSubComponents.add(c); 46 } 47 } 48 return allSubComponents; 49 } 50 } 51 | Popular Tags |