it.amattioli.applicate.commands
Class ListEditorImpl<T>

Show UML class diagram
java.lang.Object
  extended by it.amattioli.applicate.commands.ListEditorImpl<T>
All Implemented Interfaces:
ListEditor<T>, Selector<T>, it.amattioli.dominate.util.PropertyChangeEmitter
Direct Known Subclasses:
RepositoryEditor

public class ListEditorImpl<T>
extends Object
implements ListEditor<T>, it.amattioli.dominate.util.PropertyChangeEmitter


Field Summary
static String EDITING_LIST
           
 
Constructor Summary
ListEditorImpl()
           
ListEditorImpl(EditingListManager<T> editingListManager)
           
ListEditorImpl(List<T> editingList, Class<T> entityClass)
           
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener listener)
           
 T addRow(Object... param)
          Create a new object (and a corresponding editor) at the end of the list.
protected  void addRowIfEmpty()
           
 void addSelectionListener(SelectionListener listener)
          Register a listener for the object selection.
 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.
protected  void firePropertyChange(String propertyName, Object oldValue, Object newValue)
           
 List<T> getEditingList()
          Retrieve the list that is being edited by this editor.
protected  EditingListManager<T> getEditingListManager()
           
 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 removePropertyChangeListener(PropertyChangeListener listener)
           
 void removeSelectionListener(SelectionListener listener)
          Remove a listener from the collection of the listeners that will be notified when an object is slected in this browser.
 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 setEditingListManager(EditingListManager<T> editingListManager)
           
 void setEmptyRow(boolean emptyRow)
          Set the behavior of this editor when the editing list is empty.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EDITING_LIST

public static final String EDITING_LIST
See Also:
Constant Field Values
Constructor Detail

ListEditorImpl

public ListEditorImpl()

ListEditorImpl

public ListEditorImpl(EditingListManager<T> editingListManager)

ListEditorImpl

public ListEditorImpl(List<T> editingList,
                      Class<T> entityClass)
Method Detail

setEditingListManager

public void setEditingListManager(EditingListManager<T> editingListManager)

getEditingListManager

protected EditingListManager<T> getEditingListManager()

setEditingList

public void setEditingList(List<T> editingList)
Description copied from interface: ListEditor
Set the list that has to be edited by this editor.

Specified by:
setEditingList in interface ListEditor<T>
Parameters:
editingList - the list that has to be edited by this editor

getEditingList

public List<T> getEditingList()
Description copied from interface: ListEditor
Retrieve the list that is being edited by this editor.

Specified by:
getEditingList in interface ListEditor<T>
Returns:
the list that is being edited by this editor

isEmptyRow

public boolean isEmptyRow()
Specified by:
isEmptyRow in interface ListEditor<T>

setEmptyRow

public void setEmptyRow(boolean emptyRow)
Description copied from interface: ListEditor
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.

Specified by:
setEmptyRow in interface ListEditor<T>

addRowIfEmpty

protected void addRowIfEmpty()

select

public void select(int idx)
Description copied from interface: ListEditor
Selected the object with the given index.

Specified by:
select in interface ListEditor<T>
Parameters:
idx - the index of the object to be selected

getSelectedIndex

public Integer getSelectedIndex()
Description copied from interface: ListEditor
Retrieves the index of the currently selected object.

Specified by:
getSelectedIndex in interface ListEditor<T>
Returns:
the index of the currently selected object or null if no object is selected

getSelectedObject

public T getSelectedObject()
Description copied from interface: ListEditor
Retrieves the currently selected object.

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

getElementEditor

public BeanEditor<T> getElementEditor(int index)
Description copied from interface: ListEditor
Retrieves the editor for the entity with the given index.

Specified by:
getElementEditor in interface ListEditor<T>
Returns:

addRow

public T addRow(Object... param)
Description copied from interface: ListEditor
Create a new object (and a corresponding editor) at the end of the list.

Specified by:
addRow in interface ListEditor<T>
Parameters:
param - a list of param that can be necessary for building a new entity instance
Returns:
the new entity

canDeleteRow

public boolean canDeleteRow()
Description copied from interface: ListEditor
Check if the currently selected object can be deleted.

Specified by:
canDeleteRow in interface ListEditor<T>
Returns:
true if the currently selected object can be deleted, false otherwise

deleteRow

public T deleteRow()
Description copied from interface: ListEditor
Delete from the list the object (and the corresponding editor) currently selected.

Specified by:
deleteRow in interface ListEditor<T>
Returns:

firePropertyChange

protected void firePropertyChange(String propertyName,
                                  Object oldValue,
                                  Object newValue)

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener listener)
Specified by:
addPropertyChangeListener in interface it.amattioli.dominate.util.PropertyChangeEmitter

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener listener)
Specified by:
removePropertyChangeListener in interface it.amattioli.dominate.util.PropertyChangeEmitter

addSelectionListener

public void addSelectionListener(SelectionListener listener)
Description copied from interface: Selector
Register a listener for the object selection. Every time an object is selected in this browser all the registered objects will be notified.

Specified by:
addSelectionListener in interface Selector<T>
Parameters:
listener - the listener to be registered

removeSelectionListener

public void removeSelectionListener(SelectionListener listener)
Description copied from interface: Selector
Remove a listener from the collection of the listeners that will be notified when an object is slected in this browser.

Specified by:
removeSelectionListener in interface Selector<T>
Parameters:
listener - the listener to be removed


Copyright © 2011. All Rights Reserved.