Scott,
You have to do next :
a) define property editor for date field in spring xml file , for example
Code:
<bean id="propertyEditorRegistry"
class="org.springframework.richclient.application.support.DefaultPropertyEditorRegistry">
<property name="propertyEditors">
<list>
<props>
<prop key="objectClass">java.lang.Long</prop>
<prop key="propertyEditorClass">yu.co.snpe.dbtable.propertyeditor.DefaultLongEditor</prop>
</props>
<props>
<prop key="objectClass">java.lang.Integer</prop>
<prop key="propertyEditorClass">yu.co.snpe.dbtable.propertyeditor.DefaultIntegerEditor</prop>
</props>
<props>
<prop key="objectClass">java.util.Date</prop>
<prop key="propertyEditorClass">yu.co.snpe.dbtable.propertyeditor.DefaultDateEditor</prop>
</props>
<props>
<prop key="objectClass">java.math.BigDecimal</prop>
<prop key="propertyEditorClass">yu.co.snpe.dbtable.propertyeditor.DefaultBigDecimalEditor</prop>
</props>
</list>
</property>
</bean>
DefaultDateEditor is like this :
Code:
* Copyright 2002-2004 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package yu.co.snpe.dbtable.propertyeditor;
import java.text.SimpleDateFormat;
import org.springframework.beans.propertyeditors.CustomDateEditor;
/**
* @author snpe
*
*/
public class DefaultDateEditor extends CustomDateEditor {
public DefaultDateEditor(String dateFormat) {
super(new SimpleDateFormat(dateFormat), true);
}
public DefaultDateEditor() {
super(new SimpleDateFormat("dd.MM.yyyy"), true);
}
}
Now bind date property form bean to simple JTextField :
Code:
JTExtField textField = new JTextField();
swingModel.bind(textField,"dat");
spring rcp do standard property editor validation for date - I can set null and invalid value
I need invalid value in field, because I have search/filter with sql expression, for example
__-MAR-200_ for search mont Mart in year 2000-2009
I create calendar compnent now with :
Code:
JTextFieldDateChooser datComp = new JTextFieldDateChooser(textField);
I add only datComp to GUI, not textField (textField is part of datComp)
You have to disable button in datComp when disable textField, too
regards