`

GWT之怪现象

GWT 
阅读更多
同样的一段代码,加上一句 Window.alert("Debug: 0000");   就可以继续执行,否则不行!!真是怪了.. 代码如下:
java 代码
  1. private void initLeftList() {   
  2.            
  3.         ufRoleService.loadAllUserRole(new AsyncCallback() {   
  4.             public void onFailure(Throwable caught) {   
  5.                 Window.alert("获得角色信息时,数据库出错!!");   
  6.             }   
  7.             public void onSuccess(Object result) {   
  8.                 List roles = (List) result;   
  9.                 if (roles != null) {   
  10.                     int count = 0;   
  11. //                  Window.alert("Debug: 0000");   
  12.                     roleTable.resize(roles.size(), 2);   
  13.                     for (Iterator iter = roles.iterator(); iter.hasNext();) {   
  14.                         UfRoleDTO element = (UfRoleDTO) iter.next();   
  15.                         roleTable.setText(count, 0, element.getRolename());   
  16.                         roleTable.getCellFormatter().
  17. addStyleName(count, 0"financeTableRowWithCheckBox2");   
  18.                         checkBoxs = new CheckBox[allFuncNodes.size()];   
  19.                         for (int i = 0; i < allFuncNodes.size(); i++) {   
  20.                             checkBoxs[i] = new CheckBox();   
  21.                             UfFuncregisterDTO dto = (UfFuncregisterDTO) allFuncNodes.get(i);   
  22.                             checkBoxs[i].setText(dto.getFunName());   
  23.                         }   
  24.                         Window.alert("Debug: 1111");   
  25.                         // 得到当前选择的用户的权限节点   
  26.                         ufRoleService.findByPk(element.getPkRole().toString(), new AsyncCallback() {   
  27.                             public void onFailure(Throwable caught) {   
  28.                                    
  29.                                 Window.alert("获得角色信息出错!!");   
  30.                             }   
  31.                             public void onSuccess(Object result) {   
  32.                                    
  33.                                 if(result == null) {   
  34.                                     Window.alert("角色为空!!");   
  35.                                     return ;   
  36.                                 }   
  37.                                 UfRoleDTO roleDTO = (UfRoleDTO) result;    
  38.                                 if(roleDTO.getUfRoleFuncs() != null) {   
  39.                                     //角色功能关联   
  40.                                     Iterator iter = roleDTO.getUfRoleFuncs().iterator();   
  41.                                     while(iter.hasNext()) {   
  42.                                         UfRoleFuncDTO roleFuncDTO = (UfRoleFuncDTO) iter.next();   
  43.                                         //得到功能节点主键   
  44.                                         UfFuncregisterDTO funDTO = roleFuncDTO.getUfFuncregisterDTO();   
  45.                                         validFunc.add(funDTO);   
  46.                                     }   
  47.                                 }   
  48.                             }   
  49.                         });   
  50. //                      Window.alert("Debug: 2222");   
  51. //                      将构造好的CheckBox加入到面版中   
  52.                         HorizontalPanel hPanel = new HorizontalPanel();   
  53.                         for (int i = 0; i < checkBoxs.length; i++) {   
  54.                             hPanel.add(checkBoxs[i]);   
  55.                         }   
  56.                         roleTable.setWidget(count, 1, hPanel);   
  57.                         roleTable.getCellFormatter().addStyleName(count, 1"financeTableRowWithCheckBox");   
  58.                         count ++;   
  59.                     }   
  60.                 }   
  61.             }   
  62.         });   
  63.     }  

 

 

 

 

分享到:
评论
3 楼 jvincent 2006-12-25  
终于搞定了..原来是使用了两个数据没有全部加在完成就使用了.结果报了空指针..
2 楼 jvincent 2006-12-22  
还是不行啊..为什么啊?
1 楼 jvincent 2006-12-21  
<p>自己解决..</p>
<p>方法:把第7行的代码改为:</p>
<div class='code_title'>java 代码</div>
<div class='dp-highlighter'>
<div class='bar'>
<ol class='dp-j'>
    <li class='alt'><span><span class='keyword'>if</span><span>(role == </span><span class='keyword'>null</span><span>) {   </span></span></li>
    <li class=''><span>   Window.alert(</span><span class='string'>"角色为空!!"</span><span>);l   </span></li>
    <li class='alt'><span>}   </span></li>
    <li class=''><span>.....  </span></li>
</ol>
</div>
不知是何原因....研究中.......</div>

相关推荐

Global site tag (gtag.js) - Google Analytics