Package org.apache.isis.viewer.dnd.drawing

Examples of org.apache.isis.viewer.dnd.drawing.Location


    }

    @Test
    public void testCursorPostioningByCharacterPastEnd() {
        content.setText("test insert that");
        assertEquals(16, content.cursorAtCharacter(new Location(190, 0), 0));
        assertEquals(0, content.cursorAtCharacter(new Location(0, 0), 0));
        assertEquals(16, content.cursorAtCharacter(new Location(35, 0), 2));
    }
View Full Code Here


    @Test
    public void testCursorPostioningByCharacterOnLine2() {
        content.setNoDisplayLines(4);
        content.setText("test insert that that spans three lines only");
        assertEquals(0, content.cursorAtCharacter(new Location(0, 1000), 2));
        assertEquals(0, content.cursorAtCharacter(new Location(3, 1000), 2));

        assertEquals(1, content.cursorAtCharacter(new Location(4, 1000), 2));
        assertEquals(1, content.cursorAtCharacter(new Location(13, 1000), 2));

        assertEquals(2, content.cursorAtCharacter(new Location(14, 1000), 2));
        assertEquals(2, content.cursorAtCharacter(new Location(23, 1000), 2));

        assertEquals(10, content.cursorAtCharacter(new Location(14, 1000), 3));
        assertEquals(10, content.cursorAtCharacter(new Location(23, 1000), 3));

    }
View Full Code Here

        if (subview != null) {
            click.subtract(subview.getLocation());
            subview.firstClick(click);
        } else {
            if (click.button2()) {
                final Location location = new Location(click.getLocationWithinViewer());
                getViewManager().showInOverlay(getContent(), location);
            }
        }
    }
View Full Code Here

        final View subview = subviewFor(click.getLocation());
        if (subview != null) {
            click.subtract(subview.getLocation());
            subview.secondClick(click);
        } else {
            final Location location = getAbsoluteLocation();
            location.translate(click.getLocation());
            getWorkspace().addWindowFor(getContent().getAdapter(), new Placement(this));
        }
    }
View Full Code Here

    @Override
    public void drop(final ViewDrag drag) {
        if (drag.getSourceView() == getView() || !contains(drag.getSourceView())) {
            super.drop(drag);
        } else {
            final Location dropAt = drag.getLocation();
            dropAt.subtract(getLocation());
            final int x = dropAt.getX();
            final int y = dropAt.getY();
            final int borderWdth = 45;
            final int left = getSize().getWidth() - borderWdth;
            final int bottom = getSize().getHeight() - borderWdth;
            if (y < borderWdth) {
                addView(drag.getSourceView().getContent(), Position.North);
View Full Code Here

        });
    }

    @Override
    public DragEvent dragStart(final DragStart drag) {
        final Location location = drag.getLocation();
        if (overBorder(location)) {
            requiredDirection = onBorder(location);
            if (requiredDirection > 0) {
                return new ResizeDrag(this, new Bounds(getAbsoluteLocation(), getView().getSize()), requiredDirection);
            }
View Full Code Here

                                      // controls.length;
        final int y = LINE_THICKNESS + ViewConstants.VPADDING;

        for (final View control : controls) {
            control.setSize(control.getRequiredSize(new Size()));
            control.setLocation(new Location(x, y));
            x += control.getSize().getWidth();
        }
    }
View Full Code Here

        };
        super.setUp();
    }

    public void testBounds() {
        assertEquals(new Location(), av.getLocation());
        assertEquals(new Size(), av.getSize());
        assertEquals(new Bounds(), av.getBounds());

        av.setLocation(new Location(10, 20));
        assertEquals(new Location(10, 20), av.getLocation());
        assertEquals(new Size(), av.getSize());
        assertEquals(new Bounds(10, 20, 0, 0), av.getBounds());

        av.setSize(new Size(30, 40));
        assertEquals(new Location(10, 20), av.getLocation());
        assertEquals(new Size(30, 40), av.getSize());
        assertEquals(new Bounds(10, 20, 30, 40), av.getBounds());

        av.setBounds(new Bounds(new Location(50, 60), new Size(70, 80)));
        assertEquals(new Location(50, 60), av.getLocation());
        assertEquals(new Size(70, 80), av.getSize());
        assertEquals(new Bounds(50, 60, 70, 80), av.getBounds());
    }
View Full Code Here

                final AboutView dialogView = new AboutView();
                final Size windowSize = dialogView.getRequiredSize(new Size());
                final Size workspaceSize = workspace.getSize();
                final int x = workspaceSize.getWidth() / 2 - windowSize.getWidth() / 2;
                final int y = workspaceSize.getHeight() / 2 - windowSize.getHeight() / 2;
                workspace.addDialog(dialogView, new Placement(new Location(x, y)));
            }
        });

        options.add(new UserActionAbstract("Log out") {
            @Override
View Full Code Here

    public void testPadding() {
        assertEquals(new Padding(0, 0, 0, 0), av.getPadding());
    }

    public void testViewAreaType() {
        final Location loc = new Location(10, 10);
        assertEquals(ViewAreaType.CONTENT, av.viewAreaType(loc));
    }
View Full Code Here

TOP

Related Classes of org.apache.isis.viewer.dnd.drawing.Location

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.