Examples of MComponent


Examples of net.sourceforge.marathon.component.MComponent

            if (!componentCanUse(current, rprops)) {
                continue;
            }
            boolean matched = false;
            for (Component c : components) {
                MComponent wrapper = new MComponent(c, windowMonitor);
                if (c == component)
                    continue;
                if ((matched = componentMatches(current, wrapper, rprops))) {
                    break;
                }
View Full Code Here

Examples of net.sourceforge.marathon.component.MComponent

            windowMonitor = WindowMonitor.getInstance();
        return windowMonitor;
    }

    private String getWindowName(Component c) {
        MComponent wrapper = findMComponent(c);
        List<List<String>> windowNamingProperties = findContainerNamingProperties(c.getClass().getName());
        String title = null;
        for (List<String> list : windowNamingProperties) {
            title = createWindowName(wrapper, list);
            if (title != null)
View Full Code Here

Examples of net.sourceforge.marathon.component.MComponent

        this.property = property;
        this.value = value;
    }

    public void play(ComponentFinder resolver) {
        MComponent component = resolver.getMComponentById(getComponentId());
        Object actual;
        Object expected;
        if (property.equals("Text")) {
            actual = component.getComparableObject();
            expected = component.getComparableObject(value);
        } else {
            actual = component.getProperty(property);
            expected = value;
        }
        if (actual == null && expected == null)
            return;
        if (actual == null || expected == null) {
            AssertionFailedError e = new AssertionFailedError("component <" + component.getMComponentName() + ">", expected,
                    actual, scriptModel, windowMonitor);
            e.captureScreen();
            throw e;
        }
        String expectedString = expected.toString();
        if (isRegex(expectedString) && Pattern.matches(expectedString.substring(1), actual.toString())) {
            return;
        }
        if ((expectedString.startsWith("//") && expectedString.substring(1).equals(actual.toString()))
                || expectedString.equals(actual.toString()))
            return;
        AssertionFailedError e = new AssertionFailedError("component <" + component.getMComponentName() + ">", expected, actual,
                scriptModel, windowMonitor);
        e.captureScreen();
        throw e;
    }
View Full Code Here

Examples of net.sourceforge.marathon.component.MComponent

            }
        });
    }

    private boolean isValueEqual(ComponentFinder resolver) {
        MComponent component = resolver.getMComponentById(getComponentId());
        Object actual;
        Object expected;
        if (property.equals("Text")) {
            actual = component.getComparableObject();
            expected = component.getComparableObject(value);
        } else {
            actual = component.getProperty(property);
            expected = value;
        }
        if (actual == null && expected == null)
            return true;
        if (actual == null || expected == null)
View Full Code Here

Examples of net.sourceforge.marathon.component.MComponent

        else
            throw new RuntimeException("Unknown action " + action + " in a call to DragAndDrop");
    }

    public void play(ComponentFinder resolver) {
        MComponent mSource = resolver.getMComponentById(source);
        MComponent mTarget = resolver.getMComponentById(target);
        if (!(mSource.getComponent() instanceof JComponent) || !(mTarget.getComponent() instanceof JComponent)) {
            throw new RuntimeException("DragAndDrop: can't handle non JComponents");
        }
        JComponent jSource = getTransferable(mSource.getComponent(), mSource.getMComponentName());
        JComponent jTarget = getTransferable(mTarget.getComponent(), mTarget.getMComponentName());
        Clipboard clip = new Clipboard("DnD");
        jSource.getTransferHandler().exportToClipboard(jSource, clip, action);
        if (mTarget instanceof MCellComponent)
            ((MCellComponent) mTarget).setCurrentSelection();
        Transferable contents = clip.getContents(jTarget);
View Full Code Here

Examples of net.sourceforge.marathon.component.MComponent

         * not record his keys.
         */
        Component keyForComponent = whoNeedsTheKey(ks, component.getComponent());
        if (keyForComponent == null)
            return;
        MComponent c = finder.getMComponentByComponent(keyForComponent);
        if (c == null || c.recordOtherKeys())
            return;
        keyForComponent = checkInputMap(ks, finder.getTopLevelWindow(component.getComponent()));
        if (keyForComponent == null)
            return;
        if (keyForComponent instanceof JLabel && ((JLabel) keyForComponent).getDisplayedMnemonic() == ks.getKeyCode())
View Full Code Here

Examples of net.sourceforge.marathon.component.MComponent

        if (popup != null) {

            Component c = popup;
            while (true) {
                if (c instanceof JMenu) {
                    MComponent mc = finder.getMComponentByComponent(c);
                    if (mc == null) {
                        /*
                         * This happens when recording clicking on a non-menu
                         * component buried in a submenu, when, while the
                         * submenu remains open, one of the parent menus gets
View Full Code Here

Examples of net.sourceforge.marathon.component.MComponent

            focusComponent = component;
        }
    }

    public void focusLost(MComponent currentComponent) {
        MComponent focusComponentContainer = null;
        if (focusComponent instanceof MCellComponent)
            focusComponentContainer = ((MCellComponent) focusComponent).getCollectionComponentWithWindowID();
        if (focusComponent != null && focusComponent.isMComponentEditable() && focusComponent.getText() != null
                && !focusComponent.getText().equals(focusComponentText) && focusComponent.isFocusNeeded()) {
            if (focusComponent.recordAlways() && RecordingEventQueue.isContextMenuOn())
                ;
            else
                recordSelect(focusComponent);
        }
        focusComponent = null;
        if (currentComponent != null && currentComponent instanceof MCellComponent) {
            MComponent container = ((MCellComponent) currentComponent).getCollectionComponent();
            if (container.equals(focusComponentContainer)) {
                return;
            }
        }
        if (focusComponentContainer == null)
            return;
View Full Code Here

Examples of net.sourceforge.marathon.component.MComponent

        if (c != null)
            c.requestFocus();
    }

    public void play(ComponentFinder resolver) {
        MComponent component = resolver.getMComponentById(getComponentId());
        waitForWindowActive(getParentWindow(component.getComponent()));
        requestFocus(component.getComponent());
        component.drag(modifiers, start, end, delayInMS);
    }
View Full Code Here

Examples of net.sourceforge.marathon.component.MComponent

        if (component.isMComponentEditable())
            dragComponentText = getText(component);
        else
            dragComponentText = null;
        dragComponent = component;
        MComponent container = null;
        if (dragComponent instanceof MCellComponent)
            container = ((MCellComponent) dragComponent).getCollectionComponentWithWindowID();
        if (container != null && container.isMComponentEditable()) {
            dragComponentContainer = container;
            dragComponentContainerText = container.getText();
        } else {
            dragComponentContainer = null;
            dragComponentContainerText = null;
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.