Package org.jemmy

Examples of org.jemmy.Rectangle


    }

    @Override
    public Rectangle getScreenBounds() {
        java.awt.Dimension size = Toolkit.getDefaultToolkit().getScreenSize();
        return new Rectangle(0, 0, size.width, size.height);
    }
View Full Code Here


        if (value < min || value > max)
            return null;

        boolean increase = isVertical;
        double dOffset = value - min;
        Rectangle bounds = trackNode.getScreenBounds();
        int len = isVertical? bounds.height: bounds.width;
        Point cp = ScrollerImpl.createScrollPoint(trackNode, ! isVertical, increase, (int)(dOffset/(max-min) * len));
       
        return cp;
    }
View Full Code Here

    public static Rectangle getScreenBounds(final Environment env, final Scene scene) {
        GetAction<Rectangle> bounds = new GetAction<Rectangle>() {

            @Override
            public void run(Object... parameters) throws NoSuchFieldException, IllegalArgumentException, IllegalAccessException {
                Rectangle sceneBounds = getSceneBounds(env, scene);
                Point stageCoordinates = null;
                // TODO: stub
                String prop = System.getProperty("javafx.swinginteroperability");
                if (prop != null && prop.compareToIgnoreCase("true") == 0) {
                    JFXPanel panel = AWT.getAWT().lookup(JFXPanel.class, new Showing<JFXPanel>() {

                        @Override
                        public boolean check(JFXPanel control) {
                            return super.check(control) && (control.getScene() == scene);
                        }
                    }).wrap().getControl();
                    sceneBounds.translate((int) panel.getLocationOnScreen().getX(), (int) panel.getLocationOnScreen().getY());
                } else {
                    Window window = scene.getWindow();
                    /*
                     * Field host_field =
                     * window.getClass().getDeclaredField("host");
                     * host_field.setAccessible(true); Object host =
                     * host_field.get(window); Field panel_field =
                     * host.getClass().getDeclaredField("this$0");
                     * panel_field.setAccessible(true); JFXPanel panel =
                     * (JFXPanel)panel_field.get(host);
                     * sceneBounds.translate((int)panel.getLocationOnScreen().getX(), (int)panel.getLocationOnScreen().getY());
                     */
                    // TODO: RT-12793
                    sceneBounds.translate((int) window.getX(), (int) window.getY());
                }
                setResult(sceneBounds);
            }
        };
        env.getExecutor().execute(env, true, bounds);
View Full Code Here

    /**
     * Returns bounds of the Scene relative to Stage containing it
     */
    private static Rectangle getSceneBounds(Environment env, final Scene scene) {
        return new Rectangle(scene.getX(), scene.getY(),
                scene.getWidth(), scene.getHeight());
    }
View Full Code Here

    /**
     * Returns bounds of the Stage relative to screen
     */
    private static Rectangle getScreenBounds(Environment env, final Window window) {
        return new Rectangle(window.getX(), window.getY(),
                window.getWidth(), window.getHeight());
    }
View Full Code Here

        GetAction<Rectangle> bounds = new GetAction<Rectangle>() {

            @Override
            public void run(Object... parameters) {
                Bounds rect = nd.localToScene(nd.getLayoutBounds());
                Rectangle res = SceneWrap.getScreenBounds(env, nd.getScene());
                res.x += rect.getMinX();
                res.y += rect.getMinY();
                res.width = (int) rect.getWidth();
                res.height = (int) rect.getHeight();
                setResult(res);
View Full Code Here

     * @param env
     * @return
     */
    public static boolean isInside(Node parent, Node cell, Environment env) {
        if (cell != null) {
            Rectangle bounds = NodeWrap.getScreenBounds(env, cell);
            Rectangle viewBounds = NodeWrap.getScreenBounds(env, parent);
            return (bounds.y > viewBounds.y
                    && bounds.y + bounds.height < viewBounds.y + viewBounds.height);
        } else {
            return false;
        }
View Full Code Here

     * @see #toLocal(org.jemmy.Point)
     */
    @Override
    public Point toAbsolute(final Point local) {
        Point p = convertToAbsoluteLayout(this, local);
        Rectangle screenBounds = getScreenBounds();
        return new Point(p.x + screenBounds.x, p.y + screenBounds.y);
    }
View Full Code Here

     * @return coordinates which should be used for mouse operations.
     * @see #toAbsolute(org.jemmy.Point)
     */
    @Override
    public Point toLocal(final Point global) {
        Rectangle screenBounds = getScreenBounds();
        Point local = new Point(global.x - screenBounds.x, global.y - screenBounds.y);
        return convertToLocalLayout(this, local);
    }
View Full Code Here

     * Identifies which elements are shown in the TableView currently.
     * @return {minColumn, minRow, maxColumn, maxRow} of cells that are fully
     * visible in the list.
     */
    private int[] shown() {
        final Rectangle viewArea = getScreenBounds(getEnvironment(), getClippedContainerWrap().getControl());

        int[] res = new GetAction<int[]>() {

            @Override
            @SuppressWarnings("unchecked")
            public void run(Object... parameters) {
                final int[] res = new int[]{Integer.MAX_VALUE, Integer.MAX_VALUE, -1, -1};

                as(Parent.class, TableCell.class).lookup(new LookupCriteria<TableCell>() {

                    @Override
                    public boolean check(TableCell control) {
                        if (control.isVisible() && control.getOpacity() == 1.0) {
                            Rectangle bounds = getScreenBounds(getEnvironment(), control);
                            int column = getColumnIndex(control);
                            int row = getRowIndex(control);
                            if (viewArea.contains(bounds)) {

                                res[0] = Math.min(res[0], column);
View Full Code Here

TOP

Related Classes of org.jemmy.Rectangle

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.