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

public abstract class HistoryManager<T> extends Object
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

    Properties
    Type
    Property
    Description
    final javafx.beans.property.ObjectProperty<Predicate<T>>
    Returns the property object for the filter used when adding items to the history.
    final javafx.beans.property.IntegerProperty
    The maximum number of items that the history will store.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    final void
    add(List<T> items)
    Adds the given items to the history.
    final void
    add(T item)
    Adds the given item to the history.
    final void
    Clears the history.
    final javafx.beans.property.ObjectProperty<Predicate<T>>
    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.
    final Predicate<T>
    Gets the value of the filter property.
    final int
    Gets the value of the maxHistorySize property.
    protected abstract void
     
    final javafx.beans.property.IntegerProperty
    The maximum number of items that the history will store.
    final void
    remove(List<T> items)
    Removes the given items from the history.
    final boolean
    remove(T item)
    Removes the given item from the history.
    final void
    set(List<T> history)
    Sets the history of the HistoryManager with the provided list of strings.
    final void
    Sets the value of the filter property.
    final void
    setMaxHistorySize(int maxHistorySize)
    Sets the value of the maxHistorySize property.
    protected abstract void
     

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Property Details

  • Constructor Details

    • HistoryManager

      public HistoryManager()
  • Method Details

    • loadHistory

      protected abstract void loadHistory()
    • storeHistory

      protected abstract void storeHistory()
    • set

      public final void set(List<T> history)
      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

      public final void add(T item)
      Adds the given item to the history. The method ensures that duplicates will not be added.
      Parameters:
      item - the item to add
    • add

      public final void add(List<T> items)
      Adds the given items to the history.
      Parameters:
      items - the items to add
    • remove

      public final boolean remove(T item)
      Removes the given item from the history.
      Parameters:
      item - the item to remove
      Returns:
      true if the item was removed, false otherwise
    • remove

      public final void remove(List<T> items)
      Removes the given items from the history.
      Parameters:
      items - the items to remove
    • clear

      public final void clear()
      Clears the history.
    • getAllUnmodifiable

      public final javafx.collections.ObservableList<T> 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 the maxHistorySize property.
      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 maxHistorySize property
      See Also:
    • setMaxHistorySize

      public final void setMaxHistorySize(int maxHistorySize)
      Sets the value of the maxHistorySize property.
      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 the maxHistorySize property
      See Also:
    • filterProperty

      public final javafx.beans.property.ObjectProperty<Predicate<T>> 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.
      Returns:
      the property object for the filter
      See Also:
    • getFilter

      public final Predicate<T> getFilter()
      Gets the value of the filter property.
      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.
      Returns:
      the value of the filter property
      See Also:
    • setFilter

      public final void setFilter(Predicate<T> filter)
      Sets the value of the filter property.
      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 the filter property
      See Also: