Is it possible to change the color of Wicket's activity indicator?

自古美人都是妖i 提交于 2019-12-02 02:44:05

This is not possible. Well, not programmatically.

Wicket's activity indicator/throbber/spinner is actually nothing more than an animated GIF. It's located at

[your version of Wicket here]\wicket-src\wicket\src\main\java\org\apache\wicket\ajax\indicator.gif

and referenced in AbstractDefaultAjaxBehavior.

To change the colors, you could create your own animated GIF of the same size and overwrite the one that's included in the default distribution.

EDIT:
Okay, after writing that I thought "there must be free icons available" and came up with this through Google Image Search:

http://blogs.msdn.com/blogfiles/gduthie/WindowsLiveWriter/Needananimatedloadingicon_B811/ajax-loader_2.gif

I think it's free and unrestricted to use, but I didn't check too carefully. You should check for yourself if you're using it for anything more than a personal toy/sample app.

Uncle Iroh

So piggybacking off what Lord Torgamus provided, you could add a class like this:

abstract class OnBlackIndicatingAjaxButton extends AjaxButton implements
  IAjaxIndicatorAware {
    private final AjaxIndicatorAppender indicatorAppender = new
      AjaxIndicatorAppender() {
        @Override
        protected CharSequence getIndicatorUrl() {
            return "http://blogs.msdn.com/blogfiles/gduthie/WindowsLiveWriter/Needananimatedloadingicon_B811/ajax-loader_2.gif";
        }
    };

    public OnBlackIndicatingAjaxButton(String id) {
        super(id);
        add (indicatorAppender);
    }

    public OnBlackIndicatingAjaxButton(String id, Form<?> form)
    {
        super(id, form);
        add (indicatorAppender);
    }

    /**
     * @see IAjaxIndicatorAware#getAjaxIndicatorMarkupId()
     * @return the markup id of the ajax indicator
     * 
     */
    public String getAjaxIndicatorMarkupId()
    {
        return indicatorAppender.getMarkupId();
    }
}

and use that for any of your pages.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!