Package org.apache.jmeter.gui

Examples of org.apache.jmeter.gui.JMeterGUIComponent


                if (name.endsWith("JMeterTreeNode") // $NON-NLS-1$
                        || name.endsWith("TestBeanGUI")) {// $NON-NLS-1$
                    continue;// Don't try to instantiate these
                }

                JMeterGUIComponent item;
                try {
                    Class c = Class.forName(name);
                    if (TestBean.class.isAssignableFrom(c)) {
                        item = new TestBeanGUI(c);
                    } else {
                        item = (JMeterGUIComponent) c.newInstance();
                    }
                } catch (NoClassDefFoundError e) {
                    log.warn("Missing jar? Could not create " + name + ". " + e);
                    continue;
                } catch (Throwable e) {
                    log.warn("Could not instantiate " + name, e);
                    continue;
                }
                if (elementsToSkip.contains(name) || elementsToSkip.contains(item.getStaticLabel())) {
                    log.info("Skipping " + name);
                    continue;
                } else {
                    elementsToSkip.add(name);
                }
                Collection categories = item.getMenuCategories();
                if (categories == null) {
                    log.debug(name + " participates in no menus.");
                    continue;
                }
                if (categories.contains(TIMERS)) {
View Full Code Here


        }
        component.setProperty(TestElement.GUI_CLASS, NameUpdater
                .getCurrentName(component
                        .getPropertyAsString(TestElement.GUI_CLASS)));
        ReportGuiPackage.getInstance().updateCurrentNode();
        JMeterGUIComponent guicomp = ReportGuiPackage.getInstance().getGui(component);
        guicomp.configure(component);
        guicomp.modifyTestElement(component);
        ReportGuiPackage.getInstance().getCurrentGui(); // put the gui object back
        // to the way it was.
        ReportTreeNode newNode = new ReportTreeNode(component, this);

        // This check the state of the TestElement and if returns false it
View Full Code Here

    public Set getActionNames() {
        return commands;
    }

    public void doAction(ActionEvent e) throws IllegalUserActionException {
        JMeterGUIComponent component = null;
        JComponent comp = null;
        if (!commands.contains(e.getActionCommand())) {
            throw new IllegalUserActionException("Invalid user command:" + e.getActionCommand());
        }
        if (e.getActionCommand().equals(SAVE_GRAPHICS)) {
View Full Code Here

    public Set getActionNames() {
        return commands;
    }

    public void doAction(ActionEvent e) throws IllegalUserActionException {
        JMeterGUIComponent component = null;
        JComponent comp = null;
        if (!commands.contains(e.getActionCommand())) {
            throw new IllegalUserActionException("Invalid user command:" + e.getActionCommand());
        }
        if (e.getActionCommand().equals(ActionNames.SAVE_GRAPHICS)) {
View Full Code Here

        GuiPackage guiPackage = GuiPackage.getInstance();
        if (guiPackage != null) {
            // The node can be added in non GUI mode at startup
            guiPackage.updateCurrentNode();
            JMeterGUIComponent guicomp = guiPackage.getGui(component);
            guicomp.configure(component);
            guicomp.modifyTestElement(component);
            guiPackage.getCurrentGui(); // put the gui object back
                                        // to the way it was.
        }
        JMeterTreeNode newNode = new JMeterTreeNode(component, this);
View Full Code Here

    public void doAction(ActionEvent e) {
        GuiPackage guiPackage = GuiPackage.getInstance();
        final String actionCommand = e.getActionCommand();
        if (actionCommand.equals(ActionNames.CLEAR)) {
            JMeterGUIComponent guiComp = guiPackage.getCurrentGui();
            if (guiComp instanceof Clearable){
                ((Clearable) guiComp).clearData();
            }
        } else if (actionCommand.equals(ActionNames.RESET_GUI)) {
            JMeterGUIComponent guiComp = guiPackage.getCurrentGui();
            guiComp.clearGui();
        } else {
            Iterator iter = guiPackage.getTreeModel().getNodesOfType(Clearable.class).iterator();
            while (iter.hasNext()) {
                JMeterTreeNode node = null;
                JMeterGUIComponent guiComp = null;
                try {
                    Object next = iter.next();
                    node = (JMeterTreeNode) next;
                    guiComp = guiPackage.getGui(node.getTestElement());
                    if (guiComp instanceof Clearable){
View Full Code Here

    public void testGUIComponents() throws Exception
    {
        Iterator iter = getObjects(JMeterGUIComponent.class).iterator();
        while (iter.hasNext())
        {
            JMeterGUIComponent item = (JMeterGUIComponent) iter.next();
            if (item instanceof JMeterTreeNode)
            {
                continue;
            }
            assertEquals(
                "Failed on " + item.getClass().getName(),
                item.getStaticLabel(),
                item.getName());
            TestElement el = item.createTestElement();
            assertEquals(
                "GUI-CLASS: Failed on " + item.getClass().getName(),
                item.getClass().getName(),
                el.getPropertyAsString(TestElement.GUI_CLASS));
            assertEquals(
                "NAME: Failed on " + item.getClass().getName(),
                item.getName(),
                el.getPropertyAsString(TestElement.NAME));
            assertEquals(
                "TEST-CLASS: Failed on " + item.getClass().getName(),
                el.getClass().getName(),
                el.getPropertyAsString(TestElement.TEST_CLASS));
            TestElement el2 = item.createTestElement();
            el.setProperty(TestElement.NAME, "hey, new name!:");
            el.setProperty("NOT", "Shouldn't be here");
            if (!(item instanceof UnsharedComponent))
            {
                assertEquals(
                    "GUI-CLASS: Failed on " + item.getClass().getName(),
                    "",
                    el2.getPropertyAsString("NOT"));
            }
            log.debug("Saving element: " + el.getClass());
            el =
                SaveService.createTestElement(
                    SaveService.getConfigForTestElement(null, el));
            log.debug("Successfully saved");
            item.configure(el);
            assertEquals(
                "CONFIGURE-TEST: Failed on " + item.getClass().getName(),
                el.getPropertyAsString(TestElement.NAME),
                item.getName());
            item.modifyTestElement(el2);
            assertEquals(
                "Modify Test: Failed on " + item.getClass().getName(),
                "hey, new name!:",
                el2.getPropertyAsString(TestElement.NAME));
        }
    }
View Full Code Here

    public void doAction(ActionEvent e)
    {
        GuiPackage guiPackage = GuiPackage.getInstance();
        if (e.getActionCommand().equals(CLEAR))
        {
            JMeterGUIComponent model = guiPackage.getCurrentGui();
            try
            {
                ((Clearable) model).clear();
            }
            catch (Throwable ex)
View Full Code Here

        Iterator iter = new LinkedList(tree.list()).iterator();
        while (iter.hasNext())
        {
            TestElement item = (TestElement) iter.next();
            convertTree(tree.getTree(item));
            JMeterGUIComponent comp = generateGUIComponent(item);
            tree.replace(item, comp);
        }
    }
View Full Code Here

    }

    private JMeterGUIComponent generateGUIComponent(TestElement item)
        throws Exception
    {
        JMeterGUIComponent gui = null;
        try
        {
            gui =
                (JMeterGUIComponent) Class
                    .forName(item.getPropertyAsString(TestElement.GUI_CLASS))
                    .newInstance();
        }
        catch (Exception e)
        {
            log.warn("Couldn't get gui for " + item, e);
            gui = new WorkBenchGui();
        }
        gui.configure(item);
        return gui;
    }
View Full Code Here

TOP

Related Classes of org.apache.jmeter.gui.JMeterGUIComponent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.