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

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


    @Override
    public void draw(final Canvas canvas) {
        super.draw(canvas);

        final Size size = getSize();
        final int width = size.getWidth();
        final int height = size.getHeight();
        final int left = 3;
        final int top = 3;

        final boolean hasFocus = containsFocus();
        final Color lightColor = hasFocus ? Toolkit.getColor(ColorsAndFonts.COLOR_SECONDARY1) : Toolkit.getColor(ColorsAndFonts.COLOR_SECONDARY2);
View Full Code Here


        iconView.draw(c);
    }

    @Override
    public Size getRequiredSize(final Size availableSpace) {
        final Size size = new Size();

        size.extendWidth(BORDER_WIDTH);
        final Size iconMaximumSize = iconView.getRequiredSize(Size.createMax());
        size.extendWidth(iconMaximumSize.getWidth());

        size.extendHeight(iconMaximumSize.getHeight());
        size.ensureHeight(WindowControl.HEIGHT);
        size.extendHeight(BORDER_WIDTH);
        size.extendHeight(BORDER_WIDTH);

        size.extendWidth(ViewConstants.HPADDING);
View Full Code Here

        return new Padding(BORDER_WIDTH, BORDER_WIDTH, BORDER_WIDTH, BORDER_WIDTH);
    }

    @Override
    public void layout() {
        final Size size = getRequiredSize(Size.createMax());

        layoutControls(size.getWidth());

        size.contractWidth(BORDER_WIDTH * 2);
        size.contractWidth(ViewConstants.HPADDING);
        size.contractWidth(controls.length * (WindowControl.WIDTH + ViewConstants.HPADDING));

        size.contractHeight(BORDER_WIDTH * 2);

        iconView.setLocation(new Location(BORDER_WIDTH, BORDER_WIDTH));
        iconView.setSize(size);
    }
View Full Code Here

        markDamaged();
    }

    @Override
    public void draw(final Canvas canvas) {
        final Size s = getSize();
        canvas.drawSolidRectangle(0, 0, s.getWidth(), s.getHeight(), Toolkit.getColor(ColorsAndFonts.COLOR_SECONDARY3));
        wrappedView.draw(canvas);
    }
View Full Code Here

    @Override
    public void draw(final Canvas canvas) {
        if (getState().isViewIdentified()) {
            final Color color = Toolkit.getColor(ColorsAndFonts.COLOR_SECONDARY2);
            final Size s = getSize();
            final int width = s.getWidth();
            for (int i = 0; i < left; i++) {
                canvas.drawRectangle(i, i, width - 2 * i - 1, s.getHeight() - 2 * i - 1, color);
            }
            final int w2 = width - left - 2;
            final int w3 = w2 - handleWidth;
            for (int x = w2; x > w3; x -= 2) {
                canvas.drawLine(x, top, x, s.getHeight() - top, color);
            }
        }
        super.draw(canvas);
    }
View Full Code Here

    public static final Location UNPLACED = new Location(-1, -1);

    public static class ApplicationLayout implements Layout {
        @Override
        public Size getRequiredSize(final View view) {
            return new Size(600, 400);
        }
View Full Code Here

            layoutObjectIcons(maximumSize, view);
            layoutWindowViews(maximumSize, view, widthUsed);
        }

        private void layoutWindowViews(final Size maximumSize, final ApplicationWorkspace view, final int xOffset) {
            final Size size = view.getSize();
            size.contract(view.getPadding());

            final int maxHeight = size.getHeight();
            final int maxWidth = size.getWidth();

            final int xWindow = xOffset + PADDING;
            int yWindow = PADDING;

            int xMinimized = 1;
            int yMinimized = maxHeight - 1;

            final View windows[] = view.getWindowViews();
            for (final View v : windows) {
                final Size componentSize = v.getRequiredSize(new Size(size));
                v.setSize(componentSize);
                if (v instanceof MinimizedView) {
                    final Size s = v.getRequiredSize(Size.createMax());
                    if (xMinimized + s.getWidth() > maxWidth) {
                        xMinimized = 1;
                        yMinimized -= s.getHeight() + 1;
                    }
                    v.setLocation(new Location(xMinimized, yMinimized - s.getHeight()));
                    xMinimized += s.getWidth() + 1;

                } else if (v.getLocation().equals(UNPLACED)) {
                    final int height = componentSize.getHeight() + 6;
                    v.setLocation(new Location(xWindow, yWindow));
                    yWindow += height;
View Full Code Here

                window.layout();
            }
        }

        private int layoutServiceIcons(final Size maximumSize, final ApplicationWorkspace view) {
            final Size size = view.getSize();
            size.contract(view.getPadding());

            final int maxHeight = size.getHeight();

            int xService = PADDING;
            int yService = PADDING;
            int maxServiceWidth = 0;

            final View views[] = view.getServiceIconViews();
            for (final View v : views) {
                final Size componentSize = v.getRequiredSize(new Size(size));
                v.setSize(componentSize);
                final int height = componentSize.getHeight() + 6;

                final ObjectAdapter object = v.getContent().getAdapter();
                if (object.getSpecification().isService()) {
                    if (yService + height > maxHeight) {
                        yService = PADDING;
                        xService += maxServiceWidth + PADDING;
                        maxServiceWidth = 0;
                        LOG.debug("creating new column at " + xService + ", " + yService);
                    }
                    LOG.debug("service icon at " + xService + ", " + yService);
                    v.setLocation(new Location(xService, yService));
                    maxServiceWidth = Math.max(maxServiceWidth, componentSize.getWidth());
                    yService += height;
                }
                v.limitBoundsWithin(maximumSize);
            }
View Full Code Here

            return xService + maxServiceWidth;
        }

        private void layoutObjectIcons(final Size maximumSize, final ApplicationWorkspace view) {
            final Size size = view.getSize();
            size.contract(view.getPadding());

            final int maxWidth = size.getWidth();

            final int xObject = maxWidth - PADDING;
            int yObject = PADDING;

            final View views[] = view.getObjectIconViews();
            for (final View v : views) {
                final Size componentSize = v.getRequiredSize(new Size(size));
                v.setSize(componentSize);
                if (v.getLocation().equals(UNPLACED)) {
                    final int height = componentSize.getHeight() + 6;
                    v.setLocation(new Location(xObject - componentSize.getWidth(), yObject));
                    yObject += height;
                }
                v.limitBoundsWithin(maximumSize);
            }
        }
View Full Code Here

        }

        int top = 0;
        int left = 0;

        final Size size = getSize();
        int w = size.getWidth() - 1;
        int h = size.getHeight() - 1;
        canvas.drawRectangle(left, top, w, h, color);
        left++;
        top++;
        w -= 1;
        h -= 1;

        final ObjectAdapter value = getContent().getAdapter();
        if (value != null) {
            final ImageValueFacet facet = value.getSpecification().getFacet(ImageValueFacet.class);
            final java.awt.Image image = facet.getImage(value);
            if (image != null) {
                final Size imageSize = new Size(facet.getWidth(value), facet.getHeight(value));
                if (imageSize.getWidth() <= w && imageSize.getHeight() <= h) {
                    canvas.drawImage(new AwtImage(image), left, top);
                } else {
                    canvas.drawImage(new AwtImage(image), left, top, w, h);
                }
            }
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.