ULCDateChooser

Purpose

Simple date picker widget (ULCDateChooser) to browse the calendar and select a date. The date is picked through an event listener. NEW: Available for ULC version 6.1

Features

  • Realized as extension. The main advantage is that there is no server round-trip for each interaction with the widget, such as month navigation, label updates, subpanel refresh, etc. All needed information can be retrieved on the client.
  • Localized. The local default is the client local, but the localization, as well as the cancel button caption, can be customized through the constructor. The localization considers not only the language, but also "cultural" (...) differences (for some people communities the week begins on Monday, for some others on Sunday...).
  • Date selection catch through a listener (IDateSelectedListener). The list of listeners is notified as soon as a new date has been selected from the widget.
  • A state is kept with the last selected date. This means that the widget can be queried at any time to get the last selected date.
  • Preview of the exact selected date on the month navigation panel (this can be switched off).
  • Some customization elements, like element dimensions, colors, and others (see the get/set API methods).
  • Opportunity to specify lower and upper bounds, using the API methods "ULCDateChooser.setFromDate(...)" and "ULCDateChooser.setToDate(...)".
datechooser

How to use it

A sample usage of the ULCDateChooser extension is provided in com.canoo.ulc.community.datechooser.application.ULCDateChooserSample.

A ULCDateChooser is simply a button. When clicked a dialog box is opened and the user can select a date. When a date is selected a list of previously subscribed IDateSelectedListener elements is notified.

...

ULCDateChooser dateChooser = new ULCDateChooser();

dateChooser.addDateSelectedListener(new IDateSelectedListener() { public void dateChosen(DateSelectedEvent event) { System.out.println("selection performed...." + event.getDate()); } });

...

How it is implemented

ULCDateChooser is implemented as extension, based on the class DateChooser. It is basically a button that opens a modal dialog. Listeners of type IDateSelectedListener can be added to ULCDateChooser. When a new date has been selected the listeners are notified through the call of the method dateChosen(). From the received DateSelectedEvent element, you get access to the selected date.

Graphic parameters are managed within a separate object (GraphicMemento). This object is managed and changed directly by DateChooser, but its internal values are needed by PickDatePanel, the class implementing the dialog.

Resources