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

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


    }

    @Override
    public void draw(final Canvas canvas) {
        if (Toolkit.debug) {
            canvas.drawDebugOutline(new Bounds(getSize()), getBaseline(), Toolkit.getColor(ColorsAndFonts.COLOR_DEBUG_BOUNDS_BORDER));
        }
        final int width = getSize().getWidth() - getRight();
        final int height = getSize().getHeight() - getBottom();
        final Canvas subcanvas = canvas.createSubcanvas(getLeft(), getTop(), width, height);
        wrappedView.draw(subcanvas);
View Full Code Here


        wrappedView.setSize(wrappedViewSize);
    }

    @Override
    public void setBounds(final Bounds bounds) {
        final Bounds wrappedViewBounds = new Bounds(bounds);
        wrappedViewBounds.contract(getLeft() + getRight(), getTop() + getBottom());
        wrappedView.setBounds(wrappedViewBounds);
    }
View Full Code Here

    }

    @Override
    public ViewAreaType viewAreaType(final Location mouseLocation) {
        final Size size = wrappedView.getSize();
        final Bounds bounds = new Bounds(getLeft(), getTop(), size.getWidth(), size.getHeight());

        if (bounds.contains(mouseLocation)) {
            mouseLocation.subtract(getLeft(), getTop());

            return wrappedView.viewAreaType(mouseLocation);
        } else {
            return ViewAreaType.VIEW;
View Full Code Here

    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);
            }
            return null;
        } else {
            return super.dragStart(drag);
        }
View Full Code Here

        UI_LOG.debug("off resize border " + onBorder + " " + resizing);
        super.exited();
    }

    private int onBorder(final Location at) {
        final Bounds area = contentArea();
        final boolean right = canExtend(RIGHT) && at.getX() >= area.getWidth() && at.getX() <= area.getWidth() + getRight();
        final boolean bottom = canExtend(DOWN) && at.getY() >= area.getHeight() && at.getY() <= area.getHeight() + getBottom();

        final int status;
        if (right && bottom) {
            status = ResizeDrag.BOTTOM_RIGHT;
        } else if (right) {
View Full Code Here

    }

    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

            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 draw(final Canvas canvas) {
        int x = left - 2;

        if (Toolkit.debug) {
            canvas.drawDebugOutline(new Bounds(getSize()), baseline, Toolkit.getColor(ColorsAndFonts.COLOR_DEBUG_BOUNDS_DRAW));
        }

        // icon & title
        icon.draw(canvas, x, baseline);
        x += icon.getSize().getWidth();
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 {
            return super.viewAreaType(mouseLocation);
        }
    }
View Full Code Here

    private Bounds b;

    @Override
    protected void setUp() throws Exception {
        org.apache.log4j.Logger.getRootLogger().setLevel(org.apache.log4j.Level.OFF);
        b = new Bounds(5, 10, 10, 20);
    }
View Full Code Here

TOP

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

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.