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

发布于 2024-11-01 03:59:57 字数 260 浏览 0 评论 0原文

情况:我正在使用 Wicket 的 IndicatingAjaxButton。我在黑色背景的页面上设置了按钮。当用户按下按钮时,按钮的活动指示灯会熄灭并旋转,直到系统准备好继续前进。

问题:由于黑色背景,指示器看起来很糟糕。由于指示器的一部分以黑色动画,因此使用黑色背景上的指示器会丢失一些细节。

问题:Wicket 中是否可以更改 IndicatingX [按钮、链接等] 的颜色,或者我是否必须以新的方式设计我的页面?

Situation: I'm working with Wicket's 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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

坏尐絯 2024-11-08 03:59:57

因此,利用 Lord 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();
    }
}

并将其用于您的任何页面。

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.

━╋う一瞬間旳綻放 2024-11-08 03:59:57

这是不可能的。嗯,不是以编程方式。

Wicket 的活动指示器/颤动器/旋转器实际上只不过是一个动画 GIF。它位于

[此处您的 Wicket 版本]\wicket-src\wicket\src\main\java\org\apache\wicket\ajax\indicator.gif

AbstractDefaultAjaxBehavior 中引用。

要更改颜色,您可以创建自己的相同大小的动画 GIF,并覆盖默认发行版中包含的 GIF。

编辑:
好吧,写完后我想“一定有免费的图标可用”,并通过 Google 图片搜索想到了这一点:

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

认为它是免费且无限制使用的,但是我没有检查太仔细。如果您将其用于个人玩具/示例应用程序之外的其他用途,您应该自行检查。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文