[jboss-user] [JBoss Tools] - How we use jface databinding in Deltacloud Tools

Andre Dietisheim do-not-reply at jboss.com
Tue Oct 26 10:27:06 EDT 2010


Andre Dietisheim [http://community.jboss.org/people/adietish] modified the document:

"How we use jface databinding in Deltacloud Tools"

To view the document, visit: http://community.jboss.org/docs/DOC-15964

--------------------------------------------------------------
h1. Less code
If you use jface databinding to code your swt views in Eclipse you'll get spared from writing listeners and updating code by hand. JFace databinding offers very nice abstractions and automatisms that offer funcitonalities for the vast majority of the tasks where you have to listen for user input and update the view accordingly.

h1. *Premise*
If you implement a complex and highly dynamic UI in Eclipse you'll have to code many many many listener that wait for user actions. Those listeners mostly do nothing spectacular but update widgets and models in reaction to the user inputs. You end up with a lot of repetitive boilerplate code. UI frameworks in the non-java land (ex. http://qt.nokia.com/products/  Trolltechs QT) already have approaches that are far more elegant and slick than what we knew for Swing and SWT.
By luck Eclipse has progressed in this area (since 2005!) and offers neat abstractions that help a lot in this area and lead to far more concise and a less verbose implementations: Jface Databinding!

h2. Usecase
We had to implement a wizard page that allows a user to create a connection to a deltacloud server. The user has to supply a name, an url and the credentials for it.

 http://community.jboss.org/servlet/JiveServlet/showImage/10530/cloud-connection-wizard.png  http://community.jboss.org/servlet/JiveServlet/downloadImage/10530/cloud-connection-wizard.png 

Sounds pretty simple at first sight. Looking closer at it you'll discover few buttons that shall be disabled if you enter inacurrate values. To inform the user in a intuitive way, the inaccurate values shall be marked by decorations. Furthermore a wizard page shows a global  error message that reflects whether the user may finish the steps he's up to.

 http://community.jboss.org/servlet/JiveServlet/showImage/10531/invalid-url.png  http://community.jboss.org/servlet/JiveServlet/downloadImage/10531/invalid-url.png 

h1. Solution

h2. No duplicate names
Our GUI holds multiple connections to various deltacloud servers. The wizard we discuss here allows you to edit existing connections or create new ones. You may of course not use a name that's already used for another connection. The wizard shall inform you that the name you chose is already used.

 http://community.jboss.org/servlet/JiveServlet/showImage/10533/duplicate-name.png  http://community.jboss.org/servlet/JiveServlet/downloadImage/10533/duplicate-name.png  
To be intuitive the wizard shall decorate the field that's invalid. The wizard shall also show you what's wrong in cleartext and disallow you may to finish the wizard.


h1. Conclusion
--------------------------------------------------------------

Comment by going to Community
[http://community.jboss.org/docs/DOC-15964]

Create a new document in JBoss Tools at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=102&containerType=14&container=2128]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20101026/f8f66eb1/attachment.html 


More information about the jboss-user mailing list