Search in sources :

Example 21 with GuiPackage

use of org.apache.jmeter.gui.GuiPackage in project jmeter by apache.

the class AddThinkTimeBetweenEachStep method doAction.

@Override
public void doAction(ActionEvent e) {
    GuiPackage guiPackage = GuiPackage.getInstance();
    JMeterTreeNode currentNode = guiPackage.getTreeListener().getCurrentNode();
    if (!(currentNode.getUserObject() instanceof Controller || currentNode.getUserObject() instanceof ThreadGroup)) {
        Toolkit.getDefaultToolkit().beep();
        return;
    }
    try {
        addThinkTimeToChildren(guiPackage, currentNode);
    } catch (Exception err) {
        Toolkit.getDefaultToolkit().beep();
        log.error("Failed to add think times", err);
        JMeterUtils.reportErrorToUser("Failed to add think times", err);
    }
}
Also used : GuiPackage(org.apache.jmeter.gui.GuiPackage) JMeterTreeNode(org.apache.jmeter.gui.tree.JMeterTreeNode) ThreadGroup(org.apache.jmeter.threads.ThreadGroup) Controller(org.apache.jmeter.control.Controller) IllegalUserActionException(org.apache.jmeter.exceptions.IllegalUserActionException)

Example 22 with GuiPackage

use of org.apache.jmeter.gui.GuiPackage in project jmeter by apache.

the class ApplyNamingConvention method doAction.

@Override
public void doAction(ActionEvent e) {
    GuiPackage guiPackage = GuiPackage.getInstance();
    JMeterTreeNode currentNode = guiPackage.getTreeListener().getCurrentNode();
    if (!(currentNode.getUserObject() instanceof Controller)) {
        Toolkit.getDefaultToolkit().beep();
        return;
    }
    try {
        applyNamingPolicyToCurrentNode(guiPackage, currentNode);
    } catch (Exception err) {
        Toolkit.getDefaultToolkit().beep();
        log.error("Failed to apply naming policy", err);
        JMeterUtils.reportErrorToUser("Failed to apply naming policy", err);
    }
}
Also used : GuiPackage(org.apache.jmeter.gui.GuiPackage) JMeterTreeNode(org.apache.jmeter.gui.tree.JMeterTreeNode) Controller(org.apache.jmeter.control.Controller)

Example 23 with GuiPackage

use of org.apache.jmeter.gui.GuiPackage in project jmeter by apache.

the class ChangeParent method doAction.

@Override
public void doAction(ActionEvent e) {
    String name = ((Component) e.getSource()).getName();
    GuiPackage guiPackage = GuiPackage.getInstance();
    JMeterTreeNode currentNode = guiPackage.getTreeListener().getCurrentNode();
    if (!(currentNode.getUserObject() instanceof Controller)) {
        Toolkit.getDefaultToolkit().beep();
        return;
    }
    try {
        guiPackage.updateCurrentNode();
        TestElement controller = guiPackage.createTestElement(name);
        changeParent(controller, guiPackage, currentNode);
    } catch (Exception err) {
        Toolkit.getDefaultToolkit().beep();
        log.error("Failed to change parent", err);
    }
}
Also used : GuiPackage(org.apache.jmeter.gui.GuiPackage) JMeterTreeNode(org.apache.jmeter.gui.tree.JMeterTreeNode) JMeterGUIComponent(org.apache.jmeter.gui.JMeterGUIComponent) Component(java.awt.Component) Controller(org.apache.jmeter.control.Controller) TestElement(org.apache.jmeter.testelement.TestElement)

Example 24 with GuiPackage

use of org.apache.jmeter.gui.GuiPackage in project jmeter by apache.

the class RemoteThreadsListenerImpl method threadStarted.

/**
     * 
     * @see RemoteThreadsListener#threadStarted()
     */
@Override
public void threadStarted() {
    JMeterContextService.incrNumberOfThreads();
    GuiPackage gp = GuiPackage.getInstance();
    if (gp != null) {
        // check there is a GUI
        gp.getMainFrame().updateCounts();
    }
    for (RemoteThreadsLifeCycleListener listener : listeners) {
        listener.threadNumberIncreased(JMeterContextService.getNumberOfThreads());
    }
}
Also used : GuiPackage(org.apache.jmeter.gui.GuiPackage)

Example 25 with GuiPackage

use of org.apache.jmeter.gui.GuiPackage in project jmeter by apache.

the class HttpMirrorControl method stopHttpMirror.

public void stopHttpMirror() {
    if (server != null) {
        server.stopServer();
        GuiPackage instance = GuiPackage.getInstance();
        if (instance != null) {
            instance.unregister(server);
        }
        try {
            // wait for server to stop
            server.join(1000);
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
        }
        server = null;
    }
}
Also used : GuiPackage(org.apache.jmeter.gui.GuiPackage)

Aggregations

GuiPackage (org.apache.jmeter.gui.GuiPackage)49 JMeterTreeNode (org.apache.jmeter.gui.tree.JMeterTreeNode)21 ActionEvent (java.awt.event.ActionEvent)9 JTree (javax.swing.JTree)8 TreePath (javax.swing.tree.TreePath)7 JMeterTreeModel (org.apache.jmeter.gui.tree.JMeterTreeModel)6 TestElement (org.apache.jmeter.testelement.TestElement)5 HashTree (org.apache.jorphan.collections.HashTree)5 IllegalUserActionException (org.apache.jmeter.exceptions.IllegalUserActionException)4 JMeterGUIComponent (org.apache.jmeter.gui.JMeterGUIComponent)4 Controller (org.apache.jmeter.control.Controller)3 Searchable (org.apache.jmeter.gui.Searchable)3 Component (java.awt.Component)2 File (java.io.File)2 HashSet (java.util.HashSet)2 ListedHashTree (org.apache.jorphan.collections.ListedHashTree)2 ConversionException (com.thoughtworks.xstream.converters.ConversionException)1 HeadlessException (java.awt.HeadlessException)1 DataFlavor (java.awt.datatransfer.DataFlavor)1 Transferable (java.awt.datatransfer.Transferable)1