Java Code Examples for org.apache.wicket.Component#visitParents()
The following examples show how to use
org.apache.wicket.Component#visitParents() .
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 File: WicketProtector.java From Orienteer with Apache License 2.0 | 5 votes |
@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 File: AbstractMetaPanel.java From Orienteer with Apache License 2.0 | 5 votes |
@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)); }