Package ca.corbett.extras.properties
Class ButtonProperty
java.lang.Object
ca.corbett.extras.properties.AbstractProperty
ca.corbett.extras.properties.ButtonProperty
Wraps a ButtonField, and allows you to add buttons to a FormPanel dynamically.
Note that this property stores no data! As such, the loadFromFormField method
here does nothing. This property exists solely
to allow buttons to be added to a FormPanel via the property mechanism.
You can add a FormFieldGenerationListener to this property to be notified
when the empty ButtonField is generated, and then add buttons to it as needed.
- Since:
- swing-extras 2.6
- Author:
- scorbo2
-
Field Summary
Fields inherited from class ca.corbett.extras.properties.AbstractProperty
categoryName, DEFAULT_CATEGORY, DEFAULT_PROPERTY_NAME, extraAttributes, fullyQualifiedName, helpText, isEnabled, isExposed, isInitiallyEditable, isInitiallyVisible, marginPadding, propertyLabel, propertyName, subCategoryName -
Constructor Summary
ConstructorsConstructorDescriptionButtonProperty(String fullyQualifiedName) ButtonProperty(String fullyQualifiedName, String propertyLabel) -
Method Summary
Modifier and TypeMethodDescriptionprotected FormFieldCreates and returns an empty ButtonField.intOne of the FlowLayout alignment constants: LEFT, CENTER, RIGHT, LEADING, or TRAILING.The preferred size for buttons in this ButtonField.intgetHgap()The horizontal gap between buttons.intgetVgap()The vertical gap between buttons.booleanMost properties generate FormField instances that allow user input, but we do not:voidloadFromFormField(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.setAlignment(int alignment) One of the FlowLayout alignment constants: LEFT, CENTER, RIGHT, LEADING, or TRAILING.voidsetButtonPreferredSize(Dimension buttonPreferredSize) Sets the preferred size for buttons in this ButtonField.setHgap(int hgap) The horizontal gap between buttons.setVgap(int vgap) The vertical gap between buttons.Methods inherited from class ca.corbett.extras.properties.AbstractProperty
addAllExtraAttributes, addBottomPadding, addFormFieldChangeListener, addFormFieldGenerationListener, addInnerPadding, addLeftPadding, addPadding, addRightPadding, addTopPadding, clearExtraAttribute, clearExtraAttributes, equals, fireFormFieldChangedEvent, fireFormFieldGeneratedEvent, generateFormField, generateFormField, getCategoryName, getExtraAttribute, getFullyQualifiedName, getHelpText, getMarginPadding, getPropertyLabel, getPropertyName, getSubCategoryName, hashCode, isEnabled, isExposed, isInitiallyEditable, isInitiallyVisible, removeAllFormFieldChangeListeners, removeAllFormFieldGenerationListeners, removeFormFieldChangeListener, removeFormFieldGenerationListener, setAllExtraAttributes, setEnabled, setExposed, setExtraAttribute, setHelpText, setInitiallyEditable, setInitiallyVisible, setPropertyLabel
-
Constructor Details
-
ButtonProperty
-
ButtonProperty
-
-
Method Details
-
isAllowsUserInput
public boolean isAllowsUserInput()Most properties generate FormField instances that allow user input, but we do not:- Overrides:
isAllowsUserInputin classAbstractProperty- Returns:
- false, to indicate that we are effectively read-only.
-
getAlignment
public int getAlignment()One of the FlowLayout alignment constants: LEFT, CENTER, RIGHT, LEADING, or TRAILING. -
setAlignment
One of the FlowLayout alignment constants: LEFT, CENTER, RIGHT, LEADING, or TRAILING. -
getHgap
public int getHgap()The horizontal gap between buttons. -
setHgap
The horizontal gap between buttons. -
getVgap
public int getVgap()The vertical gap between buttons. -
setVgap
The vertical gap between buttons. -
getButtonPreferredSize
The preferred size for buttons in this ButtonField. If null, buttons will use their own preferred size. -
setButtonPreferredSize
Sets the preferred size for buttons in this ButtonField. If null, buttons will use their own preferred size. -
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
Creates and returns an empty ButtonField. Add a FormFieldGenerationListener to be notified when the field is created, so you can add buttons to it as needed.- 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.
-