Java Code Examples for org.apache.wicket.Component#visitParents()

The following examples show how to use org.apache.wicket.Component#visitParents() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: Orienteer   File: WicketProtector.java    License: Apache License 2.0 5 votes vote down vote up
@Override
	public void onInitialize(Component component) {
		if(component instanceof AbstractMetaPanel) {
			final AtomicInteger deep = new AtomicInteger(0);
			component.visitParents(AbstractMetaPanel.class, (c, v) -> deep.incrementAndGet());
			if(deep.get()>=MAX_INCLUSION) {
				component.replaceWith(new EmptyPanel(component.getId()));
//				LOG.error("Due to very deep inclusion the following component was replaced by empty panel: "+component);
			}
		}
	}
 
Example 2
Source Project: Orienteer   File: AbstractMetaPanel.java    License: Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
public static <C> IMetaContext<C> getMetaContext(Component component)
{
	return (IMetaContext<C>) component.visitParents(MarkupContainer.class, new IVisitor<MarkupContainer, IMetaContext<C>>() {

		@Override
		public void component(MarkupContainer object,
				IVisit<IMetaContext<C>> visit) {
			visit.stop((IMetaContext<C>)object);
		}
	}, new ClassVisitFilter(IMetaContext.class));
}