Class HistoryManager<T>
java.lang.Object
com.dlsc.gemsfx.util.HistoryManager<T>
- Type Parameters:
T- the type of items stored in the history
- Direct Known Subclasses:
InMemoryHistoryManager, PreferencesHistoryManager
The HistoryManager class defines the standard operations to manage history storage
for any type of items, allowing for implementation of various data storage mechanisms.
-
Property Summary
PropertiesTypePropertyDescriptionReturns the property object for the filter used when adding items to the history.final javafx.beans.property.IntegerPropertyThe maximum number of items that the history will store. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal voidAdds the given items to the history.final voidAdds the given item to the history.final voidclear()Clears the history.Returns the property object for the filter used when adding items to the history.final javafx.collections.ObservableList<T> Returns an unmodifiable list of the history.Gets the value of thefilterproperty.final intGets the value of themaxHistorySizeproperty.protected abstract voidfinal javafx.beans.property.IntegerPropertyThe maximum number of items that the history will store.final voidRemoves the given items from the history.final booleanRemoves the given item from the history.final voidSets the history of the HistoryManager with the provided list of strings.final voidSets the value of thefilterproperty.final voidsetMaxHistorySize(int maxHistorySize) Sets the value of themaxHistorySizeproperty.protected abstract void
-
Property Details
-
maxHistorySize
public final javafx.beans.property.IntegerProperty maxHistorySizePropertyThe maximum number of items that the history will store. If the number of items exceeds this value, the oldest items will be removed.- See Also:
-
filter
-
-
Constructor Details
-
HistoryManager
public HistoryManager()
-
-
Method Details
-
loadHistory
protected abstract void loadHistory() -
storeHistory
protected abstract void storeHistory() -
set
-
add
Adds the given item to the history. The method ensures that duplicates will not be added.- Parameters:
item- the item to add
-
add
-
remove
Removes the given item from the history.- Parameters:
item- the item to remove- Returns:
- true if the item was removed, false otherwise
-
remove
-
clear
public final void clear()Clears the history. -
getAllUnmodifiable
Returns an unmodifiable list of the history. -
maxHistorySizeProperty
public final javafx.beans.property.IntegerProperty maxHistorySizeProperty()The maximum number of items that the history will store. If the number of items exceeds this value, the oldest items will be removed.- Returns:
- the maximum number of items in the history
- See Also:
-
getMaxHistorySize
public final int getMaxHistorySize()Gets the value of themaxHistorySizeproperty.- Property description:
- The maximum number of items that the history will store. If the number of items exceeds this value, the oldest items will be removed.
- Returns:
- the value of the
maxHistorySizeproperty - See Also:
-
setMaxHistorySize
public final void setMaxHistorySize(int maxHistorySize) Sets the value of themaxHistorySizeproperty.- Property description:
- The maximum number of items that the history will store. If the number of items exceeds this value, the oldest items will be removed.
- Parameters:
maxHistorySize- the value for themaxHistorySizeproperty- See Also:
-
filterProperty
-
getFilter
-
setFilter
Sets the value of thefilterproperty.- Property description:
- Returns the property object for the filter used when adding items to the history. Only items that pass the filter will be added to the history.
- Parameters:
filter- the value for thefilterproperty- See Also:
-