Java 在演示者之间传递控件/值,GWT模型视图演示者?
我是新手。在我的一个用例中使用GWT实现模型视图演示者模式时,我遇到了这个特定的问题 我刚从Ray Ryan的Google IO演讲开始,并在Google开发者网站上发表了一些文章。我没有使用任何GWT附加组件,比如GWTP、MVP4G、杜松子酒或任何其他东西。 只需遵循GWT网站上的联系人示例,并尝试对我的案例进行建模 问题就在这里 我有这样的AppController onValueChage方法Java 在演示者之间传递控件/值,GWT模型视图演示者?,java,design-patterns,gwt,mvp,Java,Design Patterns,Gwt,Mvp,我是新手。在我的一个用例中使用GWT实现模型视图演示者模式时,我遇到了这个特定的问题 我刚从Ray Ryan的Google IO演讲开始,并在Google开发者网站上发表了一些文章。我没有使用任何GWT附加组件,比如GWTP、MVP4G、杜松子酒或任何其他东西。 只需遵循GWT网站上的联系人示例,并尝试对我的案例进行建模 问题就在这里 我有这样的AppController onValueChage方法 public void onValueChange(ValueChangeEvent&l
public void onValueChange(ValueChangeEvent<String> event) {
if(token != null){
presenter = null;
if(token == "display")
{
presenter = new DefaultPresenter(rpcService, eventBus, new DefaultView());
}
else if(token == "popup")
{
presenter = new PopUpPresenter(rpcService, eventBus, new PopUpView());
}
else if(token == "dialog")
{
presenter = new DialogPresenter(rpcService, eventBus, new DialogView());
}
if (presenter!= null) {
presenter.go(container);
}
}
}
ValueChange上的公共作废(ValueChangeEvent事件){
if(令牌!=null){
演示者=空;
如果(标记==“显示”)
{
presenter=新的DefaultPresenter(rpcService、eventBus、new DefaultView());
}
else if(标记==“弹出窗口”)
{
presenter=新的PopUpPresenter(rpcService、eventBus、new PopUpView());
}
else if(标记==“对话框”)
{
presenter=new DialogPresenter(rpcService、eventBus、new DialogView());
}
如果(演示者!=null){
演示者.go(容器);
}
}
}
我的应用程序是这样运行的,首先显示,然后选择一个对话框,然后设置一些变量。然后在对话框被隐藏后,我需要返回到我原来的显示并继续。但问题是,我无法使用相同的视图返回到我原来的DisplayPresenter,因为每当历史记录发生更改时,我都会创建一个新的presenter实例
粗体中的所有内容都是独立的演示者,它们扩展了演示者,并且都有特定的视图
有问题吗?
1.每次历史发生变化时,请帮助我走出创建演示者新实例的困境
关于在演示者之间传递状态信息(问题1),签出可能会有所帮助。关于在演示者之间传递状态信息(问题1),签出可能会有所帮助