Lines 53-59
Link Here
|
53 |
* @author David Kaspar |
53 |
* @author David Kaspar |
54 |
*/ |
54 |
*/ |
55 |
public class DocumentSupport { |
55 |
public class DocumentSupport { |
56 |
|
56 |
|
|
|
57 |
/** |
58 |
* Gathers all components the main tree of components in a specific document. |
59 |
* @param document the document |
60 |
* @return the list of components |
61 |
*/ |
62 |
public static Iterable<DesignComponent> gatherAllComponents(DesignDocument document) { |
63 |
ArrayList<DesignComponent> list = new ArrayList<DesignComponent> (); |
64 |
gatherAllComponents(list, document.getRootComponent()); |
65 |
return list; |
66 |
} |
67 |
|
57 |
/** |
68 |
/** |
58 |
* Gathers all components in main tree of components in a specific document. |
69 |
* Gathers all components in main tree of components in a specific document. |
59 |
* It returns a list of components that are or inherits a specific type-id using DescriptorRegistry.isInHierarchy method. |
70 |
* It returns a list of components that are or inherits a specific type-id using DescriptorRegistry.isInHierarchy method. |
Lines 80-85
Link Here
|
80 |
gatherAllComponentsContainingPresenterClass(list, rootComponent, presenterClass); |
91 |
gatherAllComponentsContainingPresenterClass(list, rootComponent, presenterClass); |
81 |
return list; |
92 |
return list; |
82 |
} |
93 |
} |
|
|
94 |
|
95 |
private static void gatherAllComponents(List<DesignComponent> list, DesignComponent component) { |
96 |
list.add (component); |
97 |
for (DesignComponent child : component.getComponents()) |
98 |
gatherAllComponents(list, child); |
99 |
} |
100 |
|
83 |
|
101 |
|
84 |
private static <T extends Presenter> void gatherAllComponentsContainingPresenterClass(ArrayList<DesignComponent> list, DesignComponent component, Class<T> presenterClass) { |
102 |
private static <T extends Presenter> void gatherAllComponentsContainingPresenterClass(ArrayList<DesignComponent> list, DesignComponent component, Class<T> presenterClass) { |
85 |
if (component.getPresenter(presenterClass) != null) |
103 |
if (component.getPresenter(presenterClass) != null) |