public void advise(final MethodInvocation invocation) { heartbeat.defer(new Runnable() { public void run() { invocation.proceed(); } }); } };
void processSubmission(final String elementName, final String context) { if (disabled) { return; } String value = request.getParameter(elementName); if (value == null) { return; } Runnable sendNotification = new Runnable() { public void run() { resources.triggerEvent(event, new Object[]{context}, null); } }; // When not deferred, don't wait, fire the event now (actually, at the end of the current // heartbeat). This is most likely because the Submit is inside a Loop and some contextual // information will change if we defer. if (defer) { formSupport.defer(sendNotification); } else { heartbeat.defer(sendNotification); } }
void processSubmission(String clientId, String elementName) { if (disabled || !selected(clientId, elementName)) return; // TAP5-1658: copy the context of the current Submit instance so we trigger the event with // the correct context later final Holder<Object[]> currentContextHolder = Holder.create(); if (context != null) { Object[] currentContext = new Object[context.length]; System.arraycopy(context, 0, currentContext, 0, context.length); currentContextHolder.put(currentContext); } Runnable sendNotification = new Runnable() { public void run() { // TAP5-1024: allow for navigation result from the event callback resources.triggerEvent(event, currentContextHolder.get(), eventCallback); } }; // When not deferred, don't wait, fire the event now (actually, at the end of the current // heartbeat). This is most likely because the Submit is inside a Loop and some contextual // information will change if we defer. if (defer) formSupport.defer(sendNotification); else heartbeat.defer(sendNotification); }
private void processSubmission(String clientId) { this.clientId = clientId; String raw = request.getParameter(Form.SUBMITTING_ELEMENT_ID); if (InternalUtils.isNonBlank(raw) && new JSONArray(raw).getString(0).equals(clientId)) { Runnable notification = new Runnable() { public void run() { resources.triggerEvent(event, context, eventCallback); } }; if (defer) formSupport.defer(notification); else heartbeat.defer(notification); } }
@Environmental private Heartbeat heartbeat; @SetupRender void setupRender(MarkupWriter writer) { writer.element("div"); } // let the body render as normal @AfterRender void afterRender(final MarkupWriter writer) { Element wrapper = writer.element(); writer.end(); final String bodyMarkup = wrapper.getChildMarkup(); // remove the body wrapper.remove(); heartbeat.defer(new Runnable() { public void run() { Element pageBody = writer.getDocument().find("html/body"); pageBody.raw(bodyMarkup); } }); }
heartbeat.defer(appendToBody);