Package org.apache.pivot.wtk

Examples of org.apache.pivot.wtk.Display$ValidateCallback


    @Override
    public void windowOpened(Window window) {
        super.windowOpened(window);

        Display display = window.getDisplay();
        display.getContainerMouseListeners().add(displayMouseListener);
        display.reenterMouse();

        dropShadowDecorator.setShadowOpacity(DropShadowDecorator.DEFAULT_SHADOW_OPACITY);

        alignToOwner();
View Full Code Here


                scale = easing.easeIn(getElapsedTime(), 1, -1, getDuration());
            } else {
                scale = easing.easeOut(getElapsedTime(), 1, -1, getDuration());
            }

            Display display = sheet.getDisplay();
            if (display != null) {
                Bounds decoratedBounds = sheet.getDecoratedBounds();
                display.repaint(decoratedBounds.x, decoratedBounds.y,
                    decoratedBounds.width + dx, decoratedBounds.height + dy);

                Dimensions size = sheet.getPreferredSize();
                switch (slideSource) {
                    case NORTH:
                        dy = -(int)(size.height * scale);
                        break;
                    case EAST:
                        dx = (int)(size.width * scale);
                        break;
                    case SOUTH:
                        dy = (int)(size.height * scale);
                        break;
                    case WEST:
                        dx = -(int)(size.width * scale);
                        break;
                    default:
                        throw new IllegalStateException(
                            "slideSource is null or an unexpected value");
                }

                translationDecorator.setX(dx);
                translationDecorator.setY(dy);

                display.repaint(decoratedBounds.x, decoratedBounds.y,
                    decoratedBounds.width + dx, decoratedBounds.height + dy);
            }
        }
View Full Code Here

                    listViewBorder.setPreferredHeight(-1);
                }
            }
        }

        Display display = window.getDisplay();
        display.getContainerMouseListeners().add(displayMouseListener);

        dropShadowDecorator.setShadowOpacity(DropShadowDecorator.DEFAULT_SHADOW_OPACITY);

        returnFocusToTextInput = true;

        TextInput textInput = suggestionPopup.getTextInput();
        textInput.getComponentStateListeners().add(textInputStateListener);
        textInput.getComponentKeyListeners().add(textInputKeyListener);

        // Size and position the popup
        Point location = textInput.mapPointToAncestor(textInput.getDisplay(), 0, 0);
        window.setLocation(location.x, location.y + textInput.getHeight() - 1);
        window.setMinimumWidth(textInput.getWidth());
        window.setMaximumHeight(display.getHeight() - window.getY());
    }
