Class 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 java.lang.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 Detail

      • AbstractListSelectEditor

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

      • 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.