public class NFEBlockUndoableEdit extends javax.swing.undo.AbstractUndoableEdit implements NFEModelListener
NFEAttomicUndoableEdit
. Once an undoable block is open, it will catch every model event fired at the same execution thread associated to the block and will assign an undoable edit to manage the undo/redo for that event.METHOD_MODEL_OBJECT_ADDED, METHOD_MODEL_OBJECT_REMOVED, METHOD_MODEL_OBJECTS_ADDED, METHOD_MODEL_OBJECTS_REMOVED, METHOD_PROPERTY_CHANGED
Constructor and Description |
---|
NFEBlockUndoableEdit(java.lang.String presentationName, NFEModel model)
Allocates a new undoable block
|
Modifier and Type | Method and Description |
---|---|
void |
closeBlock()
Sets the block to stop listening events.
|
java.lang.String |
getPresentationName() |
long |
getThreadId()
Gets the id of the execution thread assigned to this block.
|
boolean |
isBlockEmpty()
Tells whether the block is empty, that is, it does not contain actions
|
boolean |
isOpen()
Tells whether the block is listening to events
|
void |
modelObjectAdded(NFEModelObjectEvent event)
Invoked when a model object has been added
|
void |
modelObjectPropertyChanged(NFEModelObjectPropertyChangedEvent event)
Invoked when a model object's property has been changed
|
void |
modelObjectRemoved(NFEModelObjectEvent event)
Invoked when a model object has been removed
|
void |
modelObjectsAdded(NFEModelObjectsEvent event)
Invoked when one or more model objects have been added
|
void |
modelObjectsRemoved(NFEModelObjectsEvent event)
Invoked when one or more model objects have been removed
|
void |
openBlock()
Sets the block ready to listen for new actions performed in the NFE model.
|
void |
redo() |
void |
setThreadId(long threadId)
Sets the id of the execution thread for the block.
|
void |
undo() |
public NFEBlockUndoableEdit(java.lang.String presentationName, NFEModel model)
presentationName
- a user-friendly name that describes the actions performed in the blockmodel
- the current NFE modelpublic void openBlock()
NFEAtomicUndoableEdit
implementation will be managed by the current block. During this state, the block's undo/redo methods should not be calledpublic boolean isBlockEmpty()
public void closeBlock()
public long getThreadId()
public void setThreadId(long threadId)
threadId
- an execution thread's idpublic boolean isOpen()
public void modelObjectAdded(NFEModelObjectEvent event)
NFEModelListener
modelObjectAdded
in interface NFEModelListener
event
- contains a reference to the model object that has been addedpublic void modelObjectsAdded(NFEModelObjectsEvent event)
NFEModelListener
modelObjectsAdded
in interface NFEModelListener
event
- contains a collection of references to the model objects that have been addedpublic void modelObjectRemoved(NFEModelObjectEvent event)
NFEModelListener
modelObjectRemoved
in interface NFEModelListener
event
- contains a reference to the model object that has been removedpublic void modelObjectsRemoved(NFEModelObjectsEvent event)
NFEModelListener
modelObjectsRemoved
in interface NFEModelListener
event
- contains a collection of references to the model objects that have been removedpublic void modelObjectPropertyChanged(NFEModelObjectPropertyChangedEvent event)
NFEModelListener
modelObjectPropertyChanged
in interface NFEModelListener
event
- contains a reference to the model objects which property has been changed and the name and previous value of the changed propertypublic java.lang.String getPresentationName()
getPresentationName
in interface javax.swing.undo.UndoableEdit
getPresentationName
in class javax.swing.undo.AbstractUndoableEdit
public void undo() throws javax.swing.undo.CannotUndoException
undo
in interface javax.swing.undo.UndoableEdit
undo
in class javax.swing.undo.AbstractUndoableEdit
javax.swing.undo.CannotUndoException
public void redo() throws javax.swing.undo.CannotRedoException
redo
in interface javax.swing.undo.UndoableEdit
redo
in class javax.swing.undo.AbstractUndoableEdit
javax.swing.undo.CannotRedoException