Package ca.corbett.extras.properties
Class FontProperty
java.lang.Object
ca.corbett.extras.properties.AbstractProperty
ca.corbett.extras.properties.FontProperty
Represents a property field that allows storing a Font,
along with associated style and optional color attributes.
- Author:
- scorbo2
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected Colorstatic final Fontprotected Fontprotected ColorFields inherited from class ca.corbett.extras.properties.AbstractProperty
categoryName, DEFAULT_CATEGORY, DEFAULT_PROPERTY_NAME, extraAttributes, fullyQualifiedName, helpText, isEnabled, isExposed, isInitiallyEditable, isInitiallyVisible, propertyLabel, propertyName, subCategoryName -
Constructor Summary
ConstructorsConstructorDescriptionFontProperty(String name, String label) Creates a new FontProperty with all default values.FontProperty(String name, String label, Color textColor) Creates a new FontProperty with the default font and the given foreground color and a null background color.FontProperty(String name, String label, Color textColor, Color bgColor) Creates a new FontProperty with the default font and the given foreground color and the given background color.FontProperty(String name, String label, Font font) Creates a new FontProperty with the given font and null for both foreground and background colors.FontProperty(String name, String label, Font font, Color textColor) Creates a new FontProperty with the given font and the given foreground color, and null for the background color.Creates a new FontProperty with the given font and the given foreground color and the given background color. -
Method Summary
Modifier and TypeMethodDescriptionprotected FormFieldDescendant classes must implement this method to generate a FormField associated with this property.getFont()booleanvoidloadFromFormField(FormField field) Populates this Property's value(s) from the given form field, assuming the field is of the correct type.voidloadFromProps(Properties props) Loads the value(s) for this property from the given Properties instance, overwriting any current value.voidsaveToProps(Properties props) Saves the current value(s) of this property to the given Properties instance.setAllowSizeSelection(boolean allow) voidsetBgColor(Color color) setTextColor(Color color) Methods inherited from class ca.corbett.extras.properties.AbstractProperty
addAllExtraAttributes, addFormFieldChangeListener, clearExtraAttribute, clearExtraAttributes, equals, fireFormFieldChangedEvent, generateFormField, generateFormField, getCategoryName, getExtraAttribute, getFullyQualifiedName, getHelpText, getPropertyLabel, getPropertyName, getSubCategoryName, hashCode, isEnabled, isExposed, isInitiallyEditable, isInitiallyVisible, removeAllListeners, removeFormFieldChangeListener, setAllExtraAttributes, setEnabled, setExposed, setExtraAttribute, setHelpText, setInitiallyEditable, setInitiallyVisible, setPropertyLabel
-
Field Details
-
DEFAULT_FONT
-
font
-
textColor
-
bgColor
-
allowSizeSelection
protected boolean allowSizeSelection
-
-
Constructor Details
-
FontProperty
Creates a new FontProperty with all default values. This will use FontProperty.DEFAULT_FONT as the font, and will set null for both foreground and background colors.- Parameters:
name- The fully qualified field name.label- The field label.
-
FontProperty
Creates a new FontProperty with the given font and null for both foreground and background colors.- Parameters:
name- The fully qualified field name.label- The field label.font- The initial font.
-
FontProperty
Creates a new FontProperty with the given font and the given foreground color, and null for the background color.- Parameters:
name- The fully qualified field name.label- The field label.font- The initial font.textColor- The foreground color.
-
FontProperty
Creates a new FontProperty with the default font and the given foreground color and a null background color. FontProperty.DEFAULT_FONT will be used for the font.- Parameters:
name- The fully qualified field name.label- The field label.textColor- The foreground color.
-
FontProperty
Creates a new FontProperty with the default font and the given foreground color and the given background color. FontProperty.DEFAULT_FONT will be used for the font.- Parameters:
name- The fully qualified field name.label- The field label.textColor- The foreground color.bgColor- The background color.
-
FontProperty
Creates a new FontProperty with the given font and the given foreground color and the given background color.- Parameters:
name- The fully qualified field name.label- The field label.font- The initial font.textColor- The foreground color.bgColor- The background color.
-
-
Method Details
-
setFont
-
getTextColor
-
getBgColor
-
setTextColor
-
setBgColor
-
getFont
-
isAllowSizeSelection
public boolean isAllowSizeSelection() -
setAllowSizeSelection
-
saveToProps
Description copied from class:AbstractPropertySaves the current value(s) of this property to the given Properties instance.- Specified by:
saveToPropsin classAbstractProperty- Parameters:
props- Any Properties instance which will receive the value(s) of this property.
-
loadFromProps
Description copied from class:AbstractPropertyLoads the value(s) for this property from the given Properties instance, overwriting any current value. The current value of this property will be used as a default value in the event that this property does not exist in the given Properties instance.- Specified by:
loadFromPropsin classAbstractProperty- Parameters:
props- Any Properties instance which contains value(s) for this property.
-
generateFormFieldImpl
Description copied from class:AbstractPropertyDescendant classes must implement this method to generate a FormField associated with this property. The generateFormField() method in this class will call this abstract method to create the FormField, which will then be augmented with our fully qualified name, read-only state, help text, and extra attributes.- Specified by:
generateFormFieldImplin classAbstractProperty- Returns:
- A FormField associated with this property.
-
loadFromFormField
Description copied from class:AbstractPropertyPopulates this Property's value(s) from the given form field, assuming the field is of the correct type.- Specified by:
loadFromFormFieldin classAbstractProperty- Parameters:
field- The FormField containing a value for this property.
-