六狼论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

搜索
查看: 39|回复: 0

基于SW T控制反转实现插件界面开发

[复制链接]

升级  50.67%

34

主题

34

主题

34

主题

秀才

Rank: 2

积分
126
 楼主| 发表于 2013-1-15 02:14:14 | 显示全部楼层 |阅读模式
http://www.ibm.com/developerworks/cn/opensource/os-cn-swtioc/index.html 描述了控制反转创建 SWT 界面的思想与优缺点。

使用控制反转 (IoC) 的设计思想,运用 XML 语言来描述 SWT 的用户界面 。
xml配置示例如下:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<Display>
<Shell Size="300,400" background="255,255,0">
    <Label bounds="80,15,140,30" background="0,0,0" text="Login"
alignment="CENTER" font="arial black,16,NORMAL" foreground="255,255,255" event = "select(1,10);contentCheck(String)"/>
<Label bounds="30,55,80,20" text="User Name:" background="255,255,0" />
<Text bounds="130,55,165,20" maxLength="8" name="username" event = "com.huawei.my.first.common.impl.VerifyEventCommand"/>
<Label bounds="30,95,80,20" text="Password:" background="255,255,0" />
<Password bounds="130,95,165,20" name="userpwd" event = "com.huawei.my.first.common.impl.VerifyEventCommand"/>
<Label bounds="30,135,80,20" text="User Sex:" background="255,255,0" />
<Text bounds="130,135,165,20" maxLength="8" name="usersex" />
<Label bounds="30,175,80,20" text="User age:" background="255,255,0" />
<Text bounds="130,175,165,20" maxLength="8" name="userage" />
<Button bounds="215,215,80,20" text="Submit" onclick = ""/>
</Shell>
</Display>

具体采用命令模式以、类反射机制以及读取xml技术来实现页面展示。
。。。
您需要登录后才可以回帖 登录 | 立即注册 新浪微博账号登陆

本版积分规则

快速回复 返回顶部 返回列表