it.amattioli.applicate.commands
Interface ListEditor<T>

Show UML class diagram
Type Parameters:
T -
All Superinterfaces:
it.amattioli.dominate.util.PropertyChangeEmitter, Selector<T>
All Known Implementing Classes:
ListEditorImpl, NullListEditor, RepositoryEditor

public interface ListEditor<T>
extends it.amattioli.dominate.util.PropertyChangeEmitter, Selector<T>

An editor for a list of entities. Implementations of this interface maintain a list of editors, one for each entity contained in the editing list. A new entity can be added to the list using the #addRow() method. The deleteRow() method, instead, can be used to remove an entity from the editing list.


Method Summary
 T addRow(Object... param)
          Create a new object (and a corresponding editor) at the end of the list.
 boolean canDeleteRow()
          Check if the currently selected object can be deleted.
 T deleteRow()
          Delete from the list the object (and the corresponding editor) currently selected.
 List<T> getEditingList()
          Retrieve the list that is being edited by this editor.
 BeanEditor<T> getElementEditor(int index)
          Retrieves the editor for the entity with the given index.
 Integer getSelectedIndex()
          Retrieves the index of the currently selected object.
 T getSelectedObject()
          Retrieves the currently selected object.
 boolean isEmptyRow()
           
 void select(int idx)
          Selected the object with the given index.
 void setEditingList(List<T> editingList)
          Set the list that has to be edited by this editor.
 void setEmptyRow(boolean emptyRow)
          Set the behavior of this editor when the editing list is empty.
 
Methods inherited from interface it.amattioli.dominate.util.PropertyChangeEmitter
addPropertyChangeListener, removePropertyChangeListener
 
Methods inherited from interface it.amattioli.applicate.selection.Selector
addSelectionListener, removeSelectionListener
 

Method Detail

setEditingList

void setEditingList(List<T> editingList)
Set the list that has to be edited by this editor.

Parameters:
editingList - the list that has to be edited by this editor

getEditingList

List<T> getEditingList()
Retrieve the list that is being edited by this editor.

Returns:
the list that is being edited by this editor

setEmptyRow

void setEmptyRow(boolean emptyRow)
Set the behavior of this editor when the editing list is empty. If the emptyRow property is set to true the editor will automatically create a new row so the list will never be empty. If the property is set to false the list can be empty, so no new entity is created.

Parameters:
emptyRow -

isEmptyRow

boolean isEmptyRow()

select

void select(int idx)
Selected the object with the given index.

Parameters:
idx - the index of the object to be selected

getSelectedIndex

Integer getSelectedIndex()
Retrieves the index of the currently selected object.

Returns:
the index of the currently selected object or null if no object is selected

getSelectedObject

T getSelectedObject()
Retrieves the currently selected object.

Specified by:
getSelectedObject in interface Selector<T>
Returns:
the currently selected object or null if no object is selected

getElementEditor

BeanEditor<T> getElementEditor(int index)
Retrieves the editor for the entity with the given index.

Parameters:
index -
Returns:

addRow

T addRow(Object... param)
Create a new object (and a corresponding editor) at the end of the list.

Parameters:
param - a list of param that can be necessary for building a new entity instance
Returns:
the new entity

deleteRow

T deleteRow()
Delete from the list the object (and the corresponding editor) currently selected.

Returns:

canDeleteRow

boolean canDeleteRow()
Check if the currently selected object can be deleted.

Returns:
true if the currently selected object can be deleted, false otherwise


Copyright © 2011. All Rights Reserved.