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 voidcloseBlock()Sets the block to stop listening events.java.lang.StringgetPresentationName()longgetThreadId()Gets the id of the execution thread assigned to this block.booleanisBlockEmpty()Tells whether the block is empty, that is, it does not contain actionsbooleanisOpen()Tells whether the block is listening to eventsvoidmodelObjectAdded(NFEModelObjectEvent event)Invoked when a model object has been addedvoidmodelObjectPropertyChanged(NFEModelObjectPropertyChangedEvent event)Invoked when a model object's property has been changedvoidmodelObjectRemoved(NFEModelObjectEvent event)Invoked when a model object has been removedvoidmodelObjectsAdded(NFEModelObjectsEvent event)Invoked when one or more model objects have been addedvoidmodelObjectsRemoved(NFEModelObjectsEvent event)Invoked when one or more model objects have been removedvoidopenBlock()Sets the block ready to listen for new actions performed in the NFE model.voidredo()voidsetThreadId(long threadId)Sets the id of the execution thread for the block.voidundo()
-
-
-
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 correspondingNFEAtomicUndoableEditimplementation 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:NFEModelListenerInvoked when a model object has been added- Specified by:
modelObjectAddedin interfaceNFEModelListener- Parameters:
event- contains a reference to the model object that has been added
-
modelObjectsAdded
public void modelObjectsAdded(NFEModelObjectsEvent event)
Description copied from interface:NFEModelListenerInvoked when one or more model objects have been added- Specified by:
modelObjectsAddedin 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:NFEModelListenerInvoked when a model object has been removed- Specified by:
modelObjectRemovedin interfaceNFEModelListener- Parameters:
event- contains a reference to the model object that has been removed
-
modelObjectsRemoved
public void modelObjectsRemoved(NFEModelObjectsEvent event)
Description copied from interface:NFEModelListenerInvoked when one or more model objects have been removed- Specified by:
modelObjectsRemovedin 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:NFEModelListenerInvoked when a model object's property has been changed- Specified by:
modelObjectPropertyChangedin 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:
getPresentationNamein interfacejavax.swing.undo.UndoableEdit- Overrides:
getPresentationNamein classjavax.swing.undo.AbstractUndoableEdit
-
undo
public void undo() throws javax.swing.undo.CannotUndoException- Specified by:
undoin interfacejavax.swing.undo.UndoableEdit- Overrides:
undoin classjavax.swing.undo.AbstractUndoableEdit- Throws:
javax.swing.undo.CannotUndoException
-
redo
public void redo() throws javax.swing.undo.CannotRedoException- Specified by:
redoin interfacejavax.swing.undo.UndoableEdit- Overrides:
redoin classjavax.swing.undo.AbstractUndoableEdit- Throws:
javax.swing.undo.CannotRedoException
-
-