Re: [Microba-controls] commitEdit of a null Date value
Brought to you by:
michaelbaranov
From: Michael B. <mic...@gm...> - 2007-10-16 06:15:24
|
Chris, Thanks for the path! But can you describe the effect of the change from the point of view of a user? What was wrong (but now OK)? Can you please send me a regular machine-processable patch for BasicDatePicketUI against the latest sources (so I ca patch a local copy free of mistakes)? Thanks for using Microba and contributing! Chris Murphy wrote: > Hi Michael, > > I found something for your consideration, which has required changing > the microba source as configuration was not possible. The problem is > that JFormattedTextField does not properly support the concept of a null > date. A null date can't be committed (commitEdit()) to a > JFormattedTextField. As you can see from the code Sun's bug database > offers a workaround that I've implemented on your code. This code is > from changes I've made to BasicDatePickerUI: > > private DefaultFormatterFactory createFormatterFactory() { > return new DefaultFormatterFactory(new NullCapableDateFormatter(peer > .getDateFormat())); > } > > > /** > * To do this enhancement: > * http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4745048 > */ > public class NullCapableDateFormatter extends DateFormatter > { > public NullCapableDateFormatter(DateFormat dateFormat) > { > super( dateFormat); > } > > public Object stringToValue(String string) > throws ParseException > { > if(string == null || string.length() == 0) > { > return null; > } > return super.stringToValue(string); > } > } > > > thanks - Chris > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > Microba-controls mailing list > Mic...@li... > https://lists.sourceforge.net/lists/listinfo/microba-controls > > -- Michael Baranov |