| | entry( KEY_DOC_DATE, asStringProperty( getDate() ) ), |
| | |
| | + entry( KEY_EDITOR_AUTOSAVE, asIntegerProperty( 30 ) ), |
| | + |
| | entry( KEY_R_SCRIPT, asStringProperty( "" ) ), |
| | entry( KEY_R_DIR, asFileProperty( USER_DIRECTORY ) ), |
 |
| | private StringProperty asStringProperty( final String defaultValue ) { |
| | return new SimpleStringProperty( defaultValue ); |
| | + } |
| | + |
| | + @SuppressWarnings( "SameParameterValue" ) |
| | + private IntegerProperty asIntegerProperty( final int defaultValue ) { |
| | + return new SimpleIntegerProperty( defaultValue ); |
| | } |
| | |
 |
| | LocaleProperty.class, LocaleProperty::parseLocale, |
| | SimpleBooleanProperty.class, Boolean::parseBoolean, |
| | + SimpleIntegerProperty.class, Integer::parseInt, |
| | SimpleDoubleProperty.class, Double::parseDouble, |
| | SimpleFloatProperty.class, Float::parseFloat, |
 |
| | assert key != null; |
| | return (Boolean) valuesProperty( key ).getValue(); |
| | + } |
| | + |
| | + /** |
| | + * Returns the {@link Integer} preference value associated with the given |
| | + * {@link Key}. The caller must be sure that the given {@link Key} is |
| | + * associated with a value that matches the return type. |
| | + * |
| | + * @param key The {@link Key} associated with a preference value. |
| | + * @return The value associated with the given {@link Key}. |
| | + */ |
| | + public int toInteger( final Key key ) { |
| | + assert key != null; |
| | + return (Integer) valuesProperty( key ).getValue(); |
| | } |
| | |
 |
| | assert ended != null; |
| | return new Tokens( stringProperty( began ), stringProperty( ended ) ); |
| | + } |
| | + |
| | + @SuppressWarnings( "SameParameterValue" ) |
| | + public IntegerProperty integerProperty( final Key key ) { |
| | + assert key != null; |
| | + return valuesProperty( key ); |
| | } |
| | |