events - jfxtras - CalendarPicker getDisplayedCalendar in EventFilter wrong -
i have calendarpicker eventfilter. in eventfilter want displayedcalendar calendarpicker.getdisplayedcalendar(), wrong date. last date before calendarpicker update displayedcalendar.
it seems eventfilter executed before standard events of calendarpicker.
and cannot use eventhandler because event consumed calendarpicker.
for example:
- see march 2015 in calendarpicker.
- change month april 2015
- in calendarpiker.addeventfilter() calendarpicker.getdisplayedcalendar() "2015-03-01"
- calendarpicker shows april 2015
how can execute standard events before eventfilter?
here code:
calendarpicker.addeventfilter(mouseevent.mouse_clicked, new eventhandler<mouseevent>() { @override public void handle(mouseevent event) { if (event.getbutton().equals(mousebutton.primary)) { calendar cal = calendarpicker.getcalendar(); if (cal != null) { selecteddate = cal.gettime(); log.debug(string.format("(selecteddate): %s" , selecteddate)); log.debug(string.format("(displayed): %s" , calendarpicker.getdisplayedcalendar().gettime())); } } } });
if pick date in calendarpicker, o.k.
selecteddate picked date , displayed calendar 1th day of displayed month.
if use spinner change month or year, selecteddate not change (i think correct because not select 1 date), displayed date 1th date of month before changed month (e.g. change april march => 01.04.2015 instead of 01.03.2015).
i understand want. however, events fired in order, , there no rule mandating order should be. in case there nothing mandating mouse clicked event must fired after properties have changed.
are not listening wrong event? if register listener on displayedcalendarproperty() informed when displayed date changes, no matter triggered (a mouse click, keyboard navigation -listspinner supports that-, or programatically).
Comments
Post a Comment