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

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


        Assert.assertEquals(new Location(ORIGINAL_X + ROOT_VIEW_WIDTH + PADDING + PADDING * 4, ORIGINAL_Y + PADDING * 4), location);
    }

    @Test
    public void placeBelow() throws Exception {
        existingView.setLocation(new Location(WORKSPACE_WIDTH - 200, 100));

        final Location location = strategy.determinePlacement(workspace, existingView, newView);
        Assert.assertEquals(new Location(WORKSPACE_WIDTH - 200, 100 + +ROOT_VIEW_HEIGHT + PADDING), location);
    }
View Full Code Here


        Assert.assertEquals(new Location(WORKSPACE_WIDTH - 200, 100 + +ROOT_VIEW_HEIGHT + PADDING), location);
    }

    @Test
    public void placeToLeft() throws Exception {
        existingView.setLocation(new Location(WORKSPACE_WIDTH - 200, 500));

        final Location location = strategy.determinePlacement(workspace, existingView, newView);
        Assert.assertEquals(new Location(WORKSPACE_WIDTH - 200 - PADDING - NEW_VIEW_WIDTH, 500), location);
    }
View Full Code Here

        Assert.assertEquals(new Location(WORKSPACE_WIDTH - 200 - PADDING - NEW_VIEW_WIDTH, 500), location);
    }

    @Test
    public void placeAbove() throws Exception {
        existingView.setLocation(new Location(100, 700));
        existingView.setSize(new Size(900, 100));

        final Location location = strategy.determinePlacement(workspace, existingView, newView);
        Assert.assertEquals(new Location(100, 700 - NEW_VIEW_HEIGHT - PADDING), location);
    }
View Full Code Here

        Assert.assertEquals(new Location(100, 700 - NEW_VIEW_HEIGHT - PADDING), location);
    }

    @Test
    public void viewLargerThanWorkspace() throws Exception {
        existingView.setLocation(new Location(100, 100));
        newView.setupRequiredSize(new Size(1100, 900));

        final Location location = strategy.determinePlacement(workspace, existingView, newView);
        Assert.assertEquals("should be placed on top of original, but slightly offset", new Location(0, 0), location);
    }
View Full Code Here

        Assert.assertEquals("should be placed on top of original, but slightly offset", new Location(0, 0), location);
    }

    @Test
    public void viewLargerThanWorkspaceAndExisitingViewInCorner() throws Exception {
        existingView.setLocation(new Location(200, 300));
        existingView.setLocation(new Location(0, 0));
        newView.setupRequiredSize(new Size(1100, 900));

        final Location location = strategy.determinePlacement(workspace, existingView, newView);
        Assert.assertEquals("should be placed on top of original, but slightly offset", new Location(0, 0), location);
    }
View Full Code Here

        Assert.assertEquals("should be placed on top of original, but slightly offset", new Location(0, 0), location);
    }

    @Test
    public void notEnoughFreeSpaceInAnyDirection() throws Exception {
        existingView.setLocation(new Location(100, 100));
        existingView.setSize(new Size(800, 600));

        final Location location = strategy.determinePlacement(workspace, existingView, newView);
        Assert.assertEquals("should be placed on top of original, but slightly offset", new Location(100 + PADDING * 6, 100 + PADDING * 6), location);
    }
View Full Code Here

    @Test
    public void wideComponentShiftsToLeft() throws Exception {
        newView.setupRequiredSize(new Size(1200, NEW_VIEW_HEIGHT));

        final Location location = strategy.determinePlacement(workspace, existingView, newView);
        Assert.assertEquals(new Location(0, ORIGINAL_Y + ROOT_VIEW_HEIGHT + PADDING), location);
    }
View Full Code Here

    @Test
    public void tallComponentShiftsUp() throws Exception {
        newView.setupRequiredSize(new Size(NEW_VIEW_WIDTH, 1000));

        final Location location = strategy.determinePlacement(workspace, existingView, newView);
        Assert.assertEquals(new Location(ORIGINAL_X + ROOT_VIEW_WIDTH + PADDING, 0), location);
    }
View Full Code Here

    }

    @Test
    public void wideComponentsDontCompletelyOverlap() throws Exception {
        final DummyView anotherView = new DummyView();
        anotherView.setLocation(new Location(0, 70 + ROOT_VIEW_HEIGHT + PADDING));
        anotherView.setSize(new Size(WORKSPACE_WIDTH, 100));
        workspace.addView(anotherView);

        newView.setupRequiredSize(new Size(WORKSPACE_WIDTH, NEW_VIEW_HEIGHT));

        final Location location = strategy.determinePlacement(workspace, existingView, newView);
        Assert.assertEquals(new Location(0, 70 + ROOT_VIEW_HEIGHT + PADDING + PADDING * 4), location);
    }
View Full Code Here

    }

    @Test
    public void tallComponentsDontCompletelyOverlap() throws Exception {
        final DummyView anotherView = new DummyView();
        anotherView.setLocation(new Location(ORIGINAL_X + ROOT_VIEW_WIDTH + PADDING, 0));
        anotherView.setSize(new Size(100, WORKSPACE_HEIGHT));
        workspace.addView(anotherView);

        newView.setupRequiredSize(new Size(NEW_VIEW_WIDTH, WORKSPACE_HEIGHT));

        final Location location = strategy.determinePlacement(workspace, existingView, newView);
        Assert.assertEquals(new Location(ORIGINAL_X + ROOT_VIEW_WIDTH + PADDING + PADDING * 4, 0), location);
    }
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.