Wednesday, April 14, 2010

DialogPanel - DialogBox Enhancement Revisit

In http://h2g2java.blessedgeek.com/2009/07/gwt-useable-closeable-scrollable.html, I had presented a skeletal to a DialogBox with a close button on its caption bar. That article explains the reason for such an effort is because the GWT architects have gone through extraordinary lengths to ensure we cannot extend the caption bar to modify its behaviour.

However the alignment of elements in the caption bar of that skeletal is simply skeletal, without CSS to align them. Therefore, I wrote an improvement that includes alignment CSS, but it is still skeletal because the background of the caption bar is transparent and that leaves it to you to filling in the background.

This improvement class DialogPanel, besides having a more presentable caption bar,
  1. uses UIBinder to define the caption bar,
  2. extends DecoratedPanel rather than extending or patching DialogBox,
  3. no longer has a ScrollPanel, because scroll feature is best left to the end-user-programmer by setWidget method.
The event handling scheme is exactly the same as in http://h2g2java.blessedgeek.com/2009/07/gwt-useable-closeable-scrollable.html, so you should refer to that article on the handling of events for DialogPanel.

The source code is found in google code repository at
  1. http://code.google.com/p/synthfuljava/source/browse/trunk/gwt/widgets/org/synthful/gwt/widgets/client/ui/DialogPanel.java and
  2. http://code.google.com/p/synthfuljava/source/browse/trunk/gwt/widgets/org/synthful/gwt/widgets/client/ui/DialogPanel-Caption.ui.xml.

My next plan is to make the DialogPanel resize-able by mouse. So, keep a lookout for its enhancement.

1 comment: