org.wicketstuff.jwicket.ChildrenFinder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of wicketstuff-jwicket-core Show documentation
Show all versions of wicketstuff-jwicket-core Show documentation
WicketJQuery by Stefan Lindner has been renamed to jWicket, mavenized, and migrated
to WicketStuff. This Wicketstuff version supercedes the original version which was available
at http://subversion.visionet.de/project/WicketJQuery/wiki
package org.wicketstuff.jwicket;
import org.apache.wicket.Component;
import org.apache.wicket.MarkupContainer;
import org.apache.wicket.util.visit.IVisit;
import org.apache.wicket.util.visit.IVisitor;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
* Find a page's child component by it's markup id
*/
public class ChildrenFinder implements IVisitor, Serializable {
private static final long serialVersionUID = 1L;
private final String id;
private List found = new ArrayList();
public ChildrenFinder(String id) {
this.id = id;
}
public void component(Component component, IVisit visit) {
if (component.getParent().getMarkupId().equals(id)) {
this.found.add(component);
visit.stop();
}
if (component instanceof MarkupContainer) {
// mocleiri: changed for 1.5 compatibility, not 100% sure it is equivalent to before.
((MarkupContainer)component).visitChildren(this);
visit.stop();
}
}
public List getFoundComponents() {
return found;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy