JIDE Support wrote:Based on your post, I am thinking adding a DateSpinner at the bottom of DateChooserPanel (the popup for DateComboBox). Then in DateComboBox's text display area, we display time after the date. we Is it good enough?
Thanks,
I doubt we could release the code, for reasons I can't go into, but I'll add some comments that would have helped me:
We went the extra mile and it was a PITA. We actually used a ComboBox with a spinner as an editor, giving you both a spinner and dropdown of times (including time differential from a start time, e.g. if the start time was 2:15, the end combobox list would show "2:30 (15 minutes)").
(Preface: we used sun's JSpinner and not Jide's DateSpinner, partially for historical reasons other reasons below)
1) you can set timezone on the dateformat in hte editor used in the spinner
2) the event path from the timeComboBox ended up stripping out the date more often than not: the JFormattedTextField in the spinner would call commitEdit(), causing the time to be formatted (e.g. "10:23") resulting in a Date object with the value "Jan 1 1970, 10:23". If this was pushed into your Value then your DateComboBox would pop to 1970. Extremely unpleasant.
It also made it hard to have the time Spinner roll the day over.
IIRC, you basically had to observe the state of the Value and the time String, and depending on whether they were the same or not, you could tell if the user typed it, used the spinner, or used the combobox, and plug the date back into the component as appropriate.
I did look at using the DateSpinner, but quickly backed out of it. I don't recall offhand why, but I suspect it is because I wanted the spinner minute increment to be 5, not one, and was concerned that if I replaced the DateSpinner's model with a custom one I woudl lose behaviour. It could also be that I needed to subclass the editor in order to rewrite the date into the Value before the Spinners changeEvent was fired.
---------------------------------------
start: DDDDDspCB TTTTTspCB
end: DDDDDspCB TTTTTspCB
---------------------------------------
where
DDDDDD= Textfield with formatted dates
sp = spinner buttons
CB = combobox, calendar icon for dates, clock icon for times
TTTTT = Textfield for formatted times
You eventually end up with 6 controllers for a single value, and that's not including datamodel binding, nor linking to a startmodel to an endmodel.
There was definitely a point when I thought it would be easier to re-write JSpinner to not use ChangeEvents, but be more specific about the changes, i.e. a button-based increment or decrement.
This is from memory, one that feels a lot like a bad hangover. good luck!
(j. longman using e. castonguay's account)