Package org.jemmy

Examples of org.jemmy.Point


     *
     * @return
     */
    @Property(CLICKPOINT_PROP_NAME)
    public Point getClickPoint() {
        return new Point(getScreenBounds().width / 2, (getScreenBounds().height / 2));
    }
View Full Code Here


    /**
     *
     * @param dest
     */
    public void move(Point dest) {
        Point start = control.getClickPoint();
        Point target = new Point(start.x + dest.x, start.y + dest.y);
        control.drag().dnd(start, control, target);
    }
View Full Code Here

     *
     * @param size
     * @param direction
     */
    public void resize(Dimension size, Direction direction) {
        Point start = null, target = null;
        Dimension sizeDiff = new Dimension(size.width - control.getScreenBounds().width, size.height - control.getScreenBounds().height);
        switch(direction) {
            case NORTHWEST:
                start = new Point(offset, offset);
                target = new Point(start.x - sizeDiff.width, start.y - sizeDiff.height);
                break;
            case NORTHEAST:
                start = new Point(control.getScreenBounds().width - offset - 1, offset);
                target = new Point(start.x + sizeDiff.width, start.y - sizeDiff.height);
                break;
            case SOUTHEAST:
                start = new Point(control.getScreenBounds().width - offset - 1, control.getScreenBounds().height - offset - 1);
                target = new Point(start.x + sizeDiff.width, start.y + sizeDiff.height);
                break;
            case SOUTHWEST:
                start = new Point(offset, control.getScreenBounds().height - offset - 1);
                target = new Point(start.x - sizeDiff.width, start.y + sizeDiff.height);
                break;
        }
        control.drag().dnd(start, control, target);
    }
View Full Code Here

                    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;
View Full Code Here

     * @param offset
     * @return
     */
    public static Point createScrollPoint(Rectangle bounds, boolean horizontal, boolean increase, int offset) {
        if(horizontal) {
            return new Point(increase ? (bounds.width - 1 - offset) : offset, bounds.height / 2);
        } else {
            return new Point(bounds.width / 2, increase ? (bounds.height - 1 - offset) : offset);
        }
    }
View Full Code Here

        return Utils.convert(getControl().getBounds());
    }

    @Override
    public Point getClickPoint() {
        return new Point(getControl().getWidth() / 2, 9); // TODO: On Windows Vista with Aero 5 is not enough (it resizes height only)
    }
View Full Code Here

        super(env, node);
        oper = new ComponentOperator(node);
    }

    public Rectangle getScreenBounds() {
        Point pos = new Point(0,0);
        Component cnt = getControl();
        do {
            pos.x += cnt.getLocation().x;
            pos.y += cnt.getLocation().y;
        } while((cnt = cnt.getParent()) != null);
View Full Code Here

        return new ScrollTrack(track, wrap, isVertical, 0);
    }

    @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

        for (int r = 0; r < tableViewOp.getItems().size(); r++) {
            List<TableColumn> columns = (List<TableColumn>)tableViewOp.getColumns();
            for(int c = 0; c < columns.size(); c++) {
                ITEM item = (ITEM) columns.get(c).getCellData(tableViewOp.getRow(r));
                getFound().add(item);
                getAux().add(new Point(c, r));
            }
        }
    }
View Full Code Here

     * @param targetPoint
     * @param button
     * @param modifiers
     */
    public void dnd(Point pointParam, final Wrap target, final Point targetPoint, final int button, final int modifiers) {
        final Point point = pointParam == null ? source.getClickPoint() : pointParam;
        source.getEnvironment().getExecutor().execute(target.getEnvironment(), false, new Action() {
            public void run(Object... parameters) {
                if(source.is(Showable.class)) ((Showable)source.as(Showable.class)).shower().show();
                source.mouse().move(point);
                source.mouse().press(map.convertMouseButton(button), map.convertModifiers(modifiers));
                source.getEnvironment().getTimeout(BEFORE_DRAG_TIMEOUT.getName()).sleep();
                Point intermediatePoint = new Point();
                int xDistance = target.getScreenBounds().x + targetPoint.x - source.getScreenBounds().x - point.x;
                int yDistance = target.getScreenBounds().y + targetPoint.y - source.getScreenBounds().y - point.y;
                int startX = point.x + source.getScreenBounds().x;
                int startY = point.y + source.getScreenBounds().y;
                int endX = startX + xDistance;
                int endY = startY + yDistance;
                for(int i = 0; i < DND_POINTS + 1; i++) {
                    intermediatePoint.x = startX + xDistance * i / DND_POINTS - source.getScreenBounds().x;
                    intermediatePoint.y = startY + yDistance * i / DND_POINTS - source.getScreenBounds().y;
                    source.mouse().move(intermediatePoint);
                    source.getEnvironment().getTimeout(IN_DRAG_TIMEOUT.getName()).sleep();
                }
                source.mouse().move(new Point(endX - source.getScreenBounds().x, endY - source.getScreenBounds().y));
                //target.mouse().move(targetPoint);
                source.getEnvironment().getTimeout(BEFORE_DROP_TIMEOUT.getName()).sleep();
                target.mouse().release(map.convertMouseButton(button), map.convertModifiers(modifiers));
            }

View Full Code Here

TOP

Related Classes of org.jemmy.Point

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.