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

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


            return super.getRequiredSize(availableSpace);
        } else {
            final ImageValueFacet facet = value.getSpecification().getFacet(ImageValueFacet.class);
            final int width = Math.min(120, Math.max(32, facet.getWidth(value)));
            final int height = Math.min(120, Math.max(32, facet.getHeight(value)));
            return new Size(width, height);
        }
    }
View Full Code Here


        super.debugStructure(debug);
    }

    @Override
    public Size requiredSize(final Size availableSpace) {
        final Size size = layout.getRequiredSize(this);
        size.extend(getPadding());
        size.ensureHeight(1);
        return size;
    }
View Full Code Here

        }
    }

    @Override
    public Size getRequiredSize(final Size availableSpace) {
        final Size size = menu.getRequiredSize(Size.createMax());
        if (submenu != null) {
            final Size subviewSize = submenu.getRequiredSize(Size.createMax());
            size.extendWidth(subviewSize.getWidth() - MENU_OVERLAP);
            size.ensureHeight(submenuOffset() + subviewSize.getHeight());
        }
        return size;
    }
View Full Code Here

        builder.build(getView(), axes);
    }

    @Override
    protected void doLayout(final Size maximumSize) {
        layout.layout(getView(), new Size(maximumSize));
    }
View Full Code Here

    @Override
    public void layout() {
        if (isLayoutInvalid) {
            menu.layout();
            final Size menuSize = menu.getRequiredSize(Size.createMax());
            menu.setSize(menuSize);
            menu.setLocation(new Location(0, 0));

            final Location containerLocation = new Location(at);
            final Size bounds = getViewManager().getOverlaySize();
            if (containerLocation.getX() < 0) {
                containerLocation.setX(0);
            } else if (containerLocation.getX() + menuSize.getWidth() > bounds.getWidth()) {
                containerLocation.setX(bounds.getWidth() - menuSize.getWidth());
            }

            if (containerLocation.getY() < 0) {
                containerLocation.setY(0);
            } else if (containerLocation.getY() + menuSize.getHeight() > bounds.getHeight()) {
                containerLocation.setY(bounds.getHeight() - menuSize.getHeight());
            }

            if (submenu != null) {
                submenu.layout();
                final Size submenuSize = submenu.getRequiredSize(Size.createMax());
                submenu.setSize(submenuSize);

                int submenuOffset = submenuOffset();
                final Location menuLocation = new Location();

                final int containerBottom = containerLocation.getY() + submenuOffset + submenuSize.getHeight();
                if (containerBottom > bounds.getHeight()) {
                    final int overstretch = containerBottom - bounds.getHeight();
                    submenuOffset -= overstretch;
                }
                final Location submenuLocation = new Location(0, submenuOffset);

                final boolean placeToLeft = at.getX() + menuSize.getWidth() + submenuSize.getWidth() < getViewManager().getOverlaySize().getWidth();
                if (placeToLeft) {
                    submenuLocation.setX(menuSize.getWidth() - MENU_OVERLAP);
                } else {
                    menuLocation.setX(submenuSize.getWidth() - MENU_OVERLAP);
                    containerLocation.move(-submenu.getSize().getWidth() + MENU_OVERLAP, 0);
                }

                if (containerLocation.getY() + menuSize.getHeight() > bounds.getHeight()) {
                    containerLocation.setY(bounds.getHeight() - menuSize.getHeight());
View Full Code Here

        submenu = new PopupMenu(this);
        submenu.setParent(this);
        submenu.show(target, options, backgroundColor);
        invalidateLayout();
        final Size size = getRequiredSize(Size.createMax());
        setSize(size);
        layout();

        isLayoutInvalid = false;
View Full Code Here

        }
    }

    @Override
    public Size getRequiredSize(final Size availableSpace) {
        return new Size(size);
    }
View Full Code Here

    protected abstract View createDropDownView();

    @Override
    public void draw(final Canvas canvas) {
        final Size size = getSize();
        final int x = size.getWidth() - right + 5 - ViewConstants.HPADDING;
        final int y = (size.getHeight() - 6) / 2;

        if (isAvailable()) {
            final Shape triangle = new Shape(0, 0);
            triangle.addPoint(6, 6);
            triangle.addPoint(12, 0);
View Full Code Here

    }

    @Override
    public Size getRequiredSize(final Size maximumSize) {
        maximumSize.contractWidth(ViewConstants.HPADDING);
        final Size size = super.getRequiredSize(maximumSize);
        return size;
    }
View Full Code Here

        this(new NullContent());
    }

    public BlankView(final Content content) {
        super(content);
        size = new Size(100, 50);
    }
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.