Package org.apache.pivot.wtk

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


                Point location = component.getDisplay().getMouseLocation();
                int x = location.x;
                int y = location.y;

                // Ensure that the tooltip stays on screen
                Display display = component.getDisplay();
                int tooltipHeight = tooltip.getPreferredHeight();
                if (y + tooltipHeight > display.getHeight()) {
                    y -= tooltipHeight;
                }

                tooltip.setLocation(x + 16, y);
                tooltip.open(component.getWindow());
View Full Code Here


        repaintComponent();
    }

    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

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

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

        MenuPopup menuPopup = (MenuPopup)window;
        Menu menu = menuPopup.getMenu();
        if (menu != null) {
            Menu.Item activeItem = menu.getActiveItem();
View Full Code Here

    MenuPopupStateListener {
    private class RepositionCallback implements Runnable {
        @Override
        public void run() {
            MenuPopup menuPopup = (MenuPopup)getComponent();
            Display display = menuPopup.getDisplay();

            Point location = menuPopup.getLocation();
            Dimensions size = menuPopup.getSize();

            int x = location.x;
            if (x + size.width > display.getWidth()) {
                x -= size.width;
            }

            int y = location.y;
            if (y + size.height > display.getHeight()) {
                y-= size.height;
            }

            menuPopup.setLocation(x, y);
        }
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

        @Override
        public boolean mouseDown(Container container, Mouse.Button button, int x, int y) {
            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))) {
                    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

            Color color = colorChooser.getSelectedColor();
            colorChooserButton.setSelectedColor(color);
        } else {
                // Determine the popup's location and preferred size, relative
                // to the button
                Display display = colorChooserButton.getDisplay();

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

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

                    Dimensions displaySize = display.getSize();

                    colorChooserPopup.setPreferredSize(-1, -1);
                    Dimensions popupSize = colorChooserPopup.getPreferredSize();
                    int popupWidth = Math.max(popupSize.width,
                        colorChooserButton.getWidth() - TRIGGER_WIDTH - 1);
View Full Code Here

        Menu.Item menuItem = (Menu.Item)getComponent();
        Menu menu = menuItem.getMenu();

        if (menu != null
            && !menuPopup.isOpen()) {
            Display display = menuItem.getDisplay();
            Point location = menuItem.mapPointToAncestor(display, getWidth(), 0);

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

            menuPopup.setLocation(location.x, location.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

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.