DateSpinner 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 bug?

Postby ericy » Mon Apr 12, 2010 7:51 am

Hi,
I am using the JIDE DateSpinner control to display time. The DateSpinner public interface specifies a method called setTimeZone() for setting the time zone and a method called getTimeZone() for getting it.

After creating my DateSpinner control I call the setTimeZone() to indicate in what time zone the time must be displayed. But it seems DateSpinner does not seem to take into account what ever time zone value I pass in. In fact getTimeZone() always return the default system time zone.

Is this a bug?

Please help!!

Eric.
ericy
 
Posts: 3
Joined: Tue Nov 24, 2009 1:54 am

Re: DateSpinner bug?

Postby JIDE Support » Mon Apr 12, 2010 9:51 am

I could not notice the issue you mentioned. Attached is the test case I tested against 2.8.6. Would you please give it a try?

Thanks,
Attachments
DateSpinnerDemo.java
(1.87 KiB) Downloaded 1485 times
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am

Re: DateSpinner bug?

Postby ericy » Tue Apr 13, 2010 12:30 am

Please find attached a modified version of your DateSpinnerDemo illustrating the problem. Please read the embedded comments for more info.
Attachments
DateSpinnerDemo.java
(2.3 KiB) Downloaded 1513 times
ericy
 
Posts: 3
Joined: Tue Nov 24, 2009 1:54 am

Re: DateSpinner bug?

Postby JIDE Support » Tue Apr 13, 2010 4:39 pm

Are you expecting the time to be changed after the time zone is set? I'm afraid you have to do it on your end. You could invoke ((SpinnerDateModel) getModel()).setValue(newValue) to achieve your goal. The Calendar class has the similar design. You would get the same value on invoking Calendar#getTime() even after you set a different time zone.

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

Re: DateSpinner bug?

Postby ericy » Wed Apr 14, 2010 12:23 am

You are right what I want the DateSpinner to do is to display the time in whatever time zone I specify.
I don't think calling getModel().setValue() is going to make any difference, as I still would be passing in a Date object which represents an absolute time.
If this is not possible what then is the point of having the setTimeZone() method?
ericy
 
Posts: 3
Joined: Tue Nov 24, 2009 1:54 am

Re: DateSpinner bug?

Postby JIDE Support » Wed Apr 14, 2010 10:08 am

I'm afraid there is no easy way to achieve this since DateSpinner uses SpinnerDateModel as its model and SpinnerDateModel only takes Date as its field. The solution for now is that, you have to calculate the actual time by your Calendar.class then create a new Date() to demonstrate the new time. After the calculation, you would be able to set the model's value and let it show the correct time.

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


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

Who is online

Users browsing this forum: Baidu [Spider] and 8 guests