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 the property filter.final intGets the value of the property maxHistorySize.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 the property filter.final voidsetMaxHistorySize(int maxHistorySize) Sets the value of the property maxHistorySize.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
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.- See Also:
-
-
Constructor Details
-
HistoryManager
public HistoryManager()
-
-
Method Details
-
loadHistory
protected abstract void loadHistory() -
storeHistory
protected abstract void storeHistory() -
set
Sets the history of the HistoryManager with the provided list of strings. The method ensures that duplicates are removed from the list.- Parameters:
history- the list of strings representing the history
-
add
Adds the given item to the history. The method ensures that duplicates will not be added.- Parameters:
item- the item to add
-
add
Adds the given items to the history.- Parameters:
items- the items to 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
Removes the given items from the history.- Parameters:
items- the items to 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.- See Also:
-
getMaxHistorySize
public final int getMaxHistorySize()Gets the value of the property maxHistorySize.- 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.
-
setMaxHistorySize
public final void setMaxHistorySize(int maxHistorySize) Sets the value of the property maxHistorySize.- 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.
-
filterProperty
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.- See Also:
-
getFilter
Gets the value of the property filter.- 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.
-
setFilter
Sets the value of the property filter.- 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.
-