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

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


    }

    protected abstract void draw(final Canvas canvas, final int x, final int y);

    public Size getRequiredSize(final Size maximumSize) {
        Size s = new Size(requiredSize);
        s.extend(20, 20);
        return s;
    }
View Full Code Here


        int[] size = new int[] { 12, 20, 40, 60, 85, 100 };
        int x = 160;
        for (int i = 0; i < size.length; i++) {
            View view = new ExampleIconView(content, size[i]);
            view.setLocation(new Location(x, 80));
            x += view.getRequiredSize(new Size()).getWidth() + 15;
            view.setSize(view.getRequiredSize(new Size()));
            workspace.addView(view);
        }

        x = 160;
        for (int i = 0; i < size.length; i++) {
            View view = new ExampleClassIconView(content, size[i]);
            view.setLocation(new Location(x, 230));
            x += view.getRequiredSize(new Size()).getWidth() + 15;
            view.setSize(view.getRequiredSize(new Size()));
            workspace.addView(view);
        }

        size = new int[] { 10, 12, 14, 16, 18, 20, 24, 36, 60 };
        int y = 80;
        for (int i = 0; i < size.length; i++) {
            View view = new ExampleIconViewWithText(content, new ExampleText("Arial-plain-" + size[i]), true);
            view.setLocation(new Location(10, y));
            y += view.getRequiredSize(new Size()).getHeight() + 10;
            view.setSize(view.getRequiredSize(new Size()));
            workspace.addView(view);
        }

        y = 80;
        for (int i = 0; i < size.length; i++) {
            View view = new ExampleIconViewWithText(content, new ExampleText("Arial-plain-" + size[i]), false);
            view.setLocation(new Location(600, y));
            y += view.getRequiredSize(new Size()).getHeight() + 10;
            view.setSize(view.getRequiredSize(new Size()));
            workspace.addView(view);
        }
    }
View Full Code Here

    public ExampleIconViewWithText(final Content content, final Text text, final boolean showBounds) {
        super(content);
        this.text = text;
        this.showBounds = showBounds;
        icon = new IconGraphic(this, text);
        Size size = icon.getSize();
        size.extendWidth(text.stringWidth(string));
        setMaximumSize(size);
    }
View Full Code Here

    protected void draw(final Canvas canvas, final int x, final int y) {
        int baseline = icon.getBaseline() + y;
        // int baseline = - (text.getAscent() - text.getDescent() - icon.getSize().getHeight()) / 2;
        if (showBounds) {
            int right = getRequiredSize(new Size()).getWidth();

            int centre = y + icon.getSize().getHeight() / 2;
            canvas.drawLine(x, centre, right, centre, AwtColor.BLACK);

            int ascendTo = baseline - text.getAscent() + text.getDescent();
View Full Code Here

        if (showingImage()) {
            height += image.getHeight();
            width = Math.max(image.getWidth(), width);
        }

        return new Size(margin + width + margin, margin + height + margin);
    }
View Full Code Here

        final int width = maxWidth - 80;
        final int height = maxHeight - 80;
        final int x = 100;
        final int y = 100;

        final Size defaultWindowSize = new Size(width, height);
        defaultWindowSize.limitWidth(800);
        defaultWindowSize.limitHeight(600);

        final Size size = Properties.getSize(Properties.PROPERTY_BASE + "initial.size", defaultWindowSize);
        final Location location = Properties.getLocation(Properties.PROPERTY_BASE + "initial.location", new Location(x, y));
        return new Bounds(location, size);
    }
View Full Code Here

    @Override
    public Size getRequiredSize(final Size availableSpace) {
        final int height = Math.min(HEIGHT, availableSpace.getHeight());
        final int width = Math.min(WIDTH, availableSpace.getWidth());
        return new Size(width, height);
    }
View Full Code Here

        final View[] cells = getSubviews();
        int i = 0;
        final int top = CalendarConstants.style.getLineHeight() + ViewConstants.VPADDING;
        CalendarConstants.style.getLineSpacing();
        final Location location = new Location(leftInset, topInset + top);
        final Size size = new Size(columnWidth, rowHeight - top);
        for (int row = 0; row < rows; row++) {
            for (int column = 0; column < columns; column++) {
                final View cell = cells[i++];
                cell.setSize(size);
                cell.setLocation(location);
View Full Code Here

        }
    }

    @Override
    public Size requiredSize(final Size availableSpace) {
        return new Size(300, 300);
    }
View Full Code Here

        getParent().invalidateContent();
    }

    @Override
    public Size getRequiredSize(final Size availableSpace) {
        return new Size(-1, height);
    }
View Full Code Here

TOP

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

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.