Package org.apache.wicket.ajax

Examples of org.apache.wicket.ajax.AjaxRequestTarget$AbstractListener


     * @param components Components to be added.
     * @throws IllegalArgumentException if the array 'components' is null
     */
    public static void addToAjaxRequestTarget(Component... components) {
        Reject.ifNull(components, "Array 'components' is null");
        AjaxRequestTarget target = getAjaxRequestTarget();
        if (target != null) {
            target.add(components);
        }
    }
View Full Code Here


    private static void addJavaScriptToTarget(boolean append, String script) {
        if (script == null) {
            return;
        }

        AjaxRequestTarget target = getAjaxRequestTarget();
        if (target != null) {
            if (append) {
                target.appendJavaScript(script);
            }
            else {
                target.prependJavaScript(script);
            }
        }
    }
View Full Code Here

      AjaxLink<?> link = (AjaxLink<?>)linkComponent;

      setupRequestAndResponse(true);
      WebRequestCycle requestCycle = createRequestCycle();
      AjaxRequestTarget target = getApplication().newAjaxRequestTarget(link.getPage());
      requestCycle.setRequestTarget(target);

      link.onClick(target);

      // process the request target
      processRequestCycle(requestCycle);
    }
    // AjaxFallbackLinks is processed like an AjaxLink if isAjax is true
    // If it's not handling of the linkComponent is passed through to the
    // Link.
    else if (linkComponent instanceof AjaxFallbackLink && isAjax)
    {
      AjaxFallbackLink<?> link = (AjaxFallbackLink<?>)linkComponent;

      setupRequestAndResponse(true);
      WebRequestCycle requestCycle = createRequestCycle();
      AjaxRequestTarget target = getApplication().newAjaxRequestTarget(link.getPage());
      requestCycle.setRequestTarget(target);

      link.onClick(target);

      // process the request target
View Full Code Here

   *            page on which ajax response is made
   * @return non-null ajax request target instance
   */
  public final AjaxRequestTarget newAjaxRequestTarget(final Page page)
  {
    AjaxRequestTarget target = getAjaxRequestTargetProvider().get(page);
    for (AjaxRequestTarget.IListener listener : ajaxRequestTargetListeners)
    {
      target.addListener(listener);
    }
    return target;
  }
View Full Code Here

    datePickerJs.interpolate(variables);
    response.render(OnDomReadyHeaderItem.forScript(datePickerJs.asString()));

    // remove previously generated markup (see onRendered) via javascript in
    // ajax requests to not render the yui calendar multiple times
    AjaxRequestTarget target = component.getRequestCycle().find(AjaxRequestTarget.class);
    if (target != null)
    {
      String escapedComponentMarkupId = getEscapedComponentMarkupId();
      String javascript = "var e = Wicket.$('" + escapedComponentMarkupId + "Dp" +
        "'); if (e != null && typeof(e.parentNode) != 'undefined' && " +
        "typeof(e.parentNode.parentNode != 'undefined')) {" +
        "e.parentNode.parentNode.removeChild(e.parentNode);" + "YAHOO.wicket." +
        escapedComponentMarkupId + "DpJs.destroy(); delete YAHOO.wicket." +
        escapedComponentMarkupId + "DpJs;}";

      target.prependJavaScript(javascript);
    }
  }
View Full Code Here

   * would be appropriate, but you don't have the AjaxRequestTarget instance. However, it is also
   * safe to call this method outside Ajax response.
   */
  public final void updateTree()
  {
    AjaxRequestTarget target = getRequestCycle().find(AjaxRequestTarget.class);
    if (target == null)
    {
      throw new WicketRuntimeException(
        "No AjaxRequestTarget available to execute updateTree(ART target)");
    }
View Full Code Here

  @Override
  public void respond(IRequestCycle requestCycle)
  {
    Page page = (Page)Application.get().getMapperContext().getPageInstance(pageKey.getPageId());
    AjaxRequestTarget target = WebApplication.get().newAjaxRequestTarget(page);
    executeHandlers(target, page);
  }
View Full Code Here

    public void onEvent(IEvent<?> event) {
        super.onEvent(event);

        if (event.getPayload() instanceof AjaxRequestTarget) {

            AjaxRequestTarget target = (AjaxRequestTarget) event.getPayload();

            if (target.getComponents().contains(this)) {

                // if this component is being repainted by ajax, directly, we must destroy Select2 so it removes
                // its elements from DOM

                target.prependJavaScript(JQuery.execute("$('#%s').select2('destroy');", this.getJquerySafeMarkupId()));
            }
        }
    }
View Full Code Here

  @Override
  public void onEvent(IEvent<?> event) {
    super.onEvent(event);

    if (event.getPayload() instanceof AreaChangedEvent) {
      AjaxRequestTarget target = ((AreaChangedEvent) event.getPayload()).getAjaxRequestTarget();
      target.add(areasContainer);
      target.add(computeLink);

      if (pivotModel.isAutoCalculate()) {
        compute(target);
      }
    }
View Full Code Here

      AjaxLink<?> link = (AjaxLink<?>)linkComponent;

      setupRequestAndResponse(true);
      WebRequestCycle requestCycle = createRequestCycle();
      AjaxRequestTarget target = getApplication().newAjaxRequestTarget(link.getPage());
      requestCycle.setRequestTarget(target);

      link.onClick(target);

      // process the request target
      processRequestCycle(requestCycle);
    }
    // AjaxFallbackLinks is processed like an AjaxLink if isAjax is true
    // If it's not handling of the linkComponent is passed through to the
    // Link.
    else if (linkComponent instanceof AjaxFallbackLink && isAjax)
    {
      AjaxFallbackLink<?> link = (AjaxFallbackLink<?>)linkComponent;

      setupRequestAndResponse(true);
      WebRequestCycle requestCycle = createRequestCycle();
      AjaxRequestTarget target = getApplication().newAjaxRequestTarget(link.getPage());
      requestCycle.setRequestTarget(target);

      link.onClick(target);

      // process the request target
View Full Code Here

TOP

Related Classes of org.apache.wicket.ajax.AjaxRequestTarget$AbstractListener

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.