|
|
基本数据库驱动的倒是见过,基本脚本的看来就是定义了一种DSL。
写DSL的一个缺点可能是其功能的限制,如果有DSL不支持的功能怎么办?是用宿主语言来写?
用xml描述界面的话,可以借助xml编辑工具(如xmlspy)提供代码提示功能。至于事件的话,感觉用jeasyform也挺简单的。比如登录窗口的一个事件:
- public class LoginEvent implements EventHandler {
- public boolean execute(Window window, Component component, int i) {
- String userCode = window.getValue("usercode");
- String password = window.getValue("password");
- if(check(userCode,password)) {
- window.setMessage("登录成功");
- window.open("主窗口",new HashMap(){put("usercode",userCode);});
- return true;
- } else {
- window.setMessage("用户名或密码不正确");
- return false;
- }
- }
- }
复制代码
应该不比脚本语言复杂吧。
未来的话,我可以让jeasyform支持ruby等脚本语言。呵呵 |
|