Package org.jemmy

Examples of org.jemmy.Vector


            public void run(Object... parameters) {
                int toOrig;
                int dragAttempt = 0;
                Timeout moveTimeout = wrap.getEnvironment().getTimeout(Drag.IN_DRAG_TIMEOUT).clone();
                while((toOrig = condition.to()) != 0) {
                    Vector axis = getScrollVector().
                            multiply(toOrig).setLenght(dragDelta);
                    if (reverse) {
                        axis.multiply(-1);
                    }
                    Vector shift = axis.clone();
                    Wrap<?> knob = getKnob();
                    Point orig = new Point(knob.getScreenBounds().getX() + knob.getScreenBounds().getWidth()/2, knob.getScreenBounds().getY() + knob.getScreenBounds().getHeight()/2);
                    knob.mouse().move(knob.toLocal(orig.getLocation()));
                    knob.mouse().press();
                    wrap.getEnvironment().getTimeout(Drag.BEFORE_DRAG_TIMEOUT).sleep();
                    try {
                        while (condition.to() == toOrig) {
                            wrap.getEnvironment().getTimeout(Drag.IN_DRAG_TIMEOUT).sleep();
//                            Rectangle old_pos = knob.getScreenBounds();
                            knob.mouse().move(knob.toLocal(orig.getLocation().translate(shift)));
//                            if (old_pos.equals(knob.getScreenBounds())) { // TODO: it would be better to check if we achieve maximum position
//                                break;
//                            }
                            if(scroll.position() == scroll.minimum() || scroll.position() == scroll.maximum()) {
                                break;
                            }
                            shift.add(axis);
                        }
                    } finally {
                        wrap.getEnvironment().getTimeout(Drag.BEFORE_DROP_TIMEOUT).sleep();
                        knob.mouse().release();
                    }
View Full Code Here


    @Override
    public Vector getScrollVector() {
        Point end = isVertical ? new Point(0, wrap.getControl().getHeight()) :
                                 new Point(wrap.getControl().getWidth(), 0);
        return new Vector(wrap.toAbsolute(new Point(0, 0)), wrap.toAbsolute(end));
    }
View Full Code Here

TOP

Related Classes of org.jemmy.Vector

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.