@Override public Property getPropertyDataSource() { return field.getPropertyDataSource(); }
/** * Returns the property data source for the field. * * Note that this method for {@link FieldWrapper} always returns the * property converter, or the property data source of the wrapped field if * there is no converter. */ public Property getPropertyDataSource() { if (converter != null) { return converter; } else { return wrappedField.getPropertyDataSource(); } }
/** * Create a custom field wrapping a {@link Field} with a user-defined * {@link PropertyConverter}. * * Subclass constructors calling this constructor must create and set the * layout. * * When this constructor is used, the methods {@link #format(PC)} and * {@link #parse(Object)} are never called. * * @param wrappedField * @param propertyConverter * or null to bypass the use of a property converter * @param propertyType */ protected FieldWrapper(Field wrappedField, PropertyConverter<PC, ? extends Object> converter, Class<? extends PC> propertyType) { this.wrappedField = wrappedField; this.converter = converter; this.propertyType = propertyType; if (converter != null) { converter.setPropertyDataSource(wrappedField .getPropertyDataSource()); wrappedField.setPropertyDataSource(converter); property = converter; } else { property = wrappedField; } }
/** * Create a custom field wrapping a {@link Field}. * * Subclass constructors calling this constructor must create and set the * layout. * * When this constructor is used, value conversions are delegated to the * methods {@link #format(PC)} and {@link #parse(Object)}. * * @param wrappedField * @param propertyType */ protected FieldWrapper(Field wrappedField, Class<? extends PC> propertyType) { this.wrappedField = wrappedField; this.propertyType = propertyType; converter = new DefaultPropertyConverter(propertyType); converter.setPropertyDataSource(wrappedField.getPropertyDataSource()); wrappedField.setPropertyDataSource(converter); property = converter; }