gpt4 book ai didi

gwt - GWT 中的 UIBinder

转载 作者:行者123 更新时间:2023-12-02 09:58:46 25 4
gpt4 key购买 nike

我正在尝试理解 GWT 中的 UIBinder 概念。我在网上浏览了几个教程。这是我的问题:

1) 为什么要使用 UIBinder?难道只是因为我们会编写更少的代码并像直接编写 javascript 一样进行开发吗?

2) 有什么事情可以通过使用 UiBinder 完成而 GWT 无法完成,反之亦然?

我经历了 this 链接提供了对此的直接讨论。还有其他要点或建议吗?

提前致谢。

最佳答案

GWT在创建DOM的过程中最大的优势是UiBinders ,也称为“声明式布局”。

UiBinders provide a way for you to declare the layout of your application and widgets using traditional HTML and CSS rather than programatically in java. This provides you with a much richer way to create your application.

Browsers are better at building DOM structures by cramming big strings of HTML into innerHTML attributes than by a bunch of API calls. UiBinder naturally takes advantage of this, and the result is that the most pleasant way to build your app is also the best way to build it.

  • UiBinder是一个旨在分离功能和功能的框架用户界面 View 。

  • UiBinder 框架允许开发人员构建 gwt 应用程序HTML 页面中配置了 GWT 小部件。

  • UiBinder 框架让与 UI 设计师的协作更加轻松与 Java 源代码相比,谁更熟悉 XML、HTML 和 CSS
  • UIBinder 提供了一种定义用户界面的声明方式。

  • UIBinder 将编程逻辑与 UI 分开。

  • UIBinder 类似于 JSP 与 Servlet。

这是一个example UIBInder 如何比传统的 java 代码更具优势。

回答您的问题(这些是我在开发过程中观察到的)

  1. 如果您熟悉 HTMl 和 CSS,您可以简单地在其中布局结构(意味着在 ui.xml 模板中),并且可以简单地使用总重量。这会减少编译时间。

  2. 同样,您可以简单地在 xml 中编写标记并应用样式和其他 DOM 属性,就像在 java 代码中一样,您必须编写几行代码(至少 2 到 3 行)来准备一个小部件具有样式和特定 DOM 属性。

根据我最近的经验,我在这里总结了几点。 http://codeinventions.blogspot.in/2014/07/why-to-use-uibinder-in-gwt.html

关于gwt - GWT 中的 UIBinder,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16051682/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com