GWT开发利器之Cypal Studio for GWT

一)什么是 Cypal Studio for GWT?<o:p></o:p>

Cypal Studio for GWT 其实就是Googlipsehttp://www.googlipse.com),但Googlipse已经不再更新。该项目作者创建了一个新产品来替代Googlipse,这就是Cypal Studio for GWT。从下面的配置过程大家也可以看到二者基本一致。<o:p></o:p>

<o:p></o:p>

二)环境配置及示例<o:p></o:p>

  1.Eclipse 3.2 + WTP1.5

  2.GWT,从http://code.google.com/webtoolkit/download.html下载并解压缩至D:/gwt-windows-1.4.10目录

  3.Cypal Studio for GWT,从http://www.cypal.in/studio 下载并解压缩至Eclipse目录

     4.运行Eclipse,打开Window-> Preferences->Cypal Studio,设置GWT Home(步骤2)

  5.创建Dynamic Web Project,在configurations选项选中Default Cypal Studio Project

  6. 创建 module<o:p></o:p>, File->New->Other->Cypal Studio-> Module ,输入Module 名称,注意package 不能为空,否则无法创建com.yourcompany.server com.yourcompany.clinet目录。

       打开com.yourcompany.gwt.test.public下的test.html,添加一个表格。
      
html 代码
 
  1. <table align=center>  
  2.             <tr>  
  3.                 <td id="slot1"></td><td id="slot2"></td>  
  4.             </tr>  
  5.         </table>  

<o:p></o:p>

   Test类实现EntryPoint接口,需要手工实现onModuleLoad方法。     

java 代码
 
  1. public void onModuleLoad() {  
  2.         // TODO Auto-generated method stub  
  3.         final Button button = new Button("Click me");  
  4.         final Label label = new Label();  
  5.   
  6.         button.addClickListener(new ClickListener() {  
  7.           public void onClick(Widget sender) {  
  8.             if (label.getText().equals(""))  
  9.               label.setText("Hello World!");  
  10.             else  
  11.               label.setText("");  
  12.           }  
  13.         });  
  14.   
  15.         // Assume that the host HTML has elements defined whose  
  16.         // IDs are "slot1", "slot2".  In a real app, you probably would not want  
  17.         // to hard-code IDs.  Instead, you could, for example, search for all   
  18.         // elements with a particular CSS class and replace them with widgets.  
  19.         //  
  20.         RootPanel.get("slot1").add(button);  
  21.         RootPanel.get("slot2").add(label);  
  22. }  
<o:p></o:p>

 

  1. 运行<o:p></o:p>

点击Run->Run/Debug,打开运行配置对话框,双击GWT Hosted Mode Application,在右侧选择项目和模块,然后可以运行或调试。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值