Class PasswordProperty
IMPORTANT NOTE: This is an unusual property implementation in one key respect - the current value of this property (that is, the actual password), will NOT be saved to properties by default. This is for security reasons, as the properties file is not encrypted, and we generally don't want to have passwords stored in plain text. You can override this with the setPasswordSavedToProps() method, if you are okay with storing passwords in your properties file. Otherwise, this property will only remember basic things about itself (number of columns, whether or not to allow blank values, and so on).
Suggestion: add a checkbox in your UI to allow the user to make this choice. The checked state of that checkbox should be handed to setPasswordSavedToProps() before properties are saved.
- Since:
- swing-extras 2.5
- Author:
- scorbo2
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intprotected booleanprotected booleanprotected StringFields 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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected FormFieldDescendant classes must implement this method to generate a FormField associated with this property.intbooleanbooleanvoidloadFromFormField(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.setAllowBlank(boolean allow) setColumns(int cols) setPassword(String password) setPasswordSavedToProps(boolean isSaved) 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, isAllowsUserInput, isEnabled, isExposed, isInitiallyEditable, isInitiallyVisible, removeAllFormFieldChangeListeners, removeAllFormFieldGenerationListeners, removeFormFieldChangeListener, removeFormFieldGenerationListener, setAllExtraAttributes, setEnabled, setExposed, setExtraAttribute, setHelpText, setInitiallyEditable, setInitiallyVisible, setPropertyLabel
-
Field Details
-
password
-
isAllowBlank
protected boolean isAllowBlank -
columns
protected int columns -
isPasswordSavedToProps
protected boolean isPasswordSavedToProps
-
-
Constructor Details
-
PasswordProperty
-
-
Method Details
-
setPassword
-
getPassword
-
setAllowBlank
-
isAllowBlank
public boolean isAllowBlank() -
setColumns
-
getColumns
public int getColumns() -
setPasswordSavedToProps
-
isPasswordSavedToProps
public boolean isPasswordSavedToProps() -
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.
-