Software

EPL LICENSE


SWT/JFace Calendar Combo Widget

SWT Calendar Combo Widget SWT Calendar Combo is a combo box widget written in Java for SWT/JFace applications that opens a calendar when dropped down. The calendar is modelled after Microsoft Outlook's calendar widget and acts and behaves exactly the same (and it is also theme based). The calendar supports date ranges, limited selection and much more.

Another nice feature is that the combo is not based on CCombo (as many other custom implementations), but is instead attached to the native Combo box.

By default, the widget comes with Default implementations for everything that allows you to skin the combo according to the following:

    » Outlook 2005 - Windows XP Blue Theme
    » Outlook 2005 - Windows XP Olive Theme
    » Outlook 2005 - Windows XP Silver Theme
    » Outlook 2007 - It's basically the same as the 2005 themes

 

External Site

This widget is under the Eclipse Nebula project, which is a group of custom written widgets that are not part of the standard SWT api but perhaps aim to be so in the future. This site contains more information and also example snippets that are very useful to understanding how to use the widget. Please visit the Nebula homepage for more information.

Visit the Eclipse Nebula Homepage

 

License

The Calendar Combo is released under the EPL (Eclipse Public License). It is imperetive that you understand what this license allows you to do. If you do not know what this license entails, please read the full license here:

The EPL license

 

Download

Nightly builds for JAR's, source and API.

Download JAR's, Source, API
 
CVS Repository

 

Screenshots


Office 2005 Blue & Month Picker


Office 2005 Silver

Office 2005 Blue

Office 2005 Olive

 

Usage


As the widgets is more or less handled like your typical Combo box (with a few extra features), you should find using the widget very simple. The constructor has optional extras as well, but by default the widget can be created as if it was any other SWT Combo box. As you can tell by the screenshots, there is no custom Combo box implementation wrapped inside the Calendar Combo Widget, but instead, it is a native Combo box, so whatever OS you use it on, it should take the same appearance as the combo box of that operating system.

Normal Creation

    CalendarCombo cCombo = new CalendarCombo(parent, SWT.READ_ONLY)
    ...

Initial Dependency Example

To mimic a feature that exists in Microsoft Outlook there are some optional parameters you may pass into the constructor. One of the features is that you can pass in a CalendarCombo box as one parameter. The effect of this will be that when the combo box is dropped down, the initially shown start date is the selected date of the Calendar Combo box that is passed as a parameter. To explain this further, here's a real life example:

We have two combo boxes. One is the Start Date of a project, and one is the End Date. The End Date combo is created with passing in the Start Date combo as a parameter. The user selects "June 16" as a date on the Start Date combo, when they then open the End Date combo, "June 16" is the default date. Here is the code for this;

    CalendarCombo startCombo = new CalendarCombo(parent, SWT.READ_ONLY);
    CalendarCombo endCombo = new CalendarCombo(parent, SWT.READ_ONLY, startCombo);
    ...

 

Listening to Events

You listen to events just like you would on a normal Combo:

cCombo.addCalendarListener(new ICalendarListener() {
    public void popupClosed() {
    }

    public void dateChanged(Calendar date) {
        if (date != null)
            System.err.println(date.getTime().toString());
        else
            System.err.println("null");
    }

    public void dateRangeChanged(Calendar start, Calendar end) {
    }
});

There is also an adapter if you don't want to implement all the methods for each listener you are introducing. The adapter is called CalendarListenerAdapter.

 

Advanced

You can customize a lot of what you see, however, it is rather limited (compared to the other Widgets on this site). There are two interfaces that will be of interest to you.

    » The name in bold is the name of the interface.
    » The name inside the [brackets] is the name of the default class implementing the interface.
    » The name inside the (parenthesis) is the name of the abstract class.

ISettings [DefaultSettings] (AbstractSettings)

This interface is probably the most likely that you will be implementing on your own. Each item has an accompanying JavaDoc entry, so please see the API for more information. ISettings covers items such as spacing, text defaults, etc.


IColorManager [DefaultColorManager] (AbstractColorManager)

This interface allows you to control every color used when painting everything that's visible in the calendar popup.


As there are abstract classes at the top level, you can implement as few or as many of these methods and functions as you wish, or simply implement the interface and do them all from scratch.


Copyright Hexapixel 2006-2008 ©. All rights reserved.