Friday, May 01, 2009

DesignGridLayout: where do we stand?

It's been a long time I haven't blogged on DesignGridLayout. Several events have concurred to this lack of communication:
  1. I have bought a brand new notebook (for those interested: that's a Sony VAIO Z)!
  2. It's taken me a long time to have DesignGridLayout tests run on both my old notebook (Windows XP) and my new one (Vista)
  3. I have plaid with Hudson on my old notebook to setup a continuous build for DesignGridLayout
Now that all that works (after a lot of pain for the second point, and thanks to the active help of Alex for quickly improving FEST "specially" for me), I can finally resume my work on the project.

Where do we stand?

Version 1.2, which I am currently working on, shall have the following features:
  1. alignment synchronization of multiple panels (all using DesignGridLayout): particularly useful to make smooth panels transitions in Tab panes and Wizards.
  2. optional consistent baselines spacing between consecutive rows (only for fixed height rows).
  3. addition of a new API to notify DesignGridLayout of special components behavior with regards to vertical resize.
For these features, I have already made a big refactoring of the source code.

Enhancement #2 above is already implemented in Subversion trunk, here are 2 screenshots comparing the same layout with and without consistent baseline spacing, respectively:

Note the consistent spacing between labels baselines for all rows but the second one (because it has variable height) and the last one (because it has an emptyRow() before it to visually separate that row from the previous one).

Without consistent baselines spacing, all vertical gaps conform to the values provided by the installed look & feel, but due to different heights of components and different vertical gaps, the inter-row spacing doesn't look consistent and is not very eye-friendly (this is particularly true when observing the column of labels).

Regarding synchronization of alignments between different panels (enhancement #1 above), the following screenshots help showing what works today (excerpts from DesignGridLayout automatic tests).

The example below is a dialog with a tabbed pane, embedding two different tabs. The first 2 screenshots show both tabs, built with DesignGridLayout, without synchronization.

Please note that there are no horizontal or vertical alignments between both tabs, this is particularly noticeable when running the application and changing from one tab to the other.

Now, let's add just one line of code to the layout building code, as follows:
Synchronizer.synchronize(layout1, layout2).alignGrids().alignRows();
Then the screenshots become different (note that I have put the 2nd tab both on the right side and on the bottom of the first tab so that you can easily check alignments in both directions):

You can notice the alignment of the origins of both columns of fields, and you can also check that all rows baselines from both tabs are aligned with one another.
This example is particularly interesting due to the use of Java -default- Metal look & feel, in which different kinds of components have different heights (compare the heights of JTextField and JComboBox); other look & feels may have consistent heights for all components, which would not show the difficulty of aligning each and every row from one tab to its matching row in the other tab. I am not sure other LayoutManagers can do that, I haven't checked yet though.

Back to DesignGridLayout V1.2 schedule, I still have some work with:
  • baseline synchronization
  • new API for vertical resize behavior customization (point #3 above)
  • layout calculation optimization (avoid multiple recalculation)
For DesignGridLayout 1.2, I plan to release a beta with new features and the new API so that I have time to polish it before a release candidate. Here is the expected schedule:
  • End May: 1.2 beta 1 out, beta testing will last one month
  • End June: 1.2 rc 1 out, followed by final release after 2 weeks (or 2 weeks after latest rc if bugs are reported)
What's next?

Later, for V1.3, I foresee enhancements to non-grid rows API & functionality:
  • possibility to separate 2 components with unrelated gaps
  • smart positioning of standard buttons (OK, Cancel...) based on the runtime platform
  • make component sizes consistent across several rows (currently, sizes are consistent inside individual rows only)
It's hard to predict what a release date could be, but since I don't see too much complexity in these features (but as usual, the difficulty will be in finding the right API for them), I think it should be possible to have a first release candidate less than 2 months after final release of V1.2, around September-October.

8 comments:

  1. Question about examples.

    I am trying the designgridlayout 1.1 version. Going through and testing some of the sample code, I run into a problem with this line:

    layout.row().right().add(new JButton("Cancel")).add(new JButton("OK"));

    add() wants to take an array of JComponents, not single components when used with right(). How is this supposed to work?

    (From example 4, https://designgridlayout.dev.java.net/nonav/site/usage.html)

    ReplyDelete
  2. Hi,

    I'm not sure I understand what you're talking about.

    DesignGridLayout add() methods don't take a JComponent[] array, but JComponent... (Java5 vararg), which allows to call them with any number of JComponents (even no component at all!), separated by commas.

    Hence the example above works perfectly.

    Where exactly in DesignGridLayout did you see an add(JComponent[]) method? Maybe you've used a tool to decompile the jar and it gave you this information but you shouldn't be concerned about it: at bytecode level, JComponent... is the same as JComponent[], but javac adds its magic during class compilation.

    Cheers

    Jean-Francois

    ReplyDelete
  3. Any updates on 1.2? Or have you abandoned the project?

    ReplyDelete
  4. Hi. I know it's been a long time no activity occurred on DesignGridLayout.

    I have not abandoned the project but I have been working on a zillion other things and let the project aside for some time.

    I consider working back soon on DesignGridLayout again. However, the content of 1.2 may be changed (layout synchronization might not make it for this version).

    Besides, I may move the project to another Open Source host service, but I'm waiting to see what happens with java.net being changed to kenai infrastructure.

    Unfortunately that's all I can say for the time being. I think there should be news around April.

    Cheers, Jean-Francois

    ReplyDelete
  5. hi,

    Any update ?

    I am considering using this layout manager for a new project, but a little worried the project hasn't been updated in a year.

    ReplyDelete
  6. Yeah me too.

    Is it possible to get a feature for weightened column widths?

    Assumed you have a zip code and a city name, then i just want the city name input to grow on resize.
    Additional space for the zip code makes no sense in that case.

    Greetings

    ReplyDelete
  7. Hi,
    I am unable to found the demo jnlp of designgridlayout anymore... at :
    http://java.net/projects/designgridlayout/

    May I have a link that works please?

    Kinds Regards

    eric

    ReplyDelete
  8. Hello Eric, sorry for the delay. The migration, by Oracle, of projects from dev.java.net to the new java.net infrastructure, has not covered all "old" content, and thus the new DesignGridLayout site is left with missing content.

    Today, I have tried to fill up some of the missing content. Now the home page (WIKI) has the same content as before and has a working WebStart example.

    Some content will still be missing for some time (all the previous maven-generated web site, in particular with javadoc and tutorial). I hope I can soon rebuild it and upload it to the new site.

    Best Regards

    Jean-Fran├žois

    ReplyDelete