Search in sources :

Example 46 with GuiPackage

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

the class JMeterThread method threadStarted.

private void threadStarted() {
    JMeterContextService.incrNumberOfThreads();
    threadGroup.incrNumberOfThreads();
    GuiPackage gp = GuiPackage.getInstance();
    if (gp != null) {
        // check there is a GUI
        gp.getMainFrame().updateCounts();
    }
    ThreadListenerTraverser startup = new ThreadListenerTraverser(true);
    // call ThreadListener.threadStarted()
    testTree.traverse(startup);
}
Also used : GuiPackage(org.apache.jmeter.gui.GuiPackage)

Example 47 with GuiPackage

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

the class RemoteThreadsListenerImpl method threadFinished.

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

Example 48 with GuiPackage

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

the class JMeterMenuBar method makeOptionsMenu.

private void makeOptionsMenu() {
    // OPTIONS MENU
    //$NON-NLS-1$
    optionsMenu = makeMenuRes("option", 'O');
    //$NON-NLS-1$
    JMenuItem functionHelper = makeMenuItemRes("function_dialog_menu_item", 'F', ActionNames.FUNCTIONS, KeyStrokes.FUNCTIONS);
    //$NON-NLS-1$
    lafMenu = makeMenuRes("appearance", 'L');
    for (LookAndFeelInfo laf : getAllLAFs()) {
        JMenuItem menuItem = new JMenuItem(laf.getName());
        menuItem.addActionListener(ActionRouter.getInstance());
        menuItem.setActionCommand(ActionNames.LAF_PREFIX + laf.getClassName());
        // show the classname to the user
        menuItem.setToolTipText(laf.getClassName());
        lafMenu.add(menuItem);
    }
    optionsMenu.add(functionHelper);
    optionsMenu.add(lafMenu);
    //$NON-NLS-1$
    JCheckBoxMenuItem menuLoggerPanel = makeCheckBoxMenuItemRes("menu_logger_panel", ActionNames.LOGGER_PANEL_ENABLE_DISABLE);
    GuiPackage guiInstance = GuiPackage.getInstance();
    if (guiInstance != null) {
        //avoid error in ant task tests (good way?)
        guiInstance.setMenuItemLoggerPanel(menuLoggerPanel);
    }
    optionsMenu.add(menuLoggerPanel);
    //$NON-NLS-1$
    JMenu menuLoggerLevel = makeMenuRes("menu_logger_level");
    JMenuItem menuItem;
    String levelString;
    for (Level level : Level.values()) {
        levelString = level.toString();
        menuItem = new JMenuItem(levelString);
        menuItem.addActionListener(ActionRouter.getInstance());
        menuItem.setActionCommand(ActionNames.LOG_LEVEL_PREFIX + levelString);
        // show the classname to the user
        menuItem.setToolTipText(levelString);
        menuLoggerLevel.add(menuItem);
    }
    optionsMenu.add(menuLoggerLevel);
    if (SSLManager.isSSLSupported()) {
        //$NON-NLS-1$
        sslManager = makeMenuItemRes("sslmanager", 'S', ActionNames.SSL_MANAGER, KeyStrokes.SSL_MANAGER);
        optionsMenu.add(sslManager);
    }
    optionsMenu.add(makeLanguageMenu());
    //$NON-NLS-1$
    JMenuItem collapse = makeMenuItemRes("menu_collapse_all", ActionNames.COLLAPSE_ALL, KeyStrokes.COLLAPSE_ALL);
    optionsMenu.add(collapse);
    //$NON-NLS-1$
    JMenuItem expand = makeMenuItemRes("menu_expand_all", ActionNames.EXPAND_ALL, KeyStrokes.EXPAND_ALL);
    optionsMenu.add(expand);
    //$NON-NLS-1$
    JMenuItem zoomIn = makeMenuItemRes("menu_zoom_in", ActionNames.ZOOM_IN);
    optionsMenu.add(zoomIn);
    //$NON-NLS-1$
    JMenuItem zoomOut = makeMenuItemRes("menu_zoom_out", ActionNames.ZOOM_OUT);
    optionsMenu.add(zoomOut);
    addPluginsMenuItems(optionsMenu, menuCreators, MENU_LOCATION.OPTIONS);
}
Also used : LookAndFeelInfo(javax.swing.UIManager.LookAndFeelInfo) GuiPackage(org.apache.jmeter.gui.GuiPackage) Level(org.slf4j.event.Level) JMenuItem(javax.swing.JMenuItem) JCheckBoxMenuItem(javax.swing.JCheckBoxMenuItem) JMenu(javax.swing.JMenu)

Example 49 with GuiPackage

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

the class ProxyControlGui method reinitializeTargetCombo.

private void reinitializeTargetCombo() {
    log.debug("Reinitializing target combo");
    // Stop action notifications while we shuffle this around:
    targetNodes.removeActionListener(this);
    targetNodesModel.removeAllElements();
    GuiPackage gp = GuiPackage.getInstance();
    JMeterTreeNode root;
    if (gp != null) {
        root = (JMeterTreeNode) GuiPackage.getInstance().getTreeModel().getRoot();
        targetNodesModel.addElement(// $NON-NLS-1$
        new TreeNodeWrapper(null, JMeterUtils.getResString("use_recording_controller")));
        buildNodesModel(root, "", 0);
    }
    TreeNodeWrapper choice = null;
    for (int i = 0; i < targetNodesModel.getSize(); i++) {
        choice = (TreeNodeWrapper) targetNodesModel.getElementAt(i);
        log.debug("Selecting item " + choice + " for model " + model + " in " + this);
        if (// .equals caused NPE
        choice.getTreeNode() == model.getTarget()) {
            break;
        }
    }
    // Reinstate action notifications:
    targetNodes.addActionListener(this);
    // Set the current value:
    targetNodesModel.setSelectedItem(choice);
    log.debug("Reinitialization complete");
}
Also used : GuiPackage(org.apache.jmeter.gui.GuiPackage) TreeNodeWrapper(org.apache.jmeter.control.gui.TreeNodeWrapper) JMeterTreeNode(org.apache.jmeter.gui.tree.JMeterTreeNode)

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