Package io.guise.framework.model
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
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 Summary
ConstructorDescriptionAbstractListSelectEditor
(ListSelectModel<V> listSelectModel) List select model constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract V
Creates a new value to add to the list.protected abstract ValuedComponent<V>
Creates a component for editing a value.void
Edits the currently selected value in the list.protected void
Commences editing a value.void
Creates and allows the user to edit a new value.void
Lowers the currently selected value in the list.void
Raises the currently selected value in the list.void
Removes the currently selected value in the list.protected void
Updates the action properties based upon the current state of the list select model.
-
Constructor Details
-
AbstractListSelectEditor
List select model constructor.- Parameters:
listSelectModel
- The list select model this prototype manipulates.- Throws:
NullPointerException
- if the given list select model isnull
.
-
-
Method Details
-
getListSelectModel
- Specified by:
getListSelectModel
in interfaceListSelectEditor<V>
- Returns:
- The list select model being edited.
-
getInsertActionPrototype
- Specified by:
getInsertActionPrototype
in interfaceListSelectEditor<V>
- Returns:
- The prototype for inserting a value into the list.
-
getEditActionPrototype
- Specified by:
getEditActionPrototype
in interfaceListSelectEditor<V>
- Returns:
- The prototype for editing a value in the list.
-
getRemoveActionPrototype
- Specified by:
getRemoveActionPrototype
in interfaceListSelectEditor<V>
- Returns:
- The prototype for removing a value from the list.
-
getLowerActionPrototype
- Specified by:
getLowerActionPrototype
in interfaceListSelectEditor<V>
- Returns:
- The prototype for lowering a value from the list to a lesser index.
-
getRaiseActionPrototype
- Specified by:
getRaiseActionPrototype
in interfaceListSelectEditor<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
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, orfalse
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 interfaceListSelectEditor<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 interfaceListSelectEditor<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 interfaceListSelectEditor<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
Creates a new value to add to the list.- Returns:
- A new default value to add.
-
createValuedComponent
Creates a component for editing a value.- Returns:
- A component for editing the value.
-