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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/file/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:使用UiBinder的单例仪表板_Java_Gwt_Uibinder - Fatal编程技术网

Java GWT:使用UiBinder的单例仪表板

Java GWT:使用UiBinder的单例仪表板,java,gwt,uibinder,Java,Gwt,Uibinder,我想创建一个单例仪表板。但无法排序在哪里放置initWidget(uiBinder.createAndBindUi(this)) 另外,createAndBindUi(this)需要类的这个实例。如何进行?我是GWT的新手 public class UserDashboard extends Composite{ interface MyUiBinder extends UiBinder<Widget, UserDashboard> {} private static MyUiBi

我想创建一个单例仪表板。但无法排序在哪里放置initWidget(uiBinder.createAndBindUi(this))

另外,createAndBindUi(this)需要类的这个实例。如何进行?我是GWT的新手

public class UserDashboard extends Composite{

interface MyUiBinder extends UiBinder<Widget, UserDashboard> {}
private static MyUiBinder uiBinder = GWT.create(MyUiBinder.class);



 private static UserDashboard userDash= new UserDashboard();   //singleton Dashboard;


private UserDashboard(){}

public static UserDashboard getDashInstance(){

  //**initWidget(uiBinder.createAndBindUi(this))**;
    return userDash;
}
公共类UserDashboard扩展了复合{
接口MyUiBinder扩展了UiBinder{}
私有静态MyUiBinder=GWT.create(MyUiBinder.class);
private static UserDashboard userDash=new UserDashboard();//singleton Dashboard;
私有UserDashboard(){}
公共静态UserDashboard getDashInstance(){
//**initWidget(uiBinder.createAndBindUi(this))**;
返回userDash;
}

创建一个视图工厂,然后从那里返回视图。

在构造函数中,就像其他小部件一样。它是否是单体有点不相关。我建议在文档后面使用GIN+搜索GIN+uibinder以获取更多示例。