View Full Code Here

    public boolean mouseMove(Component component, int x, int y) {
        boolean consumed = super.mouseMove(component, x, y);

        if (Mouse.getCapturer() == component) {
            Palette palette = (Palette)getComponent();
            Display display = palette.getDisplay();

            Point location = palette.mapPointToAncestor(display, x, y);

            // Pretend that the mouse can't move off screen (off the display)
            location = new Point(Math.min(Math.max(location.x, 0), display.getWidth() - 1),
                Math.min(Math.max(location.y, 0), display.getHeight() - 1));

            if (dragOffset != null) {
                // Move the window
                palette.setLocation(location.x - dragOffset.x, location.y - dragOffset.y);
            } else {
View Full Code Here

    @Override
    public void windowOpened(Window window) {
        super.windowOpened(window);

        Display display = window.getDisplay();
        display.getContainerMouseListeners().add(displayMouseListener);
        display.reenterMouse();

        if (!window.requestFocus()) {
            Component.clearFocus();
        }
View Full Code Here

        String tooltipText = component.getTooltipText();

        if (tooltipText != null) {
            Tooltip tooltip = new Tooltip(new Label(tooltipText));

            Display display = component.getDisplay();
            Point location = component.mapPointToAncestor(display, x, y);

            // Ensure that the tooltip stays on screen
            int tooltipX = location.x + 16;
            int tooltipY = location.y;

            int tooltipWidth = tooltip.getPreferredWidth();
            int tooltipHeight = tooltip.getPreferredHeight();
            if (tooltipX + tooltipWidth > display.getWidth()) {
                // Try to just fit it inside the display if
                // there would be room to shift it above the
                // cursor, otherwise move it to the left of
                // the cursor
                if (tooltipY > tooltipHeight) {
                    tooltipX = display.getWidth() - tooltipWidth;
                } else {
                    tooltipX = location.x - tooltipWidth - 16;
                }
                if (tooltipX < 0) {
                    tooltipX = 0;
                }
                // Adjust the y location if the tip ends up
                // being behind the mouse cursor because of
                // these x adjustments
                if (tooltipX < location.x && tooltipX + tooltipWidth > location.x) {
                    tooltipY -= tooltipHeight;
                    if (tooltipY < 0) {
                        tooltipY = 0;
                    }
                }
            }
            if (tooltipY + tooltipHeight > display.getHeight()) {
                tooltipY -= tooltipHeight;
            }

            tooltip.setLocation(tooltipX, tooltipY);
            tooltip.open(component.getWindow());
View Full Code Here

    }

    @Override
    public void activeChanged(MenuBar.Item menuBarItem) {
        if (menuBarItem.isActive()) {
            Display display = menuBarItem.getDisplay();
            Point menuBarItemLocation = menuBarItem.mapPointToAncestor(display, 0, getHeight());

            // TODO Ensure that the popup remains within the bounds of the display

            menuPopup.setLocation(menuBarItemLocation.x, menuBarItemLocation.y);
View Full Code Here

    public boolean mouseMove(Component component, int x, int y) {
        boolean consumed = super.mouseMove(component, x, y);

        if (Mouse.getCapturer() == component) {
            Frame frame = (Frame)getComponent();
            Display display = frame.getDisplay();

            Point location = frame.mapPointToAncestor(display, x, y);

            // Pretend that the mouse can't move off screen (off the display)
            location = new Point(Math.min(Math.max(location.x, 0), display.getWidth() - 1),
                Math.min(Math.max(location.y, 0), display.getHeight() - 1));

            if (dragOffset != null) {
                // Move the frame
                frame.setLocation(location.x - dragOffset.x, location.y - dragOffset.y);
            } else {
View Full Code Here

        Menu menu = menuItem.getMenu();

        if (menu != null
            && !menuPopup.isOpen()) {
            // Size and position the popup
            Display display = menuItem.getDisplay();
            Dimensions displaySize = display.getSize();

            Point location = menuItem.mapPointToAncestor(display, getWidth(), 0);
            menuPopup.setLocation(location.x, location.y);

            int width = getWidth();
View Full Code Here

        String tooltipText = component.getTooltipText();

        if (tooltipText != null) {
            Tooltip tooltip = new Tooltip(new Label(tooltipText));

            Display display = component.getDisplay();
            Point location = component.mapPointToAncestor(display, x, y);

            // Ensure that the tooltip stays on screen
            int tooltipX = location.x + 16;
            int tooltipY = location.y;

            int tooltipWidth = tooltip.getPreferredWidth();
            int tooltipHeight = tooltip.getPreferredHeight();
            if (tooltipX + tooltipWidth > display.getWidth()) {
                // Try to just fit it inside the display if
                // there would be room to shift it above the
                // cursor, otherwise move it to the left of
                // the cursor
                if (tooltipY > tooltipHeight) {
                    tooltipX = display.getWidth() - tooltipWidth;
                } else {
                    tooltipX = location.x - tooltipWidth - 16;
                }
                if (tooltipX < 0) {
                    tooltipX = 0;
                }
                // Adjust the y location if the tip ends up
                // being behind the mouse cursor because of
                // these x adjustments
                if (tooltipX < location.x && tooltipX + tooltipWidth > location.x) {
                    tooltipY -= tooltipHeight;
                    if (tooltipY < 0) {
                        tooltipY = 0;
                    }
                }
            }
            if (tooltipY + tooltipHeight > display.getHeight()) {
                tooltipY -= tooltipHeight;
            }

            tooltip.setLocation(tooltipX, tooltipY);
            tooltip.open(component.getWindow());
View Full Code Here

TOP

Related Classes of org.apache.pivot.wtk.Display$ValidateCallback

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.