Search in sources :

Example 31 with GuiPackage

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

the class CollapseExpand method doAction.

/**
     * This method performs the actual command processing.
     *
     * @param e
     *            the generic UI action event
     */
@Override
public void doAction(ActionEvent e) {
    boolean collapse = ActionNames.COLLAPSE_ALL.equals(e.getActionCommand());
    GuiPackage guiInstance = GuiPackage.getInstance();
    JTree jTree = guiInstance.getMainFrame().getTree();
    if (collapse) {
        for (int i = jTree.getRowCount() - 1; i >= 0; i--) {
            jTree.collapseRow(i);
        }
        return;
    }
    for (int i = 0; i < jTree.getRowCount(); i++) {
        jTree.expandRow(i);
    }
}
Also used : JTree(javax.swing.JTree) GuiPackage(org.apache.jmeter.gui.GuiPackage)

Example 32 with GuiPackage

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

the class Duplicate method doAction.

@Override
public void doAction(ActionEvent e) {
    GuiPackage instance = GuiPackage.getInstance();
    JMeterTreeListener treeListener = instance.getTreeListener();
    JMeterTreeNode[] copiedNodes = Copy.cloneTreeNodes(treeListener.getSelectedNodes());
    JMeterTreeNode currentNode = treeListener.getCurrentNode();
    JMeterTreeNode parentNode = (JMeterTreeNode) currentNode.getParent();
    JMeterTreeModel treeModel = instance.getTreeModel();
    for (JMeterTreeNode copiedNode : copiedNodes) {
        int index = parentNode.getIndex(currentNode) + 1;
        treeModel.insertNodeInto(copiedNode, parentNode, index);
    }
    instance.getMainFrame().repaint();
}
Also used : JMeterTreeModel(org.apache.jmeter.gui.tree.JMeterTreeModel) GuiPackage(org.apache.jmeter.gui.GuiPackage) JMeterTreeListener(org.apache.jmeter.gui.tree.JMeterTreeListener) JMeterTreeNode(org.apache.jmeter.gui.tree.JMeterTreeNode)

Example 33 with GuiPackage

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

the class EditCommand method doAction.

@Override
public void doAction(ActionEvent e) {
    GuiPackage guiPackage = GuiPackage.getInstance();
    JMeterGUIComponent currentGui = guiPackage.getCurrentGui();
    guiPackage.getMainFrame().setMainPanel((javax.swing.JComponent) currentGui);
    guiPackage.getMainFrame().setEditMenu(guiPackage.getTreeListener().getCurrentNode().createPopupMenu());
    guiPackage.getMainFrame().setFileLoadEnabled(true);
    guiPackage.getMainFrame().setFileSaveEnabled(true);
}
Also used : GuiPackage(org.apache.jmeter.gui.GuiPackage) JMeterGUIComponent(org.apache.jmeter.gui.JMeterGUIComponent)

Example 34 with GuiPackage

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

the class AddParent method doAction.

@Override
public void doAction(ActionEvent e) {
    String name = ((Component) e.getSource()).getName();
    GuiPackage guiPackage = GuiPackage.getInstance();
    try {
        guiPackage.updateCurrentNode();
        TestElement controller = guiPackage.createTestElement(name);
        addParentToTree(controller);
    } catch (Exception err) {
        log.error("Exception while adding a TestElement.", err);
    }
}
Also used : GuiPackage(org.apache.jmeter.gui.GuiPackage) Component(java.awt.Component) TestElement(org.apache.jmeter.testelement.TestElement)

Example 35 with GuiPackage

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

the class SSLManager method getPassword.

/*
     * The password can be defined as a property; this dialogue is provided to allow it
     * to be entered at run-time.
     *
     * However, this does not gain much, as the dialogue does not (yet) support hidden input ...
     *
    */
private String getPassword() {
    String password = this.defaultpw;
    if (null == password) {
        final GuiPackage guiInstance = GuiPackage.getInstance();
        if (guiInstance != null) {
            synchronized (this) {
                // TODO is sync really needed?
                this.defaultpw = JOptionPane.showInputDialog(guiInstance.getMainFrame(), // $NON-NLS-1$
                JMeterUtils.getResString("ssl_pass_prompt"), // $NON-NLS-1$
                JMeterUtils.getResString("ssl_pass_title"), JOptionPane.QUESTION_MESSAGE);
                System.setProperty(KEY_STORE_PASSWORD, this.defaultpw);
                password = this.defaultpw;
            }
        } else {
            log.warn("No password provided, and no GUI present so cannot prompt");
        }
    }
    return password;
}
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