Class MetisPreferenceSet
java.lang.Object
io.github.tonywasher.joceanus.metis.preference.MetisPreferenceSet
- All Implemented Interfaces:
MetisDataItem.MetisDataObjectFormat,MetisFieldItem,OceanusEventRegistrar.OceanusEventProvider<MetisPreferenceEvent>
- Direct Known Subclasses:
MetisFieldColours.MetisColorPreferences,MoneyWiseQIFPreference.MoneyWiseQIFPreferences,MoneyWiseUKTaxAnalysis.MoneyWiseUKTaxPreferences,PrometheusBackup.PrometheusBackupPreferences,PrometheusPreferenceSet
public abstract class MetisPreferenceSet
extends Object
implements MetisFieldItem, OceanusEventRegistrar.OceanusEventProvider<MetisPreferenceEvent>
Wrapper class for java preferences.
- Author:
- Tony Washer
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBoolean preference.static classDate preference.static classMetisPreferenceSet.MetisEnumPreference<E extends Enum<E>>Enum preference.static classInteger preference.static classUnderlying preference item class.static classString preference.Nested classes/interfaces inherited from interface io.github.tonywasher.joceanus.metis.field.MetisFieldItem
MetisFieldItem.MetisFieldDef, MetisFieldItem.MetisFieldItemType, MetisFieldItem.MetisFieldSetCtl<T extends MetisFieldItem>, MetisFieldItem.MetisFieldSetDef, MetisFieldItem.MetisFieldTableItem, MetisFieldItem.MetisFieldVersionedDef -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedMetisPreferenceSet(MetisPreferenceParams pParams, OceanusBundleId pId) Constructor.protectedMetisPreferenceSet(MetisPreferenceParams pParams, String pName) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionabstract voidHook to enable preferenceSets to autoCorrect their preferences.protected booleanCheck whether a preference exists.(package private) voidDeclare preference.Define new Boolean preference.protected MetisPreferenceSet.MetisStringPreferenceDefine new Colour preference.protected MetisPreferenceSet.MetisDatePreferenceDefine new Date preference.protected MetisPreferenceSet.MetisStringPreferenceDefine new Directory preference.protected <E extends Enum<E>>
MetisPreferenceSet.MetisEnumPreference<E> defineEnumPreference(MetisPreferenceKey pKey, Class<E> pClazz) Define new Enum preference.protected MetisPreferenceSet.MetisStringPreferenceDefine new File preference.Define new Integer preference.protected voiddefinePreference(MetisPreferenceSet.MetisPreferenceItem pPreference) Define a preference for the node.protected abstract voidHook to enable preferenceSets to define their preferences.protected MetisPreferenceSet.MetisStringPreferenceDefine new String preference.protected MetisViewerEntrydefineViewerEntry(MetisPreferenceParams pParams) Process parameters.formatObject(OceanusDataFormatter pFormatter) Obtain Object summary.Obtain Boolean preference.Obtain Boolean value.Obtain the fieldSet.Obtain Date preference.Obtain Date value.<E extends Enum<E>>
MetisPreferenceSet.MetisEnumPreference<E> getEnumPreference(MetisPreferenceKey pKey, Class<E> pClazz) Obtain Enum preference.<E extends Enum<E>>
EgetEnumValue(MetisPreferenceKey pKey, Class<E> pClazz) Obtain Enum value.Obtain registration object for listeners.Obtain Integer preference.Obtain Integer value.getName()Obtain the name of the set.Obtain preference by key.protected MetisPreferenceSet.MetisPreferenceItemgetPreference(String pName) Obtain preference.Obtain the collection of preferences.Obtain String preference.Obtain String value.booleanDoes the preference set have changes.booleanisHidden()Is this a hidden preferenceSet?voidReset all changes in this preference set.voidsetFocus()Set the focus.protected voidSet this preferenceSet as hidden.final voidStore preference changes.voidUpdate the viewer entry.
-
Field Details
-
ERROR_UNKNOWN
Unknown preference string.- See Also:
-
ERROR_INVALID
Invalid preference string.- See Also:
-
-
Constructor Details
-
MetisPreferenceSet
protected MetisPreferenceSet(MetisPreferenceParams pParams, OceanusBundleId pId) throws OceanusException Constructor.- Parameters:
pParams- the parameterspId- the resource id for the set name- Throws:
OceanusException- on error
-
MetisPreferenceSet
Constructor.- Parameters:
pParams- the parameterspName- the set name- Throws:
OceanusException- on error
-
-
Method Details
-
defineViewerEntry
Process parameters.- Parameters:
pParams- the parameters- Returns:
- the viewer entry
-
getDataFieldSet
Description copied from interface:MetisFieldItemObtain the fieldSet.- Specified by:
getDataFieldSetin interfaceMetisFieldItem- Returns:
- the fieldSet
-
formatObject
Description copied from interface:MetisDataItem.MetisDataObjectFormatObtain Object summary.- Specified by:
formatObjectin interfaceMetisDataItem.MetisDataObjectFormat- Parameters:
pFormatter- the data formatter- Returns:
- the display summary of the object
-
declarePreference
Declare preference.- Parameters:
pPref- the preference to declare
-
getEventRegistrar
Description copied from interface:OceanusEventRegistrar.OceanusEventProviderObtain registration object for listeners.- Specified by:
getEventRegistrarin interfaceOceanusEventRegistrar.OceanusEventProvider<MetisPreferenceEvent>- Returns:
- the registrar
-
definePreferences
Hook to enable preferenceSets to define their preferences.- Throws:
OceanusException- on error
-
autoCorrectPreferences
public abstract void autoCorrectPreferences()Hook to enable preferenceSets to autoCorrect their preferences.This is used both to initialise preferencesSet defaults and to adjust the set when a value changes.
-
getName
Obtain the name of the set.- Returns:
- the name
-
isHidden
public boolean isHidden()Is this a hidden preferenceSet?- Returns:
- true/false
-
setHidden
protected void setHidden()Set this preferenceSet as hidden. -
getPreferences
Obtain the collection of preferences.- Returns:
- the preferences
-
setFocus
public void setFocus()Set the focus. -
updateViewerEntry
public void updateViewerEntry()Update the viewer entry. -
defineStringPreference
Define new String preference.- Parameters:
pKey- the key for the preference- Returns:
- the preference item
-
defineFilePreference
Define new File preference.- Parameters:
pKey- the key for the preference- Returns:
- the preference item
-
defineDirectoryPreference
protected MetisPreferenceSet.MetisStringPreference defineDirectoryPreference(MetisPreferenceKey pKey) Define new Directory preference.- Parameters:
pKey- the key for the preference- Returns:
- the preference item
-
defineColorPreference
Define new Colour preference.- Parameters:
pKey- the key for the preference- Returns:
- the preference item
-
defineIntegerPreference
protected MetisPreferenceSet.MetisIntegerPreference defineIntegerPreference(MetisPreferenceKey pKey) Define new Integer preference.- Parameters:
pKey- the key for the preference- Returns:
- the preference item
-
defineBooleanPreference
protected MetisPreferenceSet.MetisBooleanPreference defineBooleanPreference(MetisPreferenceKey pKey) Define new Boolean preference.- Parameters:
pKey- the key for the preference- Returns:
- the preference item
-
defineDatePreference
Define new Date preference.- Parameters:
pKey- the key for the preference- Returns:
- the preference item
-
defineEnumPreference
protected <E extends Enum<E>> MetisPreferenceSet.MetisEnumPreference<E> defineEnumPreference(MetisPreferenceKey pKey, Class<E> pClazz) Define new Enum preference.- Type Parameters:
E- the Enum type- Parameters:
pKey- the key for the preferencepClazz- the Enum class- Returns:
- the newly created preference
-
definePreference
Define a preference for the node.- Parameters:
pPreference- the preference to define
-
getPreference
Obtain preference by key.- Parameters:
pKey- the key of the preference- Returns:
- the preference
-
getPreference
Obtain preference.- Parameters:
pName- the name of the preference- Returns:
- the preference
-
getStringPreference
Obtain String preference.- Parameters:
pKey- the key of the preference- Returns:
- the String preference
-
getStringValue
Obtain String value.- Parameters:
pKey- the key of the preference- Returns:
- the String value
-
getIntegerPreference
Obtain Integer preference.- Parameters:
pKey- the key of the preference- Returns:
- the Integer preference
-
getIntegerValue
Obtain Integer value.- Parameters:
pKey- the key of the preference- Returns:
- the Integer value
-
getBooleanPreference
Obtain Boolean preference.- Parameters:
pKey- the key of the preference- Returns:
- the Boolean preference
-
getBooleanValue
Obtain Boolean value.- Parameters:
pKey- the key of the preference- Returns:
- the Boolean value
-
getDatePreference
Obtain Date preference.- Parameters:
pKey- the key of the preference- Returns:
- the Date preference
-
getDateValue
Obtain Date value.- Parameters:
pKey- the key of the preference- Returns:
- the Date value
-
getEnumPreference
public <E extends Enum<E>> MetisPreferenceSet.MetisEnumPreference<E> getEnumPreference(MetisPreferenceKey pKey, Class<E> pClazz) Obtain Enum preference.- Type Parameters:
E- the EnumType- Parameters:
pKey- the key of the preferencepClazz- the Enum class- Returns:
- the Enum preference
-
getEnumValue
Obtain Enum value.- Type Parameters:
E- the EnumType- Parameters:
pKey- the key of the preferencepClazz- the Enum class- Returns:
- the Enum value
-
resetChanges
public void resetChanges()Reset all changes in this preference set. -
storeChanges
Store preference changes.- Throws:
OceanusException- on error
-
hasChanges
public boolean hasChanges()Does the preference set have changes.- Returns:
- true/false
-
checkExists
Check whether a preference exists.- Parameters:
pKey- the key of the preference- Returns:
- whether the preference already exists
-