本站首页    管理页面    写新日志    退出


«August 2025»
12
3456789
10111213141516
17181920212223
24252627282930
31


公告
 本博客在此声明所有文章均为转摘,只做资料收集使用。

我的分类(专题)

日志更新

最新评论

留言板

链接

Blog信息
blog名称:
日志总数:1304
评论数量:2242
留言数量:5
访问次数:7586374
建立时间:2006年5月29日




[Wicket]Wicket几种超连接方式
软件技术

lhwork 发表于 2006/7/28 11:45:53

可以当做书签的连接:add(new BookmarkablePageLink("admin",Admin.class));定义行为的连接:Link link1 = new Link("link1")        {            public void onClick()            {                count1.clicks++;            }        };        add(link1);实现一个自定义连接:class CustomLink extends Link        {            final ClickCount count2;            /**             * Construct.             * @param id             */            public CustomLink(String id)            {                super(id);                count2 = new ClickCount();                add(new ClickCountLabel("label2", count2));            }            public void onClick()            {                count2.clicks++;            }        }        add(new CustomLink("link2"));按钮作为连接:// and if we know we are going to attach it to a <input type="button> tag, we shouldn't        // use a label, but an AttributeModifier instead.        class ButtonLink extends Link        {            final ClickCount count3;            /**             * Construct.             * @param id             */            public ButtonLink(String id)            {                super(id);                count3 = new ClickCount();                add(new AttributeModifier("value", new Model()                {                    public Object getObject(Component component)                    {                        // we just replace the whole string. You could use custom                        // AttributeModifiers to e.g. just replace one part of the                        // string if you want                        return "this button is clicked " + count3.clicks + " times";                    }                }));            }            public void onClick()            {                count3.clicks++;            }        }        add(new ButtonLink("link3"));


阅读全文(3102) | 回复(0) | 编辑 | 精华
 



发表评论:
昵称:
密码:
主页:
标题:
验证码:  (不区分大小写,请仔细填写,输错需重写评论内容!)



站点首页 | 联系我们 | 博客注册 | 博客登陆

Sponsored By W3CHINA
W3CHINA Blog 0.8 Processed in 0.047 second(s), page refreshed 144760307 times.
《全国人大常委会关于维护互联网安全的决定》  《计算机信息网络国际联网安全保护管理办法》
苏ICP备05006046号