GWT中TreeGrid组建无法显示

vic12121 发布于 2011/07/04 16:38
阅读 679
收藏 0

用GWT写了个前台页面:

 

package com.dareway.client.template;

import java.util.ArrayList;
import java.util.List;
import com.dareway.client.common.PanelFactory;
import com.dareway.client.util.ClientUtil;
import com.dareway.client.widget.dwtree.DWTree;
import com.dareway.client.widget.dwtree.DWTreeGrid;
import com.dareway.client.widget.dwtree.DWTreeLayout;
import com.dareway.client.widget.dwtree.DWTreeNode;
import com.dareway.client.widget.formItem.TextItem;
import com.dareway.client.widget.layout.CommonForm;
import com.dareway.client.widget.layout.DWHLayout;
import com.smartgwt.client.widgets.Canvas;

public class SourceManage extends PanelFactory {
	@Override
	public Canvas getViewPanel() {
	
		//构建页面布局
		final DWHLayout hlayout = new DWHLayout();
				
		final DWTreeGrid tree_grid = new DWTreeGrid("资源包列表");
		tree_grid.setHeight100();
		tree_grid.setWidth("20%");
		
		
		//更新DWTreeGrid
		final List<DWTreeNode> list = new ArrayList<DWTreeNode>();
		list.add(new DWTreeNode("1","root","0"));
		list.add(new DWTreeNode("2","123","root"));
        list.add(new DWTreeNode("2","123","root"));
	
		final DWTree tree = new DWTree();
		tree.setData(list);
		
		tree_grid.setData(tree);
		
	
		
		//更新DWVLayout
		TextItem aa= new TextItem("aaaa","aaaaa",12,true);
		CommonForm cform1 = new CommonForm("描述信息窗口");
		cform1.setWidth100();
		cform1.setHeight100();
		cform1.setFields(aa);
		//v_layout.addMember(cform1,0);
		
		
		hlayout.addMember(tree_grid);
		hlayout.addMember(cform1);
		return hlayout;
	}

}
但是页面中无法显示 TreeGrid 中编辑的内容。截图如下:
加载中
0
vic12121
vic12121

补充下方法参数说明:

l         DWTreeNode(String name, String nodeID, String parentNodeID, DataObject paras)

l         DWTreeNode(String name, String nodeID, String parentNodeID, String icon,                                                                                                         DataObject paras)

初始化DWTreeNode对象。

name:节点展示在树上的名称

nodeID:唯一标识id(nodeId), 注意nodeId在整棵Tree必须唯一,否则重复的只显示最

后一个。

    parentNodeID:父节点的nodeID。根节点设置为“”。

Icon:节点对应的图片。不复制会使用默认值。

Paras:节点包含的参数。

 

 

我把这段代码删掉之后重新写了一遍就正常了,很奇怪,不知道原因。正确代码:

 

package com.dareway.client.template;

import java.util.ArrayList;
import java.util.List;


import com.dareway.client.common.PanelFactory;
import com.dareway.client.widget.button.CButton;
import com.dareway.client.widget.dwtree.DWTree;
import com.dareway.client.widget.dwtree.DWTreeGrid;
import com.dareway.client.widget.dwtree.DWTreeNode;
import com.dareway.client.widget.layout.CommonForm;
import com.dareway.client.widget.layout.DWHLayout;
import com.dareway.client.widget.layout.DWVLayout;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.layout.HLayout;

/**
 * 
 * @Description:
 * @author fxb
 * @date 2011-5-20
 */
public class SourceManage extends PanelFactory {
	DWHLayout under;

	public Canvas getViewPanel() {
		final DWTreeGrid treeGrid;
		under = new DWHLayout();
		treeGrid = new DWTreeGrid("详细条目");
		treeGrid.setHeight(500);
		final DWTree tree = new DWTree();
		List<DWTreeNode> nodes = new ArrayList<DWTreeNode>();
		nodes.add(new DWTreeNode("我的账号", "root", "0"));
		nodes.add(new DWTreeNode("基本资料", "1", "root"));
		nodes.add(new DWTreeNode("修改密码", "2", "root"));
		nodes.add(new DWTreeNode("安全信息", "3", "root"));
		nodes.add(new DWTreeNode("密码找回", "4", "root"));
		tree.setData(nodes);
		treeGrid.setData(tree);
		treeGrid.setWidth("20%");
		under.addMember(treeGrid);
		return under;
	}


	
}






就是DWTreeGrid,DWTree等几个关键类换了下位置。截图如下:
调了半天,脑子蒙了都。
0
一号男嘉宾
一号男嘉宾
楼猪在用GWT做应用?
vic12121
vic12121
恩呢
返回顶部
顶部