什么是历史与地方之间的GWT的差异/关系? [英] What's the difference/relationship between history and places in GWT?

查看:111
本文介绍了什么是历史与地方之间的GWT的差异/关系?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据我的观察,历史是用来与多个AJAX交互一个HTML页面。它只是每个国家分配给一个特定的标记来区分(或标记)他们。而对于地方则是用于不同的HTML页面。它给每个HTML页面一个字符串标记。

Based on my observation, the History is used in a single html page with multiple AJAX interactions. It just assigns each state to a specific token to distinguish(or mark) them. While for the Places, it's used for different html pages. It assigns each html page to a string token.

他们之间有什么关系?做我的理解是否正确?

Is there any relationship between them? And do I understand correctly?

推荐答案

正如官方文档:

有一个地方是重$ P $ Java对象psenting用户界面的特定状态。一个地方可以通过定义PlaceTokenizer每个地方转变和从URL历史记录令牌(见GWT的历史机制),和GWT的PlaceHistoryHandler自动更新对应于每个地方你的应用程序浏览器的URL。

A place is a Java object representing a particular state of the UI. A Place can be converted to and from a URL history token (see GWT’s History mechanism) by defining a PlaceTokenizer for each Place, and GWT’s PlaceHistoryHandler automatically updates the browser URL corresponding to each Place in your app.

所以,你能想到的地方和活动的更高水平以上的历史。例如,你可以去到一个新的地方在应用程序中通过改变历史的令牌 History.newItem(令牌)。但是你可以使用 PlaceController 做同样的: placeController.goTo(新TokenPlace()) TokenPlace 与历史的记号明确关联标记,有一个活动时,这个地方是达到了,等下罩类实例化, History.newItem(令牌)仍然会叫,但你不必担心有关管理历史手动标记。作为奖励,你的应用程序可能会变得不那么加上,因为现在活动1 不必知道活性2 什么 - 活动1 只是触发转会到一个新的地方。它不关心它的活动它的关联。

So you can think of Places and Activities a higher level above History. For example, you can go to a new "place" in your application by changing the history token with History.newItem("token"). But you can use PlaceController to do the same: placeController.goTo(new TokenPlace()). TokenPlace is explicitly associated with the history token token, has an Activity class instantiated when this place is reached, etc. Under the hoods, History.newItem("token") will still be called, but you don't have to worry about managing history tokens manually. As a bonus, your application will probably become less coupled, because now Activity1 doesn't have to know anything about Activity2 - Activity1 just triggers a move to a new Place. It doesn't care which activity it's associated with.

这篇关于什么是历史与地方之间的GWT的差异/关系?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