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

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


        final Location loc = new Location(10, 10);
        assertEquals(ViewAreaType.CONTENT, av.viewAreaType(loc));
    }

    public void testBoundsSetSizeAndLocation() throws Exception {
        final Location l = new Location();
        final Size z = new Size();
        final View view = new AbstractView(new NullContent()) {
            @Override
            public void setLocation(final Location location) {
                l.translate(location);
            }

            @Override
            public void setSize(final Size size) {
                z.extend(size);
            }
        };

        view.setBounds(new Bounds(20, 30, 40, 50));
        assertEquals(new Location(20, 30), l);
        assertEquals(new Size(40, 50), z);
    }
View Full Code Here


    @Override
    public void firstClick(final Click click) {
        final int y = click.getLocation().getY();
        if (y < top && click.button2()) {
            final Location location = new Location(click.getLocationWithinViewer());
            getViewManager().showInOverlay(getContent(), location);
        } else {
            super.firstClick(click);
        }
    }
View Full Code Here

        }
    }

    @Override
    public ViewAreaType viewAreaType(final Location mouseLocation) {
        final Bounds title = new Bounds(new Location(), icon.getSize());
        title.extendWidth(left);
        title.extendWidth(text.getSize().getWidth());
        if (title.contains(mouseLocation)) {
            return ViewAreaType.CONTENT;
        } else {
View Full Code Here

        int x = size.getWidth() - right - (WindowControl.WIDTH + ViewConstants.HPADDING) * 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() + ViewConstants.HPADDING;
        }
    }
View Full Code Here

            }
            markDamaged();
            return;
        }
        if (isEditable) {
            final Location location = click.getLocation();
            final Date selectedDate = getSelectedDate(location);
            if (selectedDate != null) {
                date.setTime(selectedDate);
                final Content content = getContent();
                final DateValueFacet facet = content.getSpecification().getFacet(DateValueFacet.class);
View Full Code Here

            {
                allowing(view).getRequiredSize(new Size(CONTAINER_WIDTH, CONTAINER_HEIGHT));
                will(returnValue(new Size(width, height)));
               
                one(view).setSize(new Size(width, height));
                one(view).setLocation(new Location(x, y));
            }
        });
        return view;
    }
View Full Code Here

        workspace = new DummyWorkspaceView();
        workspace.setSize(new Size(WORKSPACE_WIDTH, WORKSPACE_HEIGHT));

        existingView = new DummyView();
        existingView.setSize(new Size(ROOT_VIEW_WIDTH, ROOT_VIEW_HEIGHT));
        existingView.setLocation(new Location(ORIGINAL_X, ORIGINAL_Y));
        existingView.setParent(workspace);
        workspace.addView(existingView);

        newView = new DummyView();
        newView.setupRequiredSize(new Size(NEW_VIEW_WIDTH, NEW_VIEW_HEIGHT));
View Full Code Here

        strategy = new PlacementStrategyImpl();
    }

    @Test
    public void defaultWhenNoRelativeView() throws Exception {
        final Location location = strategy.determinePlacement(workspace, null, newView);
        Assert.assertEquals(new Location(), location);
    }
View Full Code Here

        Assert.assertEquals(new Location(), location);
    }

    @Test
    public void placeToRight() throws Exception {
        final Location location = strategy.determinePlacement(workspace, existingView, newView);
        Assert.assertEquals(new Location(ORIGINAL_X + ROOT_VIEW_WIDTH + PADDING, 70), location);
    }
View Full Code Here

    }

    @Test
    public void adjustWhenOnTopOfExistingField() throws Exception {
        final DummyView anotherView = new DummyView();
        anotherView.setLocation(new Location(ORIGINAL_X + ROOT_VIEW_WIDTH + PADDING, ORIGINAL_Y));
        anotherView.setSize(new Size(50, 50));
        workspace.addView(anotherView);

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

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