dsto.dfc.swing.list
Class AbstractAddRowCommand
java.lang.Object
dsto.dfc.swing.commands.AbstractCommand
dsto.dfc.swing.commands.BasicAddEntryCommand
dsto.dfc.swing.list.AbstractAddRowCommand
- All Implemented Interfaces:
- Command, Iconic, Copyable, ActionListener, Cloneable, EventListener
public abstract class AbstractAddRowCommand
- extends BasicAddEntryCommand
Base class for "Add New Row"-type commands. Subclasses must
implement createNewEntry()
and may choose to override
addEntry () and getIndexForNewEntry ().
- Version:
- $Revision$
- Author:
- Matthew Phillips
Method Summary |
protected boolean |
addEntry(DfcListModel model,
Object entry,
int index)
Subclasses may override this to change the way the entry is added to
a model. |
protected abstract Object |
createNewEntry()
Subclasses must override this to create a new entry for the list eg
via showing a dialog. |
void |
execute()
Executes command by calling createNewEntry (), and then adding
the entry at the index specified by getIndexForNewEntry () by
calling addEntry (). |
protected int |
getIndexForNewEntry(Object newEntry)
Get the index for an entry to the list - subclasses may choose to
override this. |
list
protected DfcList list
AbstractAddRowCommand
public AbstractAddRowCommand(DfcList list)
execute
public void execute()
- Executes command by calling createNewEntry (), and then adding
the entry at the index specified by getIndexForNewEntry () by
calling addEntry ().
- Specified by:
execute
in interface Command
- Overrides:
execute
in class BasicAddEntryCommand
addEntry
protected boolean addEntry(DfcListModel model,
Object entry,
int index)
- Subclasses may override this to change the way the entry is added to
a model.
- Returns:
- True if the entry was added.
createNewEntry
protected abstract Object createNewEntry()
- Subclasses must override this to create a new entry for the list eg
via showing a dialog.
- Returns:
- A new entry to be added to the list, or null if no entry should
be added.
getIndexForNewEntry
protected int getIndexForNewEntry(Object newEntry)
- Get the index for an entry to the list - subclasses may choose to
override this. Default is to return the end of the list.
Copyright © 2008 Commonwealth of Australia