Mícéal Gallagher in Java 2 minutes

SmartGWT - MVC using UIBinder

When it comes to development environments there are few as polished as Microsoft Visual Studio, especially when developing GUI driven applications (either for the web or desktop). I’m a huge proponent of separation of concerns through design patterns; Visual Studio does this really well. Bundling View and Controller code may start out perfectly tessellated but after a few bug fixes and with the addition of new functionality, it can become apparent that something is terribly wrong. Now you’ve got business logic chilling with your UI which can be the stuff of programming nightmares. Enter UIBinder! UIBinder for SmartGWT allows you to define your views in a separate file using a XML based syntax so you can turn this…

```defaultUIButtonItem btnPressMe = new UIButtonItem(); btnPressMe.setWidth(80); btnPressMe.setTitle(“Press Me!”); btnPressMe.setShowTitle(true); btnPressMe.setStartRow(false); btnPressMe.setEndRow(false); btnPressMe.setAlign(Alignment.LEFT); btnPressMe.setShowHint(true); btnPressMe.setIcon(“thumb.png”);


Into this...

```xhtml<sc:UIButtonItem ui:field="btnPressMe" width="80" showTitle="false" title="Press Me!" startRow="false" endRow="false" align="{LEFT}" showHint="true" icon="thumb.png"/>

There is some great documentation over at GWTProject.og which will help you get started.