List of usage examples for org.apache.wicket.util.visit Visit isDontGoDeeper
public boolean isDontGoDeeper()
From source file:org.wicketstuff.event.annotation.AnnotationEventSink.java
License:Apache License
private void onEvent(final Set<Method> onEventMethods, final Object sink, final Object payload, final IEvent<?> event) { try {/*www. j a va 2 s . c o m*/ for (Method method : onEventMethods) { if (canCallListenerInterface(sink, method)) { OnEvent onEvent = method.getAnnotation(OnEvent.class); if (isPayloadApplicableToHandler(onEvent, payload)) { Object result = method.invoke(sink, payload); if (result instanceof Visit<?>) { Visit<?> visit = (Visit<?>) result; if (visit.isDontGoDeeper()) { event.dontBroadcastDeeper(); } else if (visit.isStopped()) { event.stop(); break; } } else if (onEvent.stop()) { event.stop(); break; } } } } } catch (InvocationTargetException e) { if (e.getCause() instanceof ReplaceHandlerException) { throw ((ReplaceHandlerException) e.getCause()); } else { throw new IllegalStateException("Failed to invoke @OnEvent method", e); } } catch (IllegalAccessException e) { throw new IllegalStateException("Failed to invoke @OnEvent method", e); } }