GWT 应用程序中的上下文相关帮助
我需要在我的 GWT 应用程序中提供上下文相关的帮助。为此,每个 GWT 视图都会有许多帮助链接,每个链接都会打开一个包含适当帮助文本的对话框(每个链接都不同)。问题是我的视图类中不能有这么多 ui:field 元素,每个元素都有唯一的名称和单击侦听器,因为帮助链接的数量可能非常大。我需要的是在我的 UI 活页夹 xml 文件中包含许多锚点元素,并且所有锚点应该具有相同的单击侦听器。单击侦听器将根据一些参数来决定帮助文本在对话框中显示。
我尝试对所有链接使用具有不同历史标记的超链接元素,但它改变了历史记录,这是不希望的。我只想显示一个带有适当帮助消息的对话框,而不修改历史记录。
在GWT中可以吗?
感谢您的帮助。
I need to provide context sensitive help in my GWT application. For this every GWT view will have many help links each of which will open a dialog box with appropriate help text (different for each link). The problem is I cannot have so many ui:field elements each with unique name and click listener in my view classes as the number of help links may be very large. What I need is to have many Anchor elements in my UI binder xml file and all the anchors should have the same click listener. The click listener will decide based on some parameter which help text to display in the dialog box.
I tried to use Hyperlink element with different history tokens for all links, but it changes the history which is not desirable. I just want to show a dialog box with appropriate help message without modifying history.
Is it possible in GWT?
Thanks for your help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
显然,您可以在 UiBinder 中使用
,然后在代码中添加处理程序。但是,由于您的应用程序周围有很多这样的内容,所以我会使用 gwtQuery:
然后我只需将 css 类
.help-link
添加到所有相关锚点。You can obviously use
<g:Anchor href="javascript:;">
in your UiBinder and later add handler in your code.But, since you have a lot of this all around your app I'd use gwtQuery:
then I'd just add css class
.help-link
to all relevant anchors.