@OnEvent(component = "searchForm", value = EventConstants.SUCCESS) void onSearchSuccess() { result = "" + searchString + " not found!"; } }
/** * Returns the component id to match against, or the empty * string if the component id is not specified. The component id * is provided by the OnEvent annotation or (if that is not present) * by the part of the method name following "From" ("onActionFromFoo"). */ private String extractComponentId(String methodName, OnEvent annotation) { if (annotation != null) return annotation.component(); // Method name started with "on". Extract the component id, if present. int fromx = methodName.indexOf("From"); if (fromx < 0) return ""; return methodName.substring(fromx + 4); }
/** * Returns the event name to match against, as specified in the annotation * or (if the annotation is not present) extracted from the name of the method. * "onActionFromFoo" or just "onAction". */ private String extractEventType(String methodName, OnEvent annotation) { if (annotation != null) return annotation.value(); int fromx = methodName.indexOf("From"); // The first two characters are always "on" as in "onActionFromFoo". return fromx == -1 ? methodName.substring(2) : methodName.substring(2, fromx); } }
@OnEvent("passivate") int passivate() { return selected; }
@OnEvent(component = "actionlink", value = "action") public void onAction(Long number) { this.number = number; }
@OnEvent(component = "wilma") String clickWilma() { return "Wilma"; }
@OnEvent(component = "toggle") void toggle() { showEmphasis = !showEmphasis; } }
@OnEvent("scroll") Object scroll(EventContext context, @RequestParameter("pageNumber") int index) { this.pageNumber = index; this.eventContext = context; return nextPageBlock; }
@OnEvent(value = EventConstants.SUCCESS, component = "form") public void onFormSuccess() { // It's OK we should come here on form submission }
@OnEvent String makeWaves(String argument1, int[] argument2) { return null; } }
@OnEvent("passivate") public int getNumber() { return number; }
@OnEvent(component = "fred") Object clickFred() { return fred; }
@OnEvent(component = "barney") Object clickBarney() { return barney; }
@OnEvent(value = "fred", component = "alpha") public void handler() { } }
@OnEvent("activate") void activate(int selected) { this.selected = selected; } }
@OnEvent("activate") public void setNumber(int number) { this.number = number; } }
@OnEvent("passivate") public Object[] getActivationContext() { return activationContext; }
@OnEvent("activate") public void setActivationContext(Object[] activationContext) { this.activationContext = activationContext; }
/** * Creates an {@link org.apache.tapestry5.corelib.internal.InternalFormSupport} for * this Form. * * This method may also be invoked as the handler for the "internalCreateRenderTimeFormSupport" event. * * @param clientId * the client-side id for the rendered form * element * @param actionSink * used to collect component actions that will, ultimately, be * written as the t:formdata hidden * field * @param allocator * used to allocate unique ids * @return form support object */ @OnEvent("internalCreateRenderTimeFormSupport") InternalFormSupport createRenderTimeFormSupport(String clientId, ComponentActionSink actionSink, IdAllocator allocator) { return new FormSupportImpl(resources, clientId, actionSink, clientValidation != ClientValidation.NONE, allocator, validationId); }
@OnEvent("sortable") public void sort(){ String value = request.getParameter("list"); resources.triggerEvent(JQueryEventConstants.SORTABLE, new Object[] {value}, null); } }