modelFields.put( FUZZY_DATE, new FieldController( photos ) {
protected void setModelValue( Object model ) {
log.debug( "FUZZY_DATE - setModeValue ({}) " );
PhotoInfo obj = (PhotoInfo) model;
FuzzyDate fd = (FuzzyDate) value;
if ( fd != null ) {
obj.setShootTime( fd.getDate() );
obj.setTimeAccuracy( fd.getAccuracy() );
} else {
obj.setShootTime( null );
obj.setTimeAccuracy( 0 );
}
}
protected Object getModelValue( Object model ) {
log.debug( "FUZZY_DATE - getModeValue ({}) " );
PhotoInfo obj = (PhotoInfo) model;
Date date = obj.getShootTime();
double accuracy = obj.getTimeAccuracy();
return new FuzzyDate( date, accuracy );
}
protected void updateView( Object view ) {
log.debug( "FUZZY_DATE - updateView ({}) " );
PhotoInfoView obj = (PhotoInfoView) view;
obj.setFuzzyDate( (FuzzyDate) value );