Class NFEBlockUndoableEdit
- java.lang.Object
-
- javax.swing.undo.AbstractUndoableEdit
-
- oracle.spatial.network.nfe.model.edit.undo.NFEBlockUndoableEdit
-
- All Implemented Interfaces:
java.io.Serializable
,java.util.EventListener
,javax.swing.undo.UndoableEdit
,NFEModelListener
public class NFEBlockUndoableEdit extends javax.swing.undo.AbstractUndoableEdit implements NFEModelListener
Undoable Edit implementation which contains multiple actions that should be executed altogether in a undo/redo operation. An instance of this class will contain one or more instances ofNFEAttomicUndoableEdit
. 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.- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from interface oracle.spatial.network.nfe.model.event.NFEModelListener
METHOD_MODEL_OBJECT_ADDED, METHOD_MODEL_OBJECT_REMOVED, METHOD_MODEL_OBJECTS_ADDED, METHOD_MODEL_OBJECTS_REMOVED, METHOD_PROPERTY_CHANGED
-
-
Constructor Summary
Constructors Constructor Description NFEBlockUndoableEdit(java.lang.String presentationName, NFEModel model)
Allocates a new undoable block
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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 actionsboolean
isOpen()
Tells whether the block is listening to eventsvoid
modelObjectAdded(NFEModelObjectEvent event)
Invoked when a model object has been addedvoid
modelObjectPropertyChanged(NFEModelObjectPropertyChangedEvent event)
Invoked when a model object's property has been changedvoid
modelObjectRemoved(NFEModelObjectEvent event)
Invoked when a model object has been removedvoid
modelObjectsAdded(NFEModelObjectsEvent event)
Invoked when one or more model objects have been addedvoid
modelObjectsRemoved(NFEModelObjectsEvent event)
Invoked when one or more model objects have been removedvoid
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()
-
-
-
Constructor Detail
-
NFEBlockUndoableEdit
public NFEBlockUndoableEdit(java.lang.String presentationName, NFEModel model)
Allocates a new undoable block- Parameters:
presentationName
- a user-friendly name that describes the actions performed in the blockmodel
- the current NFE model
-
-
Method Detail
-
openBlock
public void openBlock()
Sets the block ready to listen for new actions performed in the NFE model. Every NFE model event with a correspondingNFEAtomicUndoableEdit
implementation will be managed by the current block. During this state, the block's undo/redo methods should not be called
-
isBlockEmpty
public boolean isBlockEmpty()
Tells whether the block is empty, that is, it does not contain actions- Returns:
-
closeBlock
public void closeBlock()
Sets the block to stop listening events. Once this state is set, no actions will be added to the block and it is ready to perform undo/redo actions.
-
getThreadId
public long getThreadId()
Gets the id of the execution thread assigned to this block.- Returns:
-
setThreadId
public void setThreadId(long threadId)
Sets the id of the execution thread for the block. All the NFE model events fired from the execution thread with the given id, will be cached by the block.- Parameters:
threadId
- an execution thread's id
-
isOpen
public boolean isOpen()
Tells whether the block is listening to events- Returns:
- true if the model is listening to events
-
modelObjectAdded
public void modelObjectAdded(NFEModelObjectEvent event)
Description copied from interface:NFEModelListener
Invoked when a model object has been added- Specified by:
modelObjectAdded
in interfaceNFEModelListener
- Parameters:
event
- contains a reference to the model object that has been added
-
modelObjectsAdded
public void modelObjectsAdded(NFEModelObjectsEvent event)
Description copied from interface:NFEModelListener
Invoked when one or more model objects have been added- Specified by:
modelObjectsAdded
in interfaceNFEModelListener
- Parameters:
event
- contains a collection of references to the model objects that have been added
-
modelObjectRemoved
public void modelObjectRemoved(NFEModelObjectEvent event)
Description copied from interface:NFEModelListener
Invoked when a model object has been removed- Specified by:
modelObjectRemoved
in interfaceNFEModelListener
- Parameters:
event
- contains a reference to the model object that has been removed
-
modelObjectsRemoved
public void modelObjectsRemoved(NFEModelObjectsEvent event)
Description copied from interface:NFEModelListener
Invoked when one or more model objects have been removed- Specified by:
modelObjectsRemoved
in interfaceNFEModelListener
- Parameters:
event
- contains a collection of references to the model objects that have been removed
-
modelObjectPropertyChanged
public void modelObjectPropertyChanged(NFEModelObjectPropertyChangedEvent event)
Description copied from interface:NFEModelListener
Invoked when a model object's property has been changed- Specified by:
modelObjectPropertyChanged
in interfaceNFEModelListener
- Parameters:
event
- contains a reference to the model objects which property has been changed and the name and previous value of the changed property
-
getPresentationName
public java.lang.String getPresentationName()
- Specified by:
getPresentationName
in interfacejavax.swing.undo.UndoableEdit
- Overrides:
getPresentationName
in classjavax.swing.undo.AbstractUndoableEdit
-
undo
public void undo() throws javax.swing.undo.CannotUndoException
- Specified by:
undo
in interfacejavax.swing.undo.UndoableEdit
- Overrides:
undo
in classjavax.swing.undo.AbstractUndoableEdit
- Throws:
javax.swing.undo.CannotUndoException
-
redo
public void redo() throws javax.swing.undo.CannotRedoException
- Specified by:
redo
in interfacejavax.swing.undo.UndoableEdit
- Overrides:
redo
in classjavax.swing.undo.AbstractUndoableEdit
- Throws:
javax.swing.undo.CannotRedoException
-
-