Package net.sourceforge.marathon.util

Examples of net.sourceforge.marathon.util.Snooze


        postEvent(createMouseEvent(MouseEvent.MOUSE_ENTERED, 0, start.x, start.y, modifiers));
        boolean doneExit = false; // set to true when we have simulated the
                                  // mouse exit

        postEvent(createMouseEvent(MouseEvent.MOUSE_PRESSED, 1, start.x, start.y, modifiers));
        new Snooze(10);
        postEvent(createMouseEvent(MouseEvent.MOUSE_DRAGGED, 1, start.x, start.y, modifiers));

        if (subDelayInMS > 0) {
            new Snooze(subDelayInMS);
            AWTSync.sync();
        }

        new Snooze(10);
        int midX = (start.x + end.x) / 2, midY = (start.y + end.y) / 2;
        if (!doneExit && !componentContains(midX, midY)) {
            postEvent(createMouseEvent(MouseEvent.MOUSE_EXITED, 1, midX, midY, modifiers));
            doneExit = true;
        }
        postEvent(createMouseEvent(MouseEvent.MOUSE_DRAGGED, 1, midX, midY, modifiers));

        if (subDelayInMS > 0) {
            new Snooze(subDelayInMS);
            AWTSync.sync();
        }

        new Snooze(10);
        if (!doneExit && !componentContains(end.x, midY)) {
            postEvent(createMouseEvent(MouseEvent.MOUSE_EXITED, 1, end.x, end.y, modifiers));
            doneExit = true;
        }
        postEvent(createMouseEvent(MouseEvent.MOUSE_DRAGGED, 1, end.x, end.y, modifiers));

        if (subDelayInMS > 0) {
            new Snooze(subDelayInMS);
            AWTSync.sync();
        }

        new Snooze(10);
        postEvent(createMouseEvent(MouseEvent.MOUSE_RELEASED, 1, end.x, end.y, modifiers));

        // No, drags shouldn't generate clicks.
        // If a gesture has been determined a drag by Marathon and recorded as
        // such, it should
        // be beyond the tolerance for small drags within a click.
        // postEvent(createMouseEvent(MouseEvent.MOUSE_CLICKED, 1, end.x, end.y,
        // modifiers));

        if (!doneExit) {
            new Snooze(10);
            postEvent(createMouseEvent(MouseEvent.MOUSE_EXITED, 1, end.x, end.y, modifiers));
            doneExit = true;
        }
    }
View Full Code Here


                            ComponentId ci = new ComponentId(s);
                            ids.add(ci);
                        }
                        for (int i = 0; i < ids.size(); i++) {
                            if (i > 0)
                                new Snooze(delayInMS);

                            ComponentId id = (ComponentId) ids.get(i);

                            MComponent mc = resolver.getMComponentById(id);
                            Component c = null;
                            if (mc != null) {
                                c = mc.getComponent();
                                if (c instanceof JMenu && (((JMenu) c).getPopupMenu().getComponentCount() == 0 || ((JMenu) c).getPopupMenu().isShowing())) {
                                    continue;
                                }
                            }

                            new ClickAction(id, scriptModel, windowMonitor).play(resolver, 3); // few
                            // retries

                            // Wait for the menu to show.
                            // This is necessary because otherwise the
                            // wrong component (e.g.
                            // a button with the same name in a parent
                            // menu) could get clicked.
                            if (c instanceof JMenu) {
                                for (int j = 0; j < 100; j++) {
                                    if (((JMenu) c).getPopupMenu().isShowing())
                                        break;
                                    new Snooze(10);
                                    AWTSync.sync();
                                }
                            }
                        }
                    }
View Full Code Here

    private void setListText(int index, JList list) {
        list.ensureIndexIsVisible(index);
        swingWait();
        Point p = list.getCellBounds(index, index).getLocation();
        new Snooze(50);
        new FireableMouseClickEvent(list).fire(p, 1);
        swingWait();
    }
View Full Code Here

TOP

Related Classes of net.sourceforge.marathon.util.Snooze

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.