maoyi606 发表于 2013-1-15 02:14:14

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

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技术来实现页面展示。
。。。
页: [1]
查看完整版本: 基于SW T控制反转实现插件界面开发