Package org.apache.jmeter.gui
Class UndoHistory
- java.lang.Object
-
- org.apache.jmeter.gui.UndoHistory
-
- All Implemented Interfaces:
Serializable,EventListener,TreeModelListener
public class UndoHistory extends Object implements TreeModelListener, Serializable
This class serves storing Test Tree state and navigating through it to give the undo/redo ability for test plan changes- Since:
- 2.12
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceUndoHistory.HistoryListenerInterface to be implemented by components interested in UndoHistory
-
Constructor Summary
Constructors Constructor Description UndoHistory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(JMeterTreeModel treeModel, String comment)Add tree model copy to the historybooleancanRedo()booleancanUndo()voidclear()Clears the undo historyvoidmoveInHistory(int offset, JMeterTreeModel acceptorModel)Goes through undo history, changing GUIvoidregisterHistoryListener(UndoHistory.HistoryListener listener)Register HistoryListenervoidtreeNodesChanged(TreeModelEvent tme)Record the changes in the node as the undo stepvoidtreeNodesInserted(TreeModelEvent tme)Record adding nodes as the undo stepvoidtreeNodesRemoved(TreeModelEvent tme)Record deleting nodes as the undo stepvoidtreeStructureChanged(TreeModelEvent tme)Record some other change
-
-
-
Method Detail
-
clear
public void clear()
Clears the undo history
-
add
public void add(JMeterTreeModel treeModel, String comment)
Add tree model copy to the historyThis method relies on the rule that the record in history made AFTER change has been made to test plan
- Parameters:
treeModel- JMeterTreeModelcomment- String
-
moveInHistory
public void moveInHistory(int offset, JMeterTreeModel acceptorModel)Goes through undo history, changing GUI- Parameters:
offset- the direction to go to, usually -1 for undo or 1 for redoacceptorModel- TreeModel to accept the changes
-
canRedo
public boolean canRedo()
- Returns:
- true if remaing items
-
canUndo
public boolean canUndo()
- Returns:
- true if not at first element
-
treeNodesChanged
public void treeNodesChanged(TreeModelEvent tme)
Record the changes in the node as the undo step- Specified by:
treeNodesChangedin interfaceTreeModelListener- Parameters:
tme-TreeModelEventwith event details
-
treeNodesInserted
public void treeNodesInserted(TreeModelEvent tme)
Record adding nodes as the undo step- Specified by:
treeNodesInsertedin interfaceTreeModelListener- Parameters:
tme-TreeModelEventwith event details
-
treeNodesRemoved
public void treeNodesRemoved(TreeModelEvent tme)
Record deleting nodes as the undo step- Specified by:
treeNodesRemovedin interfaceTreeModelListener- Parameters:
tme-TreeModelEventwith event details
-
treeStructureChanged
public void treeStructureChanged(TreeModelEvent tme)
Record some other change- Specified by:
treeStructureChangedin interfaceTreeModelListener- Parameters:
tme-TreeModelEventwith event details
-
registerHistoryListener
public void registerHistoryListener(UndoHistory.HistoryListener listener)
Register HistoryListener- Parameters:
listener- to add to our listeners
-
-