Setting the AjaxLink indicator in the gates

in my current project I ran into the problem of setting IndicatingAjaxLink in the gates, is there any solution to change the standard gif image to my own? For example, we have the following listener

   add(new IndicatingAjaxLink("closeReceivedBillspanel") {
            public void onClick(AjaxRequestTarget art) {
                  // some timeconsuming calculations
           }
   });

when the user clicks on this link, the gif appears with the download, and I want to change this gif, is there a solution for this problem?

+5
source share
2 answers

Your page implements the IAjaxIndicatorAware interface

public class BasePage extends WebPage implements IAjaxIndicatorAware {   

 public BasePage(final PageParameters parameters) {
    // Home link
    AjaxLink<Page> homeLink = new AjaxLink<Page>("homeLink") {
      private static final long serialVersionUID = 1L;

      @Override
      public void onClick(AjaxRequestTarget target) {
        setResponsePage(HomePage.class);
      }
    };
    add(homeLink);
  }

  @Override
  public String getAjaxIndicatorMarkupId() {
    return "indicator";
  }

Thus, you can set in html any image that you want to display when loading appears by changing the image in the "img" tag

<div id="indicator" style="display: none;">
 <div class="indicator-content">
  Please wait... <wicket:link><img src="images/loading.gif" width="16" height="16" alt="loading" /></wicket:link>
 </div>
</div>
+13
source

yoru, ( - IndicatingAjaxLink )

   public class MyIndicatingAjaxLink<T> extends AjaxLink<T> implements IAjaxIndicatorAware {
         private final MyAjaxIndicatorAppender indicatorAppender = new MyAjaxIndicatorAppender();    
    .
    //rest of the code is same as IndicatingAjaxLink class
    .
    }

AjaxIndicatorAppender customIndicatingAjaxLink, indicatorAppender,

protected CharSequence getIndicatorUrl()
+2

All Articles