Class AbstractListSelectEditor<V>

java.lang.Object
io.guise.framework.model.AbstractListSelectEditor<V>
Type Parameters:
V - The type of values contained in the model.
All Implemented Interfaces:
ListSelectEditor<V>
Direct Known Subclasses:
DefaultListSelectEditor

public abstract class AbstractListSelectEditor<V> extends Object implements ListSelectEditor<V>
An abstract class for editing values in a list model. Prototypes are provided for common edit functionality. This class registers itself with the given list, which will cause memory leaks if an instance of this class is discarded without also discarding the list.
Author:
Garret Wilson
  • Constructor Details

    • AbstractListSelectEditor

      public AbstractListSelectEditor(ListSelectModel<V> listSelectModel)
      List select model constructor.
      Parameters:
      listSelectModel - The list select model this prototype manipulates.
      Throws:
      NullPointerException - if the given list select model is null.
  • Method Details

    • getListSelectModel

      public ListSelectModel<V> getListSelectModel()
      Specified by:
      getListSelectModel in interface ListSelectEditor<V>
      Returns:
      The list select model being edited.
    • getInsertActionPrototype

      public ActionPrototype getInsertActionPrototype()
      Specified by:
      getInsertActionPrototype in interface ListSelectEditor<V>
      Returns:
      The prototype for inserting a value into the list.
    • getEditActionPrototype

      public ActionPrototype getEditActionPrototype()
      Specified by:
      getEditActionPrototype in interface ListSelectEditor<V>
      Returns:
      The prototype for editing a value in the list.
    • getRemoveActionPrototype

      public ActionPrototype getRemoveActionPrototype()
      Specified by:
      getRemoveActionPrototype in interface ListSelectEditor<V>
      Returns:
      The prototype for removing a value from the list.
    • getLowerActionPrototype

      public ActionPrototype getLowerActionPrototype()
      Specified by:
      getLowerActionPrototype in interface ListSelectEditor<V>
      Returns:
      The prototype for lowering a value from the list to a lesser index.
    • getRaiseActionPrototype

      public ActionPrototype getRaiseActionPrototype()
      Specified by:
      getRaiseActionPrototype in interface ListSelectEditor<V>
      Returns:
      The prototype for raising a value from the list to a higher index.
    • updateProperties

      protected void updateProperties()
      Updates the action properties based upon the current state of the list select model.
    • editValue

      protected void editValue(V value, int index, boolean replace)
      Commences editing a value. This method returns immediately before editing is finished. Once the value has been edited and accepted, it will be added to the list and the selected value updated to the edited value.
      Parameters:
      value - The value to edit.
      index - The index at which the edited value will be placed.
      replace - true if the value should replace the value at the given index, or false if the value should be inserted at the given index.
    • insertValue

      public void insertValue()
      Description copied from interface: ListSelectEditor
      Creates and allows the user to edit a new value. If the user accepts the changes, the value is inserted before the currently selected value in the list, or at the end of the list if no value is selected.
      Specified by:
      insertValue in interface ListSelectEditor<V>
    • editValue

      public void editValue()
      Description copied from interface: ListSelectEditor
      Edits the currently selected value in the list. If no value is selected in the list, no action occurs.
      Specified by:
      editValue in interface ListSelectEditor<V>
    • removeValue

      public void removeValue()
      Description copied from interface: ListSelectEditor
      Removes the currently selected value in the list. If no value is selected in the list, no action occurs.
      Specified by:
      removeValue in interface ListSelectEditor<V>
    • lowerValue

      public void lowerValue()
      Lowers the currently selected value in the list. If no value is selected in the list, or the first item is selected, no action occurs.
    • raiseValue

      public void raiseValue()
      Raises the currently selected value in the list. If no value is selected in the list, or the last item is selected, no action occurs.
    • createValue

      protected abstract V createValue()
      Creates a new value to add to the list.
      Returns:
      A new default value to add.
    • createValuedComponent

      protected abstract ValuedComponent<V> createValuedComponent()
      Creates a component for editing a value.
      Returns:
      A component for editing the value.