Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIBinder in GWT

Tags:

gwt

uibinder

I am trying to understand the UIBinder concept in GWT. I went through couple of tutorials online. Here is my question:

1) Why exactly one would want to use UIBinder? Is it only because we would be writing less code and developing as though we are writing javascript directly?

2) Is there anything that can be accomplished by using UiBinder that cannot be done by GWT or vice-versa?

I went through this link which provides a straight discussion on the same. Any other points or suggestions?

Thanks in advance.

like image 439
LPD Avatar asked Apr 17 '13 04:04

LPD


1 Answers

The biggest advantage of GWT in the process creating DOM is UiBinders, also known as “Declarative Layout”.

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.

  • The UiBinder is a framework designed to separate Functionality and View of User Interface.

  • The UiBinder framework allows developers to build gwt applications as HTML pages with GWT widgets configured throughout them.

  • The UiBinder framework makes easier collaboration with UI designers who are more comfortable with XML, HTML and CSS than Java source code
  • The UIBinder provides a declarative way of defining User Interface.

  • The UIBinder separates the programmic logic from UI.

  • The UIBinder is similar to what JSP is to Servlets.

And here is one example that how UIBInder gives advantage over the traditional java code.

Coming to your questions (these are observed while i am developing)

  1. If you are familiar with HTMl, and CSS,you can simply layout the structure there(means in ui.xml tempaltes)and can simply play with GWT. This reduces your compile time.

  2. Again, You can simply write the markup in xml and apply styles and other DOM attributes,where as in java code you have to write no.of lines of code (well at least 2 to 3) prepare a widget with styles and specific DOM attributes.

From my experience I summarized points here recently. http://codeinventions.blogspot.in/2014/07/why-to-use-uibinder-in-gwt.html

like image 93
Suresh Atta Avatar answered Sep 23 '22 13:09

Suresh Atta