I needed a good calendar widget, so I took a look around. There are quite a few calendar widgets out there for Eclipse, but none of them did quite what I wanted. I looked at modifying one to better suit my requirements, but it turned out to be a lot harder than I had hoped. Naturally, I saw this as an opportunity to build my own.
I have to admit that there’s another reason for building my own: I really wanted to. I was in a mood to build a widget and this seemed as good a thing to build as any. I built the widget using standard SWT stuff. The initial implementation is derived from code contributed by Bahadir Yagan in bug 19945, however little of the original implementation remains.
Here’s what it looks like:
The calendar can be used either directly or as a drop-down. I spent a lot of time trying to get it work right with the keyboard; so the tab and arrow keys work the way that I think you’d expect. I’m sure that there’s more that it needs to do, and so I welcome your feedback. At very least, I need to do a little consolidation and commenting; while I like to think that my code is self documenting, I’m pretty sure that it’s not…
If you’re interested in taking a look, you can access it from here:
Main class included that demonstrates the operation of the widget.
One thing that I’ve been thinking about lately is ICU support. The current implementation doesn’t use ICU4J. Instead, I just used the standard Java classes to figure out how to build the calendar. My next step is to convert it over to use ICU4J and try to sort out how to handle arbitrary calendars (and there does seem to be a lot of them). The big challenge for me is that I know very little about other calendars. Okay… I know nothing about other calendars. If you’re curious to see what I’m talking about, browse the hierarchy for
com.ibm.icu.util.Calendar to see all the different subclasses (each supporting a different calendar).
Assuming that I’m smart enough to sort this out (Maria is helping, so there’s a good chance that something good will come from this) I’ll let you know how it works out.