Package org.apache.pivot.wtk

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


            if (window != null) {
                int width = getWidth();
                int height = getHeight();

                Display display = menuButton.getDisplay();

                // Ensure that the popup remains within the bounds of the display
                Point buttonLocation = menuButton.mapPointToAncestor(display, 0, 0);

                Dimensions displaySize = display.getSize();
                menuPopup.setPreferredSize(-1, -1);
                Dimensions popupSize = menuPopup.getPreferredSize();
                int popupWidth = Math.max(popupSize.width, menuButton.getWidth());
                int popupHeight = popupSize.height;
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

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

        if (Mouse.getCapturer() == component) {
            Sheet sheet = (Sheet)getComponent();
            Display display = sheet.getDisplay();

            Point location = sheet.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 (resizeOffset != null) {
                // Resize the frame
                int preferredWidth = -1;
                int preferredHeight = -1;
View Full Code Here

    @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, decoratedBounds.height + dy);

                Dimensions size = sheet.getPreferredSize();
                dy = -(int)(size.height * scale);
                translationDecorator.setY(dy);

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

            ListButton listButton = (ListButton)button;

            if (listButton.getListData().getLength() > 0) {
                // Determine the popup's location and preferred size, relative
                // to the button
                Display display = listButton.getDisplay();

                if (display != null) {
                    int width = getWidth();
                    int height = getHeight();

                    // TODO
                    /*
                    if (listButton.isSplit()) {
                        Bounds triggerBounds = new Bounds(Math.max(width - TRIGGER_WIDTH - 1, 0), 0,
                            TRIGGER_WIDTH + 1, Math.max(height, 0));
                        if (!triggerBounds.contains(mouseDownX, mouseDownY)) {
                            return;
                        }
                    }
                    */

                    // Adjust for list size
                    int listSize = listButton.getListSize();
                    if (listSize == -1) {
                        listViewBorder.setPreferredHeight(-1);
                    } else {
                        if (!listViewBorder.isPreferredHeightSet()) {
                            ListView.ItemRenderer itemRenderer = listView.getItemRenderer();
                            int borderHeight = itemRenderer.getPreferredHeight(-1) * listSize + 2;

                            if (listViewBorder.getPreferredHeight() > borderHeight) {
                                listViewBorder.setPreferredHeight(borderHeight);
                            } else {
                                listViewBorder.setPreferredHeight(-1);
                            }
                        }
                    }

                    // Ensure that the popup remains within the bounds of the display
                    Point buttonLocation = listButton.mapPointToAncestor(display, 0, 0);

                    Dimensions displaySize = display.getSize();

                    listViewPopup.setPreferredSize(-1, -1);
                    Dimensions popupSize = listViewPopup.getPreferredSize();
                    int popupWidth = Math.max(popupSize.width, listButton.getWidth() - TRIGGER_WIDTH - 1);
                    int popupHeight = popupSize.height;
View Full Code Here

        } else {
            CalendarButton calendarButton = (CalendarButton) button;

            // Determine the popup's location and preferred size, relative
            // to the button
            Display display = calendarButton.getDisplay();

            if (display != null) {
                int width = getWidth();
                int height = getHeight();

                // Ensure that the popup remains within the bounds of the display
                Point buttonLocation = calendarButton.mapPointToAncestor(display, 0, 0);

                Dimensions displaySize = display.getSize();

                calendarPopup.setPreferredSize(-1, -1);
                Dimensions popupSize = calendarPopup.getPreferredSize();
                int popupWidth = Math.max(popupSize.width, calendarButton.getWidth());
                int popupHeight = popupSize.height;
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

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

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

        dropShadowDecorator.setShadowOpacity(DropShadowDecorator.DEFAULT_SHADOW_OPACITY);

        SuggestionPopup suggestionPopup = (SuggestionPopup)getComponent();
        TextInput textInput = suggestionPopup.getTextInput();
View Full Code Here

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

        // Add this as a display mouse and key listener
        Display display = window.getDisplay();
        display.getContainerMouseListeners().add(displayMouseListener);
        display.getComponentKeyListeners().add(displayKeyListener);
    }
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.