com.alee.laf.list.editor
Interface ListCellEditor<E extends java.awt.Component,T>

Type Parameters:
E - Editor component type
T - Editor value type
All Known Implementing Classes:
AbstractListCellEditor, DefaultListCellEditor, WebCheckBoxListCellEditor, WebFileListCellEditor

public interface ListCellEditor<E extends java.awt.Component,T>

This interface provides base methods for list cell editor creation. Cell editor is not available in Swing for JList, this a custom WebLaF-exclusive editor.

Author:
Mikle Garin

Method Summary
 void cancelEdit(javax.swing.JList list)
          Cancels list cell editing.
 void editCancelled(javax.swing.JList list, int index)
          Notifies that list cell editing was cancelled.
 void editStarted(javax.swing.JList list, int index)
          Notifies that list cell editing has started.
 void editStopped(javax.swing.JList list, int index, T oldValue, T newValue)
          Notifies that list cell editing has finished.
 E getCellEditor(javax.swing.JList list, int index, T value)
          Returns list cell editor created for the cell under specified index.
 T getCellEditorValue(javax.swing.JList list, int index, T oldValue)
          Returns editor value that will replace the specified old value in the model.
 void install(javax.swing.JList list)
          Installs cell editor in the list.
 boolean isCellEditable(javax.swing.JList list, int index, T value)
          Returns whether list cell under the specified index is editable or not.
 boolean isEditing()
          Returns whether editor is currently active or not.
 void startEdit(javax.swing.JList list, int index)
          Starts specified list cell editing.
 boolean stopEdit(javax.swing.JList list)
          Stops list cell editing.
 void uninstall(javax.swing.JList list)
          Uninstalls cell editor from the list.
 boolean updateListModel(javax.swing.JList list, int index, T oldValue, T newValue, boolean updateSelection)
          Returns whether value update operation completed successfully or not.
 

Method Detail

install

void install(javax.swing.JList list)
Installs cell editor in the list. This method should add all required listeners in the list that will cause editing to start.

Parameters:
list - list to process

uninstall

void uninstall(javax.swing.JList list)
Uninstalls cell editor from the list. This method should remove all listeners from the list and cleanup all associated resources.

Parameters:
list - list to process

isCellEditable

boolean isCellEditable(javax.swing.JList list,
                       int index,
                       T value)
Returns whether list cell under the specified index is editable or not.

Parameters:
list - list to process
index - cell index
value - cell value
Returns:
whether list cell under the specified index is editable or not

getCellEditor

E getCellEditor(javax.swing.JList list,
                int index,
                T value)
Returns list cell editor created for the cell under specified index.

Parameters:
list - list to process
index - cell index
value - cell value
Returns:
list cell editor created for the cell under specified index

startEdit

void startEdit(javax.swing.JList list,
               int index)
Starts specified list cell editing.

Parameters:
list - list to process
index - cell index

cancelEdit

void cancelEdit(javax.swing.JList list)
Cancels list cell editing.

Parameters:
list - list to process

stopEdit

boolean stopEdit(javax.swing.JList list)
Stops list cell editing. Usually if value did not change editCancelled event will be thrown, but that depends on implementation.

Parameters:
list - list to process
Returns:
true if cell editing was stopped or cancelled, false otherwise

getCellEditorValue

T getCellEditorValue(javax.swing.JList list,
                     int index,
                     T oldValue)
Returns editor value that will replace the specified old value in the model.

Parameters:
list - list to process
index - cell index
oldValue - old cell value
Returns:
editor value

updateListModel

boolean updateListModel(javax.swing.JList list,
                        int index,
                        T oldValue,
                        T newValue,
                        boolean updateSelection)
Returns whether value update operation completed successfully or not. Basically this method should replace old value with a new one in list model and update list view.

Parameters:
list - list to process
index - cell index
oldValue - old cell value
newValue - new cell value
updateSelection - whether update list selection or not
Returns:
true if list model was updated

editStarted

void editStarted(javax.swing.JList list,
                 int index)
Notifies that list cell editing has started.

Parameters:
list - list to process
index - edited cell index

editStopped

void editStopped(javax.swing.JList list,
                 int index,
                 T oldValue,
                 T newValue)
Notifies that list cell editing has finished.

Parameters:
list - list to process
index - edited cell index
oldValue - old cell value
newValue - new cell value

editCancelled

void editCancelled(javax.swing.JList list,
                   int index)
Notifies that list cell editing was cancelled.

Parameters:
list - list to process
index - edited cell index

isEditing

boolean isEditing()
Returns whether editor is currently active or not.

Returns:
true if editor is currently active, false otherwise