Package org.apache.wicket.ajax.attributes

Examples of org.apache.wicket.ajax.attributes.IAjaxCallListener


      @Override
      protected void updateAjaxAttributes(AjaxRequestAttributes attributes)
      {
        super.updateAjaxAttributes(attributes);

        IAjaxCallListener ajaxCallListener = new AjaxCallListener() {
          @Override
          public CharSequence getSuccessHandler(Component component)
          {
            return "alert('Success');";
          }

          @Override
          public CharSequence getBeforeHandler(Component component)
          {
            return "alert('Before ajax call');";
          }

          @Override
          public CharSequence getFailureHandler(Component component)
          {
            return "alert('Failure');";
          }
        };
        attributes.getAjaxCallListeners().add(ajaxCallListener);

        List<CharSequence> urlArgumentMethods = attributes.getDynamicExtraParameters();
        urlArgumentMethods.add("return {'htmlname': document.documentElement.tagName};");
        urlArgumentMethods.add("return {'bodyname': document.body.tagName};");
      }
    });

    add(new AjaxLink<Void>("failure-link")
    {
      @Override
      public void onClick(AjaxRequestTarget target)
      {
        // Set the proper setting to execute ajax failure handler
        // note: will be set until the "exception" link is clicked or the application is
        // restarted
        getApplication().getExceptionSettings().setAjaxErrorHandlingStrategy(
          AjaxErrorStrategy.INVOKE_FAILURE_HANDLER);

        throw new WicketRuntimeException("Failure link clicked");
      }

      @Override
      protected void updateAjaxAttributes(AjaxRequestAttributes attributes)
      {
        super.updateAjaxAttributes(attributes);
       
        IAjaxCallListener ajaxCallListener = new AjaxCallListener() {
          @Override
          public CharSequence getBeforeHandler(Component component)
          {
            return "alert('Before ajax call');";
          }
View Full Code Here


      @Override
      protected void updateAjaxAttributes(AjaxRequestAttributes attributes)
      {
        super.updateAjaxAttributes(attributes);
        IAjaxCallListener ajaxCallListener = new AjaxCallListener() {
          @Override
          public CharSequence getBeforeHandler(Component component)
          {
            return "showLoadingIndicator();";
          }
View Full Code Here

      @Override
      protected void updateAjaxAttributes(AjaxRequestAttributes attributes)
      {
        super.updateAjaxAttributes(attributes);
        IAjaxCallListener ajaxCallListener = new AjaxCallListener() {
          @Override
          public CharSequence getBeforeSendHandler(Component component)
          {
            return "showLoadingIndicator();";
          }
View Full Code Here

                    @Override
                    protected void updateAjaxAttributes(final AjaxRequestAttributes attributes) {
                        super.updateAjaxAttributes(attributes);

                        IAjaxCallListener ajaxCallListener = new AjaxCallListener() {

                            private static final long serialVersionUID = 7160235486520935153L;

                            @Override
                            public CharSequence getPrecondition(final Component component) {
View Full Code Here

      @Override
      protected void updateAjaxAttributes(AjaxRequestAttributes attributes)
      {
        super.updateAjaxAttributes(attributes);
        IAjaxCallListener ajaxCallListener = new AjaxCallListener() {
          @Override
          public CharSequence getBeforeSendHandler(Component component)
          {
            return "showLoadingIndicator();";
          }
View Full Code Here

  public void required()
  {
    JavaxInjectTestComponent component = newTestComponent("id");

    // get the lazy proxy
    IAjaxCallListener nonExisting = component.getNonExisting();

    try
    {
      // call any method on the lazy proxy
      nonExisting.getAfterHandler(null);
      fail("Fields annotated with @javax.inject.Inject are required!");
    }
    catch (ConfigurationException cx)
    {
      Message message = cx.getErrorMessages().iterator().next();
View Full Code Here

                    @Override
                    protected void updateAjaxAttributes(final AjaxRequestAttributes attributes) {
                        super.updateAjaxAttributes(attributes);

                        IAjaxCallListener ajaxCallListener = new AjaxCallListener() {

                            private static final long serialVersionUID = 7160235486520935153L;

                            @Override
                            public CharSequence getPrecondition(final Component component) {
View Full Code Here

      @Override
      protected void updateAjaxAttributes(AjaxRequestAttributes attributes)
      {
        super.updateAjaxAttributes(attributes);
        IAjaxCallListener ajaxCallListener = new AjaxCallListener() {
          @Override
          public CharSequence getBeforeSendHandler(Component component)
          {
            return "showLoadingIndicator();";
          }
View Full Code Here

      @Override
      protected void updateAjaxAttributes(AjaxRequestAttributes attributes)
      {
        super.updateAjaxAttributes(attributes);

        IAjaxCallListener ajaxCallListener = new AjaxCallListener() {
          @Override
          public CharSequence getSuccessHandler(Component component)
          {
            return "alert('Success');";
          }

          @Override
          public CharSequence getBeforeSendHandler(Component component)
          {
            return "alert('Before ajax call');";
          }

          @Override
          public CharSequence getFailureHandler(Component component)
          {
            return "alert('Failure');";
          }
        };
        attributes.getAjaxCallListeners().add(ajaxCallListener);

        List<CharSequence> urlArgumentMethods = attributes.getDynamicExtraParameters();
        urlArgumentMethods.add("return {'htmlname': document.documentElement.tagName};");
        urlArgumentMethods.add("return {'bodyname': document.body.tagName};");
      }
    });

    add(new AjaxLink<Void>("failure-link")
    {
      @Override
      public void onClick(AjaxRequestTarget target)
      {
        // Set the proper setting to execute ajax failure handler
        // note: will be set until the "exception" link is clicked or the application is
        // restarted
        getApplication().getExceptionSettings().setAjaxErrorHandlingStrategy(
          ExceptionSettings.AjaxErrorStrategy.INVOKE_FAILURE_HANDLER);

        throw new WicketRuntimeException("Failure link clicked");
      }

      @Override
      protected void updateAjaxAttributes(AjaxRequestAttributes attributes)
      {
        super.updateAjaxAttributes(attributes);
       
        IAjaxCallListener ajaxCallListener = new AjaxCallListener() {
          @Override
          public CharSequence getBeforeHandler(Component component)
          {
            return "alert('Before ajax call');";
          }
View Full Code Here

      @Override
      protected void updateAjaxAttributes(AjaxRequestAttributes attributes)
      {
        super.updateAjaxAttributes(attributes);

        IAjaxCallListener ajaxCallListener = new AjaxCallListener() {
          @Override
          public CharSequence getSuccessHandler(Component component)
          {
            return "alert('Success');";
          }

          @Override
          public CharSequence getBeforeSendHandler(Component component)
          {
            return "alert('Before ajax call');";
          }

          @Override
          public CharSequence getFailureHandler(Component component)
          {
            return "alert('Failure');";
          }
        };
        attributes.getAjaxCallListeners().add(ajaxCallListener);

        List<CharSequence> urlArgumentMethods = attributes.getDynamicExtraParameters();
        urlArgumentMethods.add("return {'htmlname': document.documentElement.tagName};");
        urlArgumentMethods.add("return {'bodyname': document.body.tagName};");
      }
    });

    add(new AjaxLink<Void>("failure-link")
    {
      @Override
      public void onClick(AjaxRequestTarget target)
      {
        // Set the proper setting to execute ajax failure handler
        // note: will be set until the "exception" link is clicked or the application is
        // restarted
        getApplication().getExceptionSettings().setAjaxErrorHandlingStrategy(
          AjaxErrorStrategy.INVOKE_FAILURE_HANDLER);

        throw new WicketRuntimeException("Failure link clicked");
      }

      @Override
      protected void updateAjaxAttributes(AjaxRequestAttributes attributes)
      {
        super.updateAjaxAttributes(attributes);
       
        IAjaxCallListener ajaxCallListener = new AjaxCallListener() {
          @Override
          public CharSequence getBeforeHandler(Component component)
          {
            return "alert('Before ajax call');";
          }
View Full Code Here

TOP

Related Classes of org.apache.wicket.ajax.attributes.IAjaxCallListener

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.