public static ComponentList getRootPath(UIComponent leaf) { ComponentList togo = new ComponentList(); while (leaf != null) { togo.add(0, leaf); leaf = leaf.parent; } return togo; }
public ComponentList(Collection c) { addAll(c); }
public UIComponent nextComponent() { return componentAt(pos++); } };
/** * Returns a flattened array of all children of this container. Note that this * method will trigger the creation of a cached internal array on its first * use, which cannot be recreated. It is essential therefore that it only be * used once ALL modifications to the component tree have concluded (i.e. once * rendering starts). */ public UIComponent[] flatChildren() { if (flatchildren == null) { ComponentList children = flattenChildren(); flatchildren = (UIComponent[]) children.toArray(new UIComponent[children .size()]); } return flatchildren; }
/** * Returns a list of all CURRENT children of this container. This method is * safe to use at any time. */ // There are now two calls to this in the codebase, firstly from ViewProcessor // and then from BasicFormFixer. The VP call is necessary since it needs to // fossilize // the list up front, but if another call arises as in BFF we ought to write a // multi-iterator. public ComponentList flattenChildren() { ComponentList children = new ComponentList(); for (Iterator childit = childmap.values().iterator(); childit.hasNext();) { Object child = childit.next(); if (child instanceof UIComponent) { children.add(child); } else if (child instanceof List) { children.addAll((List) child); } } return children; }
worklist.addAll(thischildren); for (int i = 0; i < thischildren.size(); ++i) { UIComponent thischild = thischildren.componentAt(i); if (thischild instanceof UIContainer) { appendContainer((UIContainer) thischild);
private void registerContainer(UIForm toprocess, UIContainer toregister) { ComponentList children = toregister.flattenChildren(); for (int i = 0; i < children.size(); ++i) { UIComponent child = children.componentAt(i); registerComponent(toprocess, child); } } }
private void cloneChildren(UIContainer target, UIContainer source, RemapState state) { ComponentList children = source.flattenChildren(); for (int i = 0; i < children.size(); ++i) { UIComponent child = (UIComponent) children.get(i); if (child instanceof UIReplicator) { expandReplicator(target, (UIReplicator) child, state); } else { UIComponent cloned = cloneComponent(child, state); target.addComponent(cloned); } } }
private ComponentIterator iteriseComponent(UIComponent parent) { if (parent instanceof UIContainer) { return ((UIContainer) parent).flattenChildren().iterate(); } else { ConcreteChildIterator cci = new ConcreteChildIterator(parent, smc); return new ComponentList(cci.children()).iterate(); } }
public ComponentList(UIComponent component) { add(component); }
public UIComponent componentAt(int i) { return (UIComponent) get(i); }
public boolean hasMoreComponents() { return pos < size(); }
private void generateWorkList() { worklist = new ComponentList(); appendContainer(view.viewroot); }
for (int compind = 0; compind < worklist.size(); ++compind) { UIComponent child = worklist.componentAt(compind); view.registerComponent(child); for (int compind = 0; compind < worklist.size(); ++compind) { UIComponent child = worklist.componentAt(compind); for (int procind = 0; procind < processors.size(); ++procind) { ComponentProcessor proc = (ComponentProcessor) processors.get(procind); for (int compind = 0; compind < worklist.size(); ++compind) { UIComponent thischild = worklist.componentAt(compind); if (thischild instanceof FixableComponent) { ((FixableComponent)thischild).fixupComponent();
ComponentList rootpath = RSFUtil.getRootPath(target); for (int j = 0; j < rootpath.size() - 1; ++j) { if (globalrootpath != null && j == globalrootpath.size() - 2) { UIContainer globalbranch = (UIContainer) globalrootpath.get(j); XMLLump peer = (XMLLump) branchmap.get(globalbranch); best.findTarget(peer, globalbranch, targetid); UIContainer branch = (UIContainer) rootpath.get(j); XMLLump peer = (XMLLump) branchmap.get(branch); if (peer != null) {
private void appendComponent(UIBound toappend, String fullID) { if (toappend != null) { if (fullID != null) { toappend.updateFullID(fullID); } worklist.add(toappend); } }