Java-only layout issues
• It is difficult to format HTML in Java - Think of servlets against JSP - HTML layout is usually not dynamic enough • If so, use it! • It’s hard to imagine a layout - It’s not easy to see the end result of viewing Java code • It’s hard to use the web GUI effectively - They usually don’t know Java - Even if you manage to get a Java design, it’s hard to maintain
UiBinder: The main idea
• Use an XML file to place a piece of content - Can represent HTML or a Widget • Make a Java class that represents this piece of content - There are some overly detailed steps, but Eclipse has shortcuts that automate the creation of most of them • Use this Java class in your main application - If the class represents HTML, use the GWT DOM API to paste it - If the class is a widget, use the usual "add" method to paste it
Advantages of UiBinder • Can create complex page layouts using HTML - Or HTML-like XML • Similar to adding JSP to applications with a clean servlet • More convenient • Graphic web designers can initial design due to maintenance - Easy to start with plain HTML and gradually sprinkle GWT binding • Separation of problems - The aesthetics and functionality of the user interface are no longer mashed • Checking the time of cross-references between XML and Java and even within XML itself
• Improved browser performance - Browsers very quickly type long lines in the innerHTML of an element • Not so much when it comes to executing the JavaScript API - Lesson: Use plain HTML if possible! - The goal of UiBinder: make the right choice, the right choice
Ajinkya purane
source share