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

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


                    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;

                }
                v.limitBoundsWithin(maximumSize);
            }
View Full Code Here


                        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

            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

        View newView;
        if (source.getSpecification().isService()) {
            return;
        } else {
            final Location dropLocation = drag.getTargetLocation();
            dropLocation.subtract(drag.getOffset());

            if (drag.isShift()) {
                newView = Toolkit.getViewFactory().createView(new ViewRequirement(getContent(), ViewRequirement.OPEN | ViewRequirement.SUBVIEW));
                drag.getTargetView().addView(newView);
                newView.setLocation(dropLocation);
View Full Code Here

    @Override
    public void drop(final ViewDrag drag) {
        getFeedbackManager().showDefaultCursor();

        final View sourceView = drag.getSourceView();
        final Location newLocation = drag.getViewDropLocation();
        if (sourceView.getSpecification() != null && sourceView.getSpecification().isSubView()) {
            if (sourceView.getSpecification().isOpen() && sourceView.getSpecification().isReplaceable()) {
                // TODO remove the open view from the container and place on
                // workspace; replace the internal view with an icon
            } else if (sourceView.getContent() instanceof FieldContent) {
View Full Code Here

    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);
                }
View Full Code Here

        }
    }

    @Override
    public void firstClick(final Click click) {
        final Location location = click.getLocation();
        if (menu.getBounds().contains(location)) {
            click.subtract(menu.getLocation());
            menu.firstClick(click);
        } else if (submenu != null && submenu.getBounds().contains(location)) {
            click.subtract(submenu.getLocation());
View Full Code Here

    private void open() {
        BackgroundWork.runTaskInBackground(this, new BackgroundTask() {
            @Override
            public void execute() {
                final View overlay = createDropDownView();
                final Location location = getView().getAbsoluteLocation();
                location.add(getView().getPadding().getLeft() - 1, getSize().getHeight() + 2);
                overlay.setLocation(location);
                getViewManager().setOverlayView(overlay);
            }

            @Override
View Full Code Here

            s.limitWidth(maximumSize.getWidth());
            if (fixedWidth || v.getSpecification().isAligned()) {
                s.ensureWidth(maxWidth);
            }
            v.setSize(s);
            v.setLocation(new Location(x, y));
            y += s.getHeight();
        }
    }
View Full Code Here

            final UserAction[] menuOptions = ((UserActionSet) item.action).getUserActions();
            ((PopupMenuContainer) getParent()).openSubmenu(menuOptions);
        } else {
            final Workspace workspace = getWorkspace();

            final Location location = new Location(getAbsoluteLocation());
            location.subtract(workspace.getView().getAbsoluteLocation());
            final Padding padding = workspace.getView().getPadding();
            location.move(-padding.getLeft(), -padding.getTop());

            final int itemHeight = style().getLineHeight() + ViewConstants.VPADDING;
            final int baseLine = itemHeight * option;
            location.add(0, baseLine);

            getParent().dispose();
            LOG.debug("execute " + item.name + " on " + forView + " in " + workspace);
            item.action.execute(workspace, forView, 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.