Baobab

Fast(er) building of Eclipse SWT-based user interfaces in Java using JSON

View the Project on GitHub milanaleksic/baobab

Wish to see all documentation detail?

Basics

Motivation and design approach

Creating pure SWT interfaces is often a headache since it is hard to follow up what is happening in the code if you have a complex UI tree.

Yes, you can divide the code into thousand methods, but it still does not make it easier to focus on the functional part if you have so much ui-generating code.

There are some very innovative approaches to fix this problem (before all others - GroovySWT). This project goes one step further since it does similar thing while you still stay in Java without the clutter of UI code, which is migrated to the JSON files (extension *.gui by default).

How to download and try it

This project was previously published as a Maven artifact and deployed on S3 but it incurred cost that wasn't payed back by donnations, so I had to remove the bucket's contents.

My apologies for the troubles caused, but if you are willing to host the artifacts please reach out to me so that I can include the deployed place on this page.

Project dependencies

Baobab depends on following frameworks/libraries:

If you don't use these libraries (or dependency management at all, for which there can't be any good reason) then you might choose to download the core artifact with all dependencies packed except SWT (which is platform-dependent) from following link:

Interactive editor

Editor is a tool that should allow you to quickly change existing or make new GUI files. While you type you will be able to see changes immediately, or an error message (the thin red line at the bottom of the window) on which you can click to see the stack trace.

Inside the editor you can see all of the widgets registered using widget naming via _name special tag and current location in the files (very useful when tracking down errors from stack traces) , and has some basic editor functionalities, like open/save/text search/copy&paste.

Of course, Editor has been built also using Baobab and source code is included in the Github Repo :)

To run the editor, you have 2 options:

  1. checkout the project and mvn package - you will get executable baobab-editor/target/baobab-editor-{version}-all.jar,
  2. download the assembled artifact from the github page https://github.com/milanaleksic/baobab/releases.

Be careful: SWT is expected to be beside the editor JAR file as swt.jar, since it environment-dependent dependency.

If you wish to open GUIs that use additional shortcuts for classes, you need to add to the classpath of the editor the output jar/dir of your project.

Editor is a tool that should allow you to quickly change existing or make new GUI files. While you type JSON definition of the interface you will be able to see changes immediately, or an error message (the thin red line at the bottom of the window) on which you can click to see the stack trace.

Editor uses Guice 3.0 as the DI container (required dependency).

A feature you might consider using is editor's live file update support. This means you can edit the file in a heavy-duty / feature-rich editor (Sublime Text / Vim / IntelliJ etc.) which has better JSON support than Baobab Editor will ever have. Every time you save file in external editor file will be re-read by Editor as long as the .gui file is open at the same time in Baobab Editor. Practical, right?.

For specific syntax details of the GUI files please take a look at the documentation page.

Feature requests / Ideas / bugs / problems?

Try to use the project's Issues page to report feature requests or send bug reports.

If you wish to contact me good way to do it is via email: milanaleksic@gmail.com. I maintain also a web site: www.milanaleksic.net

If this project helped you a lot in rebuilding/improving your interface, consider a donation to keep me more focused on this project in my free time in the future: