Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/336.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/gwt/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 树小部件仅显示列表中的一个值(GWT)_Java_Gwt_Gxt - Fatal编程技术网

Java 树小部件仅显示列表中的一个值(GWT)

Java 树小部件仅显示列表中的一个值(GWT),java,gwt,gxt,Java,Gwt,Gxt,我正在开发GWT应用程序,我正在使用com.google.GWT.user.client.ui.Tree和com.google.gwt.user.client.ui.TreeItem小部件以显示我的RPC方法中的所有GwtDomain对象。每个GwtDomain都有一些GwtActions值(在大多数情况下是读、写、删除的,但不是在所有情况下)。这是我查找所有GwtDomain的方法,在他的onSuccess方法中,我查找该GwtDomain的所有GWT: GWT_DOMAIN_SER

我正在开发GWT应用程序,我正在使用
com.google.GWT.user.client.ui.Tree
com.google.gwt.user.client.ui.TreeItem小部件以显示我的RPC方法中的所有GwtDomain对象。每个GwtDomain都有一些GwtActions值(在大多数情况下是读、写、删除的,但不是在所有情况下)。这是我查找所有GwtDomain的方法,在他的onSuccess方法中,我查找该GwtDomain的所有GWT:

     GWT_DOMAIN_SERVICE.findAll(new AsyncCallback<List<GwtDomain>>() {

                @Override
                public void onFailure(Throwable caught) {
                    exitMessage = MSGS.dialogAddPermissionErrorDomains(caught.getLocalizedMessage());
                    exitStatus = false;
                    hide();
                }

                @Override
                public void onSuccess(List<GwtDomain> result) {



                    for (final GwtDomain gwtDomain : result) {
                        GWT_DOMAIN_SERVICE.findActionsByDomainName(gwtDomain.name(), new AsyncCallback<List<GwtAction>>() {

                            @Override
                            public void onFailure(Throwable caught) {
                                exitMessage = MSGS.dialogAddPermissionErrorActions(caught.getLocalizedMessage());
                                exitStatus = false;
                                hide();
                            }

                            @Override
                            public void onSuccess(List<GwtAction> result) {

                                for (GwtAction gwtAction : result) {
                                rootCheckBox= new CheckBox();
                                rootCheckBox.setBoxLabel(gwtDomain.toString());
                                    treeItemCheckox = new CheckBox();

                                    rootTreeItem = new TreeItem(rootCheckBox);
                                    treeItem =  new TreeItem(treeItemCheckox);
                                    treeItemCheckox.setBoxLabel(gwtAction.toString());
                                    rootTreeItem.addItem(treeItem);

                                }
                                tree.addItem(rootTreeItem);

   }
                    });

}
GWT\u DOMAIN\u SERVICE.findAll(新的AsyncCallback(){
@凌驾
失败时的公共无效(可丢弃){
exitMessage=MSGS.dialogAddPermissionErrorDomains(catch.getLocalizedMessage());
exitStatus=false;
隐藏();
}
@凌驾
成功时公开作废(列表结果){
用于(最终GwtDomain GwtDomain:结果){
GWT_DOMAIN_SERVICE.findActionsByDomainName(gwtDomain.name(),new AsyncCallback()){
@凌驾
失败时的公共无效(可丢弃){
exitMessage=MSGS.dialogAddPermissionErrorActions(catch.getLocalizedMessage());
exitStatus=false;
隐藏();
}
@凌驾
成功时公开作废(列表结果){
for(GwtAction GwtAction:result){
rootCheckBox=newcheckbox();
setBoxLabel(gwtDomain.toString());
treeItemCheckox=新复选框();
rootTreeItem=新的TreeItem(rootCheckBox);
treeItem=新的treeItem(treeItemCheckox);
treeItemCheckox.setBoxLabel(gwtAction.toString());
rootTreeItem.addItem(treeItem);
}
树.附加项(rootTreeItem);
}
});
}

但是有了这段代码,我总是从GwtAction中得到一个值,而不是所有的值(在大多数情况下,每个treeItem2应该有3个项目)。有人能帮我吗?

这很正常。代码
树。addItem(rootTreeItem);
在for循环之外。 它一定在里面!
这是正常的。代码
树。addItem(rootTreeItem);
在for循环之外。 它一定在里面! 问候