Tuesday, April 21, 2009

Declarative Component, Custom Popup

I have incorporated all of the quirky requirements (for my project at least) for popups into a simple to use adf declarative component. This component is available to my entire project by means of an ADF Library JAR file (see how-to). It is included as a TagLib, which makes using it as simple as drag'n'drop. I include the lib as a JSP Tag Library whereas Frank does it a little bit different in the how-to.



You can download the whole project, AdfBitsComponent.zip or, if you want to just use the component library (as shown in the screen shot above), download just the jar AdfBitsComponentLib.jar.



    Features:
  1. Can be shown from javascript or java.

  2. Will ensure that no values are left over from the last time it was displayed (has been a major issue with our project).

  3. Has Save and Cancel buttons built in that call declared actions/actionListeners.

  4. Has optional confirmation prompt when using the cancel button (it will check to see if any of the editable values have changed, and if so will prompt the user to confirm, yes/no, that they want to cancel their edits).

  5. Will also capture the x, close-icon, and perform the Cancel button's actionListener, in case anything needs to be cleaned up once the popup is dismissed.

  6. Will click the Save button when the Enter key is pressed.

  7. Will click the Cancel button when the Escape key is pressed.

  8. If the Confirmation prompt is up, then pressing Enter will cause the current yes/no button to click.

  9. If the Confirmation prompt is up, then pressing Escape will cause the Confimration prompt to dismiss, but will allow the main popup to remain.

  10. All labels are customizable, but come with defaults set.

  11. Includes a facet to allow more buttons to be added between the Save and Cancel buttons.



If these features don't match your requirements (or if they don't work like you think they should), download the project and hack away at it.