public final class GuiPackage extends Object implements LocaleChangeListener, UndoHistory.HistoryListener
getInstance()
and then use
it to query the GUI about it's state. When actions, for instance, need to
affect the GUI, they typically use GuiPackage to get access to different
parts of the GUI.Modifier and Type | Method and Description |
---|---|
HashTree |
addSubTree(HashTree subTree)
Add a subtree to the currently selected node.
|
void |
addTestPlanListener(TestPlanListener listener)
Adds a test plan listener.
|
void |
beginUndoTransaction()
Begin a group of actions modeled as 1 undo
|
boolean |
canRedo() |
boolean |
canUndo() |
void |
clearTestPlan()
Clears the test plan and associated objects.
|
void |
clearTestPlan(TestElement element)
Clears the test plan element and associated object
|
TestElement |
createTestElement(Class<?> guiClass,
Class<?> testClass)
Create a TestElement corresponding to the specified GUI class.
|
TestElement |
createTestElement(String objClass)
Create a TestElement for a GUI or TestBean class.
|
void |
displayPopUp(Component invoker,
MouseEvent e,
JPopupMenu popup)
Display the specified popup menu at the location specified by a mouse
event with the specified source component.
|
void |
displayPopUp(MouseEvent e,
JPopupMenu popup)
Display the specified popup menu with the source component and location
from the specified mouse event.
|
void |
endUndoTransaction()
End a group of actions modeled as 1 undo
|
TestElement |
getCurrentElement() |
JMeterGUIComponent |
getCurrentGui()
Convenience method for grabbing the gui for the current node.
|
JMeterTreeNode |
getCurrentNode() |
HashTree |
getCurrentSubTree()
Get the currently selected subtree.
|
JMeterGUIComponent |
getGui(TestElement node)
Get a JMeterGUIComponent for the specified test element.
|
JMeterGUIComponent |
getGui(TestElement node,
Class<?> guiClass,
Class<?> testClass)
Get a JMeterGUIComponent for the specified test element.
|
static GuiPackage |
getInstance()
Retrieve the singleton GuiPackage instance.
|
GuiLogEventBus |
getLogEventBus()
Return
GuiLogEventBus . |
LoggerPanel |
getLoggerPanel() |
MainFrame |
getMainFrame()
Get the main JMeter frame.
|
JToolBar |
getMainToolbar()
Get the main JMeter toolbar.
|
JCheckBoxMenuItem |
getMenuItemLoggerPanel()
Get the menu item LoggerPanel.
|
JCheckBoxMenuItem |
getMenuItemSaveBeforeRunPanel()
Get the menu item SaveBeforeRunPanel.
|
TreeNodeNamingPolicy |
getNamingPolicy() |
JMeterTreeNode |
getNodeOf(TestElement userObject)
Find the JMeterTreeNode for a certain TestElement object.
|
ValueReplacer |
getReplacer()
Get a ValueReplacer for the test tree.
|
List<Stoppable> |
getStoppables() |
String |
getTestPlanFile() |
JMeterTreeListener |
getTreeListener()
Get the listener for JMeter's test tree.
|
JMeterTreeModel |
getTreeModel()
Get the model for JMeter's test tree.
|
static void |
initInstance(JMeterTreeListener listener,
JMeterTreeModel treeModel)
When GuiPackage is requested for the first time, it should be given
handles to JMeter's Tree Listener and TreeModel.
|
void |
invalidateCachedUi() |
boolean |
isDirty()
Retrieves the state of the 'dirty' property, a flag that indicates if
there are test tree components that have been modified since they were
last saved.
|
void |
localeChanged(LocaleChangeEvent event) |
void |
notifyChangeInHistory(UndoHistory history)
Called when history changes, it updates toolbar
|
void |
redo()
Navigate forward through undo history
|
void |
refreshCurrentGui()
Refresh GUI from node state.
|
void |
register(Stoppable stoppable)
Register process to stop on reload
|
void |
registerAsListener()
Register as listener of:
- UndoHistory
- Locale Changes
|
void |
removeNode(TestElement node)
Remove a test element from the tree.
|
void |
removeTestPlanListener(TestPlanListener listener)
Removes a test plan listener.
|
void |
setDirty(boolean dirty)
The dirty property is a flag that indicates whether there are parts of
JMeter's test tree that the user has not saved since last modification.
|
void |
setLoggerPanel(LoggerPanel loggerPanel) |
void |
setMainFrame(MainFrame newMainFrame)
Set the main JMeter frame.
|
void |
setMainToolbar(JToolBar newToolbar)
Set the main JMeter toolbar.
|
void |
setMenuItemLoggerPanel(JCheckBoxMenuItem menuItemLoggerPanel)
Set the menu item LoggerPanel.
|
void |
setMenuItemSaveBeforeRunPanel(JCheckBoxMenuItem menuItemSaveBeforeRunPanel)
Set the menu item SaveBeforeRunPanel.
|
void |
setSaveBeforeRunByPreference(boolean saveBeforeRun)
Should Save Before Run by Preference Only
|
void |
setTestPlanFile(String f)
Sets the filepath of the current test plan.
|
boolean |
shouldSaveBeforeRun()
Should Save Before Run
Decide by Preference and if not exists by Property
|
boolean |
shouldSaveBeforeRunByPreference()
Should Save Before Run by Preference Only
|
static void |
showErrorMessage(String message,
String title) |
static void |
showInfoMessage(String message,
String title) |
static void |
showMessage(String message,
String title,
int type) |
static void |
showWarningMessage(String message,
String title) |
void |
undo()
Navigate back through undo history
|
void |
unregister(Stoppable stoppableToUnregister)
Unregister stoppable
|
void |
updateCurrentGui()
Update the GUI for the currently selected node.
|
void |
updateCurrentNode()
This method should be called in order for GuiPackage to change the
current node.
|
void |
updateUIForHiddenComponents()
Tells hidden GUI components to update UIs when they are shown.
|
public static GuiPackage getInstance()
public void registerAsListener()
public static void initInstance(JMeterTreeListener listener, JMeterTreeModel treeModel)
listener
- the TreeListener for JMeter's test treetreeModel
- the model for JMeter's test treepublic JMeterGUIComponent getGui(TestElement node)
UnsharedComponent
, that shared component will be
returned. Otherwise, a new instance of the component will be created. The
TestElement's GUI_CLASS property will be used to determine the
appropriate type of GUI component to use.node
- the test element which this GUI is being created forpublic JMeterGUIComponent getGui(TestElement node, Class<?> guiClass, Class<?> testClass)
UnsharedComponent
, that shared component will be
returned. Otherwise, a new instance of the component will be created.node
- the test element which this GUI is being created forguiClass
- the fully qualified class name of the GUI component which will
be created if it doesn't already existtestClass
- the fully qualified class name of the test elements which have
to be edited by the returned GUI component@API(since="5.3", status=MAINTAINED) public void removeNode(TestElement node)
node
- the test element being removedpublic JMeterGUIComponent getCurrentGui()
public JMeterTreeNode getNodeOf(TestElement userObject)
userObject
- the test element to search forpublic TestElement createTestElement(Class<?> guiClass, Class<?> testClass)
guiClass
- the fully qualified class name of the GUI component or a
TestBean class for TestBeanGUIs.testClass
- the fully qualified class name of the test elements edited by
this GUI component.public TestElement createTestElement(String objClass)
This is a utility method to help actions do with one single String parameter.
objClass
- the fully qualified class name of the GUI component or of the
TestBean subclass for which a TestBeanGUI is wanted.public void updateCurrentGui()
public void refreshCurrentGui()
updateCurrentGui()
public void updateCurrentNode()
public JMeterTreeNode getCurrentNode()
public TestElement getCurrentElement()
public void setDirty(boolean dirty)
dirty
- the new value of the dirty flagpublic boolean isDirty()
public HashTree addSubTree(HashTree subTree) throws IllegalUserActionException
subTree
- the subtree to add.IllegalUserActionException
- if a subtree cannot be added to the currently selected nodepublic HashTree getCurrentSubTree()
public JMeterTreeModel getTreeModel()
public ValueReplacer getReplacer()
public void setMainFrame(MainFrame newMainFrame)
newMainFrame
- the new JMeter main framepublic MainFrame getMainFrame()
public JMeterTreeListener getTreeListener()
public void setMainToolbar(JToolBar newToolbar)
newToolbar
- the new JMeter main toolbarpublic JToolBar getMainToolbar()
public void displayPopUp(MouseEvent e, JPopupMenu popup)
e
- the mouse event causing this popup to be displayedpopup
- the popup menu to displaypublic void displayPopUp(Component invoker, MouseEvent e, JPopupMenu popup)
invoker
- the source componente
- the mouse event causing this popup to be displayedpopup
- the popup menu to displaypublic void localeChanged(LocaleChangeEvent event)
localeChanged
in interface LocaleChangeListener
public void invalidateCachedUi()
@API(since="5.3", status=EXPERIMENTAL) public void updateUIForHiddenComponents()
When Look and Feel (or zoom scaling) changes, only visible components are updated. The hidden ones are updated as they are shown.
public void setTestPlanFile(String f)
f
- The filepath of the current test planpublic String getTestPlanFile()
public void clearTestPlan()
public void clearTestPlan(TestElement element)
element
- to clearpublic void unregister(Stoppable stoppableToUnregister)
stoppableToUnregister
- Stoppable to unregisterpublic void register(Stoppable stoppable)
stoppable
- The Stoppable
to be registeredpublic void setMenuItemLoggerPanel(JCheckBoxMenuItem menuItemLoggerPanel)
menuItemLoggerPanel
- The menu item LoggerPanelpublic JCheckBoxMenuItem getMenuItemLoggerPanel()
public void setMenuItemSaveBeforeRunPanel(JCheckBoxMenuItem menuItemSaveBeforeRunPanel)
menuItemSaveBeforeRunPanel
- The menu item SaveBeforeRunPanelpublic JCheckBoxMenuItem getMenuItemSaveBeforeRunPanel()
public void setLoggerPanel(LoggerPanel loggerPanel)
loggerPanel
- LoggerPanelpublic LoggerPanel getLoggerPanel()
public void undo()
public void redo()
public boolean canRedo()
public boolean canUndo()
public void notifyChangeInHistory(UndoHistory history)
notifyChangeInHistory
in interface UndoHistory.HistoryListener
public TreeNodeNamingPolicy getNamingPolicy()
TreeNodeNamingPolicy
public GuiLogEventBus getLogEventBus()
GuiLogEventBus
.GuiLogEventBus
public void beginUndoTransaction()
public void endUndoTransaction()
public boolean shouldSaveBeforeRunByPreference()
public void setSaveBeforeRunByPreference(boolean saveBeforeRun)
saveBeforeRun
- booleanpublic boolean shouldSaveBeforeRun()
public void addTestPlanListener(TestPlanListener listener)
listener
- to addpublic void removeTestPlanListener(TestPlanListener listener)
listener
- to removeCopyright © 1998-2019 Apache Software Foundation. All Rights Reserved.