Package org.apache.pivot.wtk

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


                    suggestionListViewBorder.setPreferredHeight(-1);
                }
            }
        }

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

        dropShadowDecorator.setShadowOpacity(DropShadowDecorator.DEFAULT_SHADOW_OPACITY);

        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.setMinimumPreferredWidth(textInput.getWidth());
        window.setMaximumPreferredHeight(display.getHeight() - window.getY());
    }
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();

                    // 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

        public void close() {
            if (!isClosed()
                && !opening) {
                // Close once we've transitioned back to the image card
                if (cardPane.getSelectedIndex() == IMAGE_CARD_INDEX) {
                    Display display = getDisplay();
                    display.getContainerMouseListeners().remove(this);

                    Window owner = getOwner();

                    super.close();
                    closing = false;
View Full Code Here

            boolean consumed = opening;

            if (!opening
                && !closing) {
                // If the event occurred outside the popup, close the popup
                Display display = (Display)container;
                Window window = (Window)display.getComponentAt(x, y);

                if (window != this &&
                    (window == null || !isOwner(window))) {
                    consumed = !saveChanges();
                }
View Full Code Here

        public boolean mouseWheel(Container container, Mouse.ScrollType scrollType,
            int scrollAmount, int wheelRotation, int x, int y) {
            boolean consumed = false;

            // If the event occurred outside the popup, consume the event
            Display display = (Display)container;
            Window window = (Window)display.getComponentAt(x, y);

            if (window != this &&
                (window == null || !isOwner(window))) {
                consumed = true;
            }
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) {
            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

                    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

        requestFocus();
    }

    @Override
    public void close() {
        Display display = getDisplay();
        display.getContainerMouseListeners().remove(displayMouseHandler);

        super.close();
    }
View Full Code Here

        requestFocus();
    }

    @Override
    public void close() {
        Display display = getDisplay();
        display.getContainerMouseListeners().remove(displayMouseHandler);

        super.close();
    }
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.