繁体   English   中英

在没有浏览器历史记录更改的情况下寻找有关GWT / MVP操作的输入

[英]Looking for input on GWT / MVP action w/o browser history change

我正在尝试使用MVP模式开发GWT应用程序。 到目前为止,除了一种特殊的操作情况之外,效果还不错:不更改url的操作(浏览器历史记录不变)。

在GWT MVP模式中,事件是从演示者发送的,应用控制器会捕获事件并更新浏览器历史记录。 如果历史记录已更改,则视图将更新。

**具有历史更改的MVP(效果很好)**

Current URL is /list
User clicks on contactdelete button.
Fire DeleteContactAction event.
App controller catches, change history to 'delete'
onValueChange is called
if (token.equals("delete")) 
delete contact screen, then delete contact
Fire ContactDeletedEvent 
app controller catches and change the history to list 
onValueChange is called: contact list refreshes

没有历史更改的对话框的GWT MVP模式

**问题**-我使用对话框,但不想更改浏览器历史记录,所以这里是问题所在:

  Current URL is /list
  User clicks on contactdelete button.
  Contact is deleted
  Fire ContactDeletedEvent.
  App controller catches, change history to 'list'
  **onValueChange is NOT called** because url is already /list and there is no change
  # problem: contact list does not refresh

问题:有人知道在MVP上下文中实现此目标的模式吗?

任何帮助/想法表示赞赏。

您是否正在使用某些框架(除了GWT之外)会自动更改历史记录?

常规的GWT / MVP不需要更改历史记录,实际上,通常由应用程序来更新历史记录本身。

如果要在不更改历史记录的情况下更新应用程序的状态,则可以使用EventBus发布应用程序其他元素可以订阅的事件,以在不更改历史记录的情况下更新应用程序的状态。

基本上,您将必须创建自己的PlaceHistoryHandler。 您的自定义PlaceHistoryHandler将忽略特定类型的PlaceChangeEvent(即,它将不会更新其Historian)。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM