What is the best approach towards styling GWT applications?

一世执手 提交于 2019-11-30 07:09:29

It all depends - on you, your experience, your team, etc:

  1. The usual/older approach of Panels, Widgets and Compositing will be easier to work with/more familiar:
    • If you are a Java programmer experienced with frameworks like Swing, etc. (I think that was the point of the GWT team),
    • Or if you come from the "desktop world" in general.
  2. The UiBinder approach is the newer one:
    • Recommended if you are just starting your experience with GWT (it seems UiBinder is here to stay, and it allows more flexibility than the above approach),
    • Recommended if you have experience with web development (or desktop frameworks that use markup, like .NET's XAML, etc), since you'll be working in the familiar world of HTML/XML,
    • If you are working in a larger team, where you have designated designers in charge of the look of the web application (and they don't know/care about GWT). Cutting up the layout into HTML code should be pretty straightforward for them and you can, with little work, convert those templates into UiBinder's XML templates.

None of the above approaches is perfect - that's why it's worth to know their strong and weak points - but the end decision should be yours alone, since you know your/your team's capabilities best :)

So far, the best approach I found:

  1. get rid of any default GWT theme
  2. use UiBinder as much as possible
  3. place your CSS in ui.xml that describes the widget
  4. have one public Common CssResource with rules reused by many widgets

that way you don't need to maintain one global stylesheet which always is a pain (common problem: where is this rule used?)

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!