/** * @param trigger the AJAX trigger to check * @return true if this is the current AJAX trigger */ public static boolean isCurrentAjaxTrigger(final WComponent trigger) { if (trigger == null) { return false; } AjaxOperation operation = AjaxHelper.getCurrentOperation(); return operation != null && operation.getTriggerId().equals(trigger.getId()); }
/** * Indicates whether the dialog is currently the target of an AJAX operation. * * @return true if the dialog is currently AJAX targeted, otherwise false. */ public final boolean isAjaxTargeted() { // If the AJAX target is within the dialog, it should be visible. AjaxOperation operation = AjaxHelper.getCurrentOperation(); if (operation == null) { return false; } String dialogId = getId(); String containerId = operation.getTargetContainerId(); if (containerId != null && containerId.startsWith(dialogId)) { // target is the dialog, or somewhere within the dialog return true; } if (operation.getTargets() != null && UIContextHolder.getCurrent() != null) { for (String targetId : operation.getTargets()) { if (targetId.startsWith(dialogId)) { return true; } } } return false; }
/** * Paints the targeted ajax regions. The format of the response is an agreement between the server and the client * side JavaScript handling our ajax response. * * @param renderContext the renderContext to send the output to. */ @Override public void paint(final RenderContext renderContext) { AjaxOperation operation = AjaxHelper.getCurrentOperation(); if (operation == null) { // the request attribute that we place in the ui context in the action phase can't be null throw new SystemException( "Can't paint AJAX response. Couldn't find the expected reference to the AjaxOperation."); } if (operation.getTargetContainerId() != null) { paintContainerResponse(renderContext, operation); } else { paintResponse(renderContext, operation); } }
AjaxOperation operation = AjaxHelper.getCurrentOperation(); if (operation.isInternalAjaxRequest()) { if (AjaxHelper.getCurrentOperation() == null) { clearPrevExpandedRows(); } else {
/** * Override handleRequest in order to perform processing for this component. This implementation checks whether the * link has been pressed via the current ajax operation. * * @param request the request being responded to. */ @Override public void handleRequest(final Request request) { // Check if this link was the AJAX Trigger AjaxOperation operation = AjaxHelper.getCurrentOperation(); boolean pressed = (operation != null && getId().equals(operation.getTriggerId())); // Protect against client-side tampering of disabled/read-only fields. if (isDisabled() && pressed) { LOG.warn("A disabled link has been triggered. " + getText() + ". " + getId()); return; } // If an action has been supplied then execute it, but only after // handle request has been performed on the entire component tree. final Action action = getAction(); if (pressed && action != null) { final ActionEvent event = new ActionEvent(this, getActionCommand(), getActionObject()); Runnable later = new Runnable() { @Override public void run() { action.execute(event); } }; invokeLater(later); } }
String triggerId = request.getParameter(WServlet.AJAX_TRIGGER_PARAM_NAME); AjaxOperation ajaxOperation = AjaxHelper.getCurrentOperation(); if (ajaxOperation == null) { throw new IllegalStateException(
@Override protected void preparePaintComponent(final Request request) { if (isLazy()) { if (AjaxHelper.getCurrentOperation() == null) { setRendered(null); } super.preparePaintComponent(request); if (isOpen()) { setRendered(Boolean.TRUE); } // Keep Lazy tabs that are open as visible during AJAX operations. getContent().setVisible(isOpen() || isRendered()); } else { super.preparePaintComponent(request); } }
AjaxOperation operation = AjaxHelper.getCurrentOperation();
WebXmlRenderContext webRenderContext = (WebXmlRenderContext) renderContext; XmlStringBuilder xml = webRenderContext.getWriter(); AjaxOperation operation = AjaxHelper.getCurrentOperation();