Package org.apache.wicket.ajax

Examples of org.apache.wicket.ajax.AjaxRequestTarget


   *            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


    implements
      IContextProvider<AjaxRequestTarget, Page>
  {
    public AjaxRequestTarget get(Page context)
    {
      return new AjaxRequestTarget(context);
    }
View Full Code Here

    {
      callOnError(submitter);
    }

    // update auto labels if we are inside an ajax request
    final AjaxRequestTarget target = getRequestCycle().find(AjaxRequestTarget.class);
    if (target != null)
    {
      visitChildren(FormComponent.class, new IVisitor<FormComponent<?>, Void>()
      {
        @Override
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

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

      setupRequestAndResponse(true);
      WebRequestCycle requestCycle = createRequestCycle();
      callOnBeginRequest(requestCycle);
      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

    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');", getJquerySafeMarkupId()));
      }
  }
    }
View Full Code Here

@Category(TestCategory.UnitTest.class)
public class ScrollSpyBehaviorTest {

    @Test
    public void refreshScriptIsCorrect() {
        AjaxRequestTarget target = mock(AjaxRequestTarget.class);
        ScrollSpyBehavior.refresh(target);

        verify(target, times(1)).appendJavaScript("$('[data-spy=\\\"scroll\\\"]').each(function(){var $spy = $(this).scrollspy('refresh');});");
    }
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

   *            page on which ajax response is made
   * @return non-null ajax request target instance
   */
  public AjaxRequestTarget newAjaxRequestTarget(final Page page)
  {
    return new AjaxRequestTarget(page);
  }
View Full Code Here

    /**
     * @return The ART or null if there is none
     */
    public static AjaxRequestTarget getAjaxRequestTarget() {
        AjaxRequestTarget target = RequestCycle.get().find(AjaxRequestTarget.class);
        return target;
    }
View Full Code Here

TOP

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

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.