1

In GWT is there a way for a widget to access a public member of the application's EntryPoint class? I want to store certain "application-wide" data in the EntryPoint class, and then have widgets access these fields and behave differently according on their values. In my mind it seems simple enough, but I just can't find the code for it anywhere...

4

1 回答 1

1

您不需要将这些数据存储在 EntryPoint 中,您可能希望将这些数据存储在一些常见的实用程序类中,并在应用程序加载时填充数据。

然后只需将对象传递给任何需要它的小部件。或者更好的是,使用Google Gin将其绑定在 Singleton 范围内,以使其在您的应用程序中的任何位置都可以访问。

于 2010-03-16T23:32:27.277 回答