Griffon+Remote GORM+X: Inspirations for the Best RIA Horse!

Today I explain a possibility of a pure Java-based client/server application (the client side should be a Rich Internet Application) with a database backend.

I know that other people might already had this idea and others implemented this in a different way and Griffon is on the way, but let my explain it now in (more) detail. It is only an aggregation of existing tools.

How should it look like?

We simply replace the HTML-view of an ordinary Grails application with Griffon! So instead of a browser we will have the mature JVM and we could programm all in Java/Groovy! No JavaScript, no HTML, no CSS, no …!

(Ups. No CSS? Okay we could use css on the desktop, too)

Shouldn’t this be an easy task to replace the V in an MVC application? The problem lays in the detail. E.g. do we need the full GORM functionality on the client side (‘remote GORM’)?

The cayenne framework (a nice hibernate alternative) supports the so called remote object persistence which would be great for this kind of application. They use the hessian library to communicate over HTTP from the client ‘over’ the server to the database. So, the db-programming-style on the client is nearly identical to that on the server!

So, do we need Person.findByXY and all the other, useful methods on the client? I fear tweaking hibernate is necessary but maybe with some grooviness we could avoid this!?

Another simpler approach would be to use the already available services of Grails for the client side. With Xml (Un-)Marshalling or SOAP like it was done before? But hmmh, I prefer the cayenne way … its groovier!

So, what do we need for our 3 tier pure Groovy solution?

We’ll need Grails!

To be a bit more specific: we would actually only need the GORM plugin (and Spring) from the Grails project for the server to communicate to the DB and manage the migrations.

We’ll need Griffon!

We need the full Griffon stack for the client. And if we only use GORM from Grails we will use Griffon also on the server side, I guess.

So either GORM+Griffon+Griffon (db+server+client), which would be more consistent

or GORM+Grails+Griffon which could be easier to implement at the moment.

We’ll need Spring Rich Client!

We need some nice to have packages from the Spring Rich Client project for the client side: validation, window-docking, master-details stuff, …

We’ll need the Hessian Library!

Additionally to the GORM plugin we will need the Hessian library to easily (!) communicate between the client and server. (Short explanation: Hessian library is RMI without drawbacks.) Later on we could implement a remote GORM with the help of this library (see above)! Without this functionality we won’t have fun: either we can only implement a two tier applications (client+db) or the programming is as slow as it would be with an ordinary non-groovy desktop application (via SOAP etc).

We’ll need JavaFX!

Why do we need JavaFX if we already have Groovy as the UI DSL? Marketing! That would mean a broader audience and maybe some tiny  support of Sun 😉

Another feature of JavaFX would be that designers could create good looking SwingUIs for us without knowing Java/Groovy.

XML Marshalling

TimeFinder-Planner a Primitive MigCalendar Alternative?

Yesterday I annouced a new version of TimeFinder. With that version a new and very simple component called TimeFinder Planner is included and can be easily integrated into an existing Swing or Spring RC project. It is already mavenized but I can deploy a full jar if necessary.

Of course it is not as feature reach as MigCalendar, but  you can use it as a read only calendar component in you own apps – it is Open Source (Apache License 2), small (<30KB) and has only relative few dependencies (~1MB). It supports ‘conflicting’ events, i.e. if events would be at the same time.

Look here for some screenshots in my TimeFinder application:

At the same time you can ‘zoom’ into one event simply via the “mouse over” action. And it should be able to handle any possibility of conflicts (overlapping events):

The performance should be also good even for a lot of events per week (independent from all events!). This cannot be seen in a screenshot but you can try TimeFinder and import the data of JavaOne 2009 via the ‘File’ menu item. Look here for the video explanation.

TimeFinder v4 Released – Automatic Educational Scheduling

Today the TimeFinder Team (its me ;-))
announces the availability of TimeFinder v4!

TimeFinder allows universities and schools to reduce and even avoid conflicts in the timetable! TimeFinder will improve the work of the human timetabler at the institute. A lot of work which would be done by hand to create the educational schedule could be done with TimeFinder.

TimeFinder is completely free and independent of the operating system (via Java 6). The power of TimeFinder is its algorithm. It eliminates the hard-conflicts of nearly all datasets of the International Timetabling Competition 08 in under 20 seconds on a normal laptop. And it can be applied on real data like the one from University of Bayreuth.

Pictures tells a lot more than 1000 words, so here is a video as introduction

and here are some screenshots:

The first screenshot is how editing of events works

  1. create a new event
  2. then set the name
  3. and specify the start and duration
  4. after this you can add some visitors under Event Table->Persons

edit-events

And here you see how TimeFinder optimized an instance of the International Timetabling Competition 08:

after-optimization

See some more screenshots and look again here for the video documentation.

Start TimeFinder right now via WebStart! Or download the jar which is faster!

New Features

The TimeFinder Team worked hard to add the following features in this version for you:

  1. Events with any duration are now possible – without performance losings! (before only duration=1 was possible)
  2. A more robust and lightweight Swing component the TimeFinderPlanner to display the schedule/timetable of all locations and persons was implemented and replaces the JavaFX component hassle. This component is small (<30KB) and but has some dependencies (1MB). It has the same purpose as MigCalendar, but is of course not as powerful as this.
  3. Import of text files (tab separated, comma separated data). XML was already supported in previous versions
  4. Auto-import for the last imported file
  5. Cloning entities is now possible
  6. Anonymize data, so that institutes could give away its data for performance-tests and other research projects.
  7. Import of the data for University of Bayreuth (Germany) and the possibility to optimize this data set with >1500 events; >100 locations; >600 resources (persons/course of studies) is now possible and shows how other institutes could use its existing data with TimeFinder.
  8. Removed a lot of deprecated classes and removed unused dependencies (now ~11MB)
  9. Now the English TimeFinder is fully translated into German too. Translation is now simplified with a small tool.
  10. A new maven module called algo was created (~3MB), to reduce coupling of the algorithm to the GUI. Now it is theoretically possible to deploy the algorithm without the spring dependency e.g. to an optimization server.

Support

No software is complete or bug-free, and so is TimeFinder which is beta software at the moment. You are free to support TimeFinder with your constructive critique, blog posts or even money if you like to make it better. Feel free to contact me or raise an issue if you find a bug.

Check the documentation or watch an introductive video to get an overview. Keep in mind that updating documentation is still work in progress.

You can win

If you know some Java and like coding GUIs, databases or algorithms you can contact me and win experiences via joining the project!

Especially the calendar component TimeFinderPlanner could be alluring for people with Java2d experiences or interests in this area.

Thanks!

This application wouldn’t be the same without the following nice open source projects:

… and last but not least thanks to NetBeans – the only IDE you need
and Yourkit profiler, which offers open source projects a free license!

TimeFinder – Powerful Optimization Algorithm, RIA and more

TimeFinder is an Open Source Timetable Optimizer for universities and schools, which uses the Spring Rich Client project to create an easy to use application with a nice user interface, a database and … more bla bla …

ok, it is a bit dingy headline and a more dingy introduction, but I would like to invite you to test the latest development version v4 of TimeFinder now! And without such a headline you woudn’t have read this. And I feel that I would like to release TimeFinder in the next weeks, so I need some beta testers. Go here to see some screenshots.

Get the dev version of TimeFinder here, double click the jar (optionally read the documentation for v1) and tell me:

  1. If you understand the purpose of TimeFinder from the website
  2. If you understand the user interface and how you can insert data
  3. If you find a bug
  4. If you need other features

Any feedback is welcome! Please contact me at peathal AT yahoo |dot| de, post an email to the mailing list or simply leave a comment here.

VL Docking and other window docking managers for Java

Maybe you already know it;

there are several docking managers and since April 2009 (3.0) you can include VL Docking for free even in commercial applications, because its LGPL!

The good thing about VL Docking is (and of MyDoggy by the way …)  that it is well integrated into the Spring RC project.

More information about VL Docking

All Java docking managers

(look here for an old list)

Inactive projects

  • SwingDocking seems to me fully functional and fast; Apache license 2
  • XUI will be further developed here?; MPL; 1.6 MB (XUI-jdk15.zip)
  • JDocking CDDL; 1.3 MB (v0.8.zip) the docking part of netbeans
  • FlexDock MIT; only jar’s: 0.5 MB
  • JRichClient GPL; derivation of flexdock

Please let me know if you know other libraries which support ‘window docking’.

Java Application Frameworks (not only client side …)

In an old post I listed all Java libraries,where only two application frameworks were listed.

Today it is time to list some client side Java application frameworks, because I discovered some new ones while reading the W-JAX announcement. Some of the listed frameworks will make developing application with DB easier. And some of them are real 3 tier architectured frameworks. Some of them even allow you to develop RIA’s and web frameworks at the same time.

Here is now the list of open source Java application frameworks especially for the desktop. Feel free to add some more (via comment):

  1. NetBeans RC Platform, my IDE is build on this 😉
  2. Eclipse RC Platform, has an interesting ‘subproject’ called Riena
  3. Spring RC, at the moment my favourite used in TimeFinder
  4. AppFramework which won’t be in JDK 7, but has a lot of derivatives
    1. Swing application framework fork
    2. Guice Utilities & Tools Set
    3. Better Swing AppFramework
    4. with OSGi
  5. JVx, looks very nice! Makes fast development of Swing applications possible (with db support)
  6. OpenXDev a framework which could be used as a base for your next Swing project
  7. Genuine is a client framework for Java Swing applications for which it provides basic infrastructure
  8. Genesis with Swing and SWT binding; Easy, transparent remoting; etc
  9. GWT (although only intented for javascript widgets it could theoretically being used as a rich client running in the jvm)
  10. OpenSwing Framework is an open-source suite of advanced graphics components based on Swing toolkit
  11. Leonardi Framework
  12. Jspresso is a framework for building rich internet applications
  13. Viewa framework
  14. XUI is a Java and XML RIA platform
  15. Swing + XUL = SwiXAT looks interesting but dead, the same for the next:
  16. Swing + XML = SwiXml a small GUI generating engine.
  17. buoy built on top of Swing. Xml serialization of UI possible
  18. But why xml if you have groovy: Griffon 😉
    Now, a nice approach would be to send/receive groovy code and build the clients’ GUI on fly… this would be like replacing the browser+html+javascript system with rock solid JVM+Groovy 😉
    Another Comment from AndresAn addtional tidbit about Griffon, it can be seen as a polyglot programming desktop/RIA framework as it supports 5 JVM languages at the moment: Java, Groovy, Scala, Clojure and JavaFX. It also lets you embed JavaFX components on Swing containers.
  19. JMatter is a software framework for constructing workgroup business applications based on the Naked Objects Architectural Pattern.
  20. Metawidget is a ‘User Interface widget’ that populates itself, at runtime, with UI components to match the properties of your business objects.
  21. Pivot a platform for building rich internet applications in Java

Especially JVx with a webstart demo looks very promising! It even feels better and faster than an ordinary flash application!

Commercial:

  1. Aviantes-Business-Application-Framework
  2. Jide Desktop Application Framework
  3. Jazz

I listed only frameworks which help developers to easier build client side desktop application and only if they run in the JVM. So frameworks where the client is browser-based (aka web frameworks) are not listed here.

For a good list of J2EE frameworks go to java-source.net or to wikipedia. (Or here, or there, or even here)

Update: For additional comments look at dzone

Plugable Swing – A Hello World OSGi Example

There are a lot of OSGi applications out, a minority is for the client side. Here I will list some “on swing”:

  1. Apache-Felix-Demo
  2. Swing-Application-on-OSGi from Daniel Rohe
  3. Dynamic Swing OSGi Demo from Kai Tödter
  4. Examples from the OSGi in Action book
  5. Sip-Communicator
  6. Daro

Today I tried the same and had luck. It was very fast (~1h) to get all working what I wanted, because I shamelessly stole the code from the example of Apache Felix. It is even more easier than this example but should have the same effect: it shows how one could use OSGi even for a Swing application.

There is a host application called Swing On OSGi – Host with one JMenu which does not change (static) and one (dynamic) JMenu which could be changed from the available plugins (here only one: Swing On OSGi – PluginTest). The source code (Apache License 2) can be checkout via

svn checkout https://timefinder.svn.sourceforge.net/svnroot/timefinder/branches/swingosgi swingosgi

… you will need maven. After ‘mvn install’ for both projects you will only need to start the host application via your IDE or via

java -jar target/host-1.0.0.jar

Then if you see the “dynamic menu” with one menu entry (which was added from the plugin) all is fine:

helloOSGiWorld

If you have problems while building this send me an email or comment here.

I got the plugins even working in my timetabling application TimeFinder which uses the client-side framework called Spring Rich Client. The first plugin for Spring Rich Client – read more.

Swing Talks (video and slides available)

Maybe you already know that at parleys they put some nice presentations.

Especially the talk Spring is Swinging from Jo Wyns was impressive to me, where he talks about the Spring Rich Client project.

The presentation seems to be an old one (where is the date??), but it is even today a hot theme: rich desktop applications with database access (or internet connection). He concludes his talk with a tip, when to stop or when is is a bit too far. I think with too far he means projects like the metaframeworks I talked about earlier. And maybe this is true: in commercial applications nearly always you will need to customize views etc. then the simple “annotated domain object”-approach will only work for the first rapid prototype.

Have fun with this talk and with the related talks (here or here).

A Pagination-enabled List in Swing with Hessian

In an ealier post I documented how to set up a maven project to use port 80 for client-server-communication in a Java Swing project.

Today I want to show how you could implement a list which shows ‘all’ objects of one entity. It is common that there exists thousand or more objects for one entity in a database, so pagination is required. I know that JList and JTable could handle very large result sets easily, but the bandwith would be the limitating factor and loading all the objects into memory is often not required (and not good …).

I will use the simplest Swing solution with some pagination buttons, although it would be a lot nicer to have the pagination with a custom vertical JScrollBar-implementation which loads the objects while scrolling (‘on demand’). But this will be either a task for my readers or for myself at a later time. First we can take a look at the resulting (primitive) GUI:

paginationlist

The interface for the data access object was quickly created:

public interface RemoteDao<T> {
   List<T> getAll(int index, int items, String query);
   int count(String query);
}

… the implementation, too (but for this see the source in the provided project). You can simply replace the existing fake-implementation with a RemoteHibernateDao or sth. like this, if you like.

The communication follows this picture:

dao-hessian

To try this maven project: start PaginationServlet under the paginationlist package and then the PaginationClient. The Swing gui should pop up and you could hit enter after a search string like ‘person’ or ’18’ in the textfield at the top. Now try to paginate through the results with the provided buttons at the bottom.

The final goal for me (at a later time) will be to replace the left ‘Available’-JList in a ShuttleList (from Spring rich client project) with my PaginationList. For you information: with a normal ShuttleList one could drop one or more items from ‘available’ list to ‘choosen’ with the buttons in the middle (they have nothing to do with pagination!). Here a normal shuttle list is shown:

shuttlelist-orig

So, now have fun with my small Swing example and feel free to provide feedback or ask questions if you need help while maven or sth. else!