Apache JMeter

org.apache.jmeter.gui
Class UndoHistory

java.lang.Object
  extended by 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
static interface UndoHistory.HistoryListener
          Interface to be implemented by components interested in UndoHistory
 
Constructor Summary
UndoHistory()
           
 
Method Summary
 void add(JMeterTreeModel treeModel, String comment)
          Add tree model copy to the history

This method relies on the rule that the record in history made AFTER change has been made to test plan

 boolean canRedo()
           
 boolean canUndo()
           
 void clear()
          Clears the undo history
 void moveInHistory(int offset, JMeterTreeModel acceptorModel)
          Goes through undo history, changing GUI
 void registerHistoryListener(UndoHistory.HistoryListener listener)
          Register HistoryListener
 void treeNodesChanged(TreeModelEvent tme)
          Record the changes in the node as the undo step
 void treeNodesInserted(TreeModelEvent tme)
          Record adding nodes as the undo step
 void treeNodesRemoved(TreeModelEvent tme)
          Record deleting nodes as the undo step
 void treeStructureChanged(TreeModelEvent tme)
          Record some other change
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UndoHistory

public UndoHistory()
Method Detail

clear

public void clear()
Clears the undo history


add

public void add(JMeterTreeModel treeModel,
                String comment)
Add tree model copy to the history

This method relies on the rule that the record in history made AFTER change has been made to test plan

Parameters:
treeModel - JMeterTreeModel
comment - 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 redo
acceptorModel - 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:
treeNodesChanged in interface TreeModelListener
Parameters:
tme -

treeNodesInserted

public void treeNodesInserted(TreeModelEvent tme)
Record adding nodes as the undo step

Specified by:
treeNodesInserted in interface TreeModelListener
Parameters:
tme -

treeNodesRemoved

public void treeNodesRemoved(TreeModelEvent tme)
Record deleting nodes as the undo step

Specified by:
treeNodesRemoved in interface TreeModelListener
Parameters:
tme -

treeStructureChanged

public void treeStructureChanged(TreeModelEvent tme)
Record some other change

Specified by:
treeStructureChanged in interface TreeModelListener
Parameters:
tme -

registerHistoryListener

public void registerHistoryListener(UndoHistory.HistoryListener listener)
Register HistoryListener

Parameters:
listener -

Apache JMeter

Copyright © 1998-2014 Apache Software Foundation. All Rights Reserved.