简体   繁体   English

可以更改Wicket活动指示器的颜色吗?

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

Situation: I'm working with Wicket's IndicatingAjaxButton . 情况:我正在使用Wicket的IndicatingAjaxButton I have the button set up on a page with black background. 我在具有黑色背景的页面上设置了按钮。 When the user pushes the button, the button's activity indicator goes off and spins until the system is ready to move on. 当用户按下按钮时,按钮的活动指示灯熄灭并旋转,直到系统准备好继续运行为止。

Problem: Because of the black background, the indicator looks bad. 问题:由于背景为黑色,因此指示器看起来很糟。 Since part of the indicator is animated in black, some of the details are lost using the indicator on a black background. 由于指示器的一部分以黑色动画显示,因此在黑色背景上使用指示器会丢失一些细节。

Question: Is it possible in Wicket to change the color of the IndicatingX [Button, Link, etc.], or do I have to design my page in a new way? 问题:在Wicket中是否可以更改IndicatingX [按钮,链接等]的颜色,还是必须以新的方式设计页面?

So piggybacking off what Lord Torgamus provided, you could add a class like this: 因此,背负Torgamus勋爵提供的内容,您可以添加一个这样的类:

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. 并将其用于您的任何页面。

This is not possible. 这是不可能的。 Well, not programmatically. 好吧,不是以编程方式。

Wicket's activity indicator/throbber/spinner is actually nothing more than an animated GIF. Wicket的活动指示器/ th子/旋转器实际上不过是动画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 . 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. 要更改颜色,您可以创建自己的相同大小的GIF动画,并覆盖默认发行版中包含的动画。

EDIT: 编辑:
Okay, after writing that I thought "there must be free icons available" and came up with this through Google Image Search: 好的,写完之后我以为“必须有免费的可用图标”,并通过Google Image Search提出了这个建议:

http://blogs.msdn.com/blogfiles/gduthie/WindowsLiveWriter/Needananimatedloadingicon_B811/ajax-loader_2.gif 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. 除了用于个人玩具/示例应用程序之外,您还应该检查自己是否将其用于其他用途。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM