DateSpinner setStart setEnd swing bug

This is the forum for JIDE Common Layer which is open sourced at https://github.com/jidesoft/jide-oss. Please note, JIDE technical support doesn't monitor this forum as often as other forums. Please consider subscribe for technical support for JIDE Common Layer so that you can use customer only forum to get a timely response.

Moderator: JIDE Support

Forum rules
Community driven forum for open source JIDE Common Layer. JIDE technical support doesn't monitor this forum as often as other forums. If you only use JIDE Common Layer, please consider subscribing for technical support for JIDE Common Layer so that you can use customer only forum to get a timely response.

DateSpinner setStart setEnd swing bug

Postby kcieniuch » Mon Feb 02, 2009 9:27 am

Hi,

I have problems with DateSpinner that have date bounds set using setStart setEnd methods of SpinnerDateModel
here is code
Code: Select all
     DateSpinner  timeSpinner = new DateSpinner("HH:mm:ss");
     timeSpinner.setAllowsInvalid(true);
     ((SpinnerDateModel)timeSpinner.getModel()).setStart(new Date());


with this code the spinner doesn't work anymore I can't use uo/down buttons to spinn dates nor set values by typing into text field
I dig into this problem and it turn outs that this is probably Swing bug here is code
Code: Select all
        Calendar now = Calendar.getInstance();

        Calendar start = Calendar.getInstance();
        start.set(Calendar.HOUR_OF_DAY, now.get(Calendar.HOUR_OF_DAY));
        start.set(Calendar.MINUTE, now.get(Calendar.MINUTE));
        start.set(Calendar.SECOND, now.get(Calendar.SECOND));
        start.set(Calendar.MILLISECOND, now.get(Calendar.MILLISECOND));
        start.add(Calendar.MINUTE, -10);
       
        Calendar end = Calendar.getInstance();
        end.set(Calendar.HOUR_OF_DAY, now.get(Calendar.HOUR_OF_DAY));
        end.set(Calendar.MINUTE, now.get(Calendar.MINUTE));
        end.set(Calendar.SECOND, now.get(Calendar.SECOND));
        end.set(Calendar.MILLISECOND, now.get(Calendar.MILLISECOND));
        end.add(Calendar.MINUTE, 10);
       
        JSpinner spinner = new JSpinner(new SpinnerDateModel(now.getTime(),start.getTime(),end.getTime(),Calendar.MINUTE));
       
        //comment those two lines and it works
        JSpinner.DateEditor de = new JSpinner.DateEditor(spinner, "HH:mm:ss.SSS");
        spinner.setEditor(de);   



if in above code I use default DateEditor with default date format it works correctly but if I set DateEditor calling spinner.setEditor(de) I can't change date value anymore
Do you know any workaround for this ?

Thx
Chris
kcieniuch
 
Posts: 111
Joined: Tue Jul 01, 2008 6:07 am
Location: Ireland

Re: DateSpinner setStart setEnd swing bug

Postby JIDE Support » Mon Feb 02, 2009 12:23 pm

To be frank, I am not sure. DateSpinner is a simple wrapper around JSpinner. So I am not surprise to hear that this is a Swing bug. I debugged and thought it is a problem in InternationalFormatter#isValidValue method but you may consider posting this to Swing forums or submit the bug to Sun (sorry, we don't provide Swing support).

Thanks,
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37263
Joined: Sun Sep 14, 2003 10:49 am

Re: DateSpinner setStart setEnd swing bug

Postby kcieniuch » Tue Feb 03, 2009 3:05 am

Thanks for info no need to sorry I know you don't provide swing support I just was asking in hope that maybe you came across this problem and already had cleaver workaround :-)
I'll have a look at InternationalFormatter#isValidValue thanks for that tip

thx
Chris
kcieniuch
 
Posts: 111
Joined: Tue Jul 01, 2008 6:07 am
Location: Ireland


Return to JIDE Common Layer Open Source Project Discussion (Community Driven)

Who is online

Users browsing this forum: No registered users and 12 guests