All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.wicketstuff.jwicket.ChildrenFinder Maven / Gradle / Ivy

Go to download

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

There is a newer version: 9.7.0
Show newest version
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