Package org.apache.pivot.wtk

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


                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


        requestFocus();
    }

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

        super.close();
    }
View Full Code Here

        display.getContainerMouseListeners().add(displayMouseHandler);
    }

    @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

        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

    @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

    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

        // Mouse handler to enable users to quickly close the sheet
        final ContainerMouseListener displayMouseHandler = new ContainerMouseListener.Adapter() {
            @Override
            public boolean mouseDown(Container container, Mouse.Button button, int x, int y) {
                Display display = (Display) container;
                Component component = display.getComponentAt(x, y);

                // Close the sheet by clicking away from it.
                // This allows resizing etc to work without requiring
                // a close button or similar on the sheet.
                boolean consumed = (component != sheet);
                if (consumed) {
                    sheet.close();
                }
                return consumed;
            }
        };

        // Add/remove the mouse handler based on the Sheet's state
        sheet.getWindowStateListeners().add(new WindowStateListener.Adapter() {
            @Override
            public void windowOpened(Window window) {
                window.getDisplay().getContainerMouseListeners().add(displayMouseHandler);
            }

            @Override
            public void windowClosed(Window window, Display display, Window owner) {
                display.getContainerMouseListeners().remove(displayMouseHandler);
            }
        });
    }
View Full Code Here

        button.getButtonPressListeners().add(new ButtonPressListener() {
            @Override
            public void buttonPressed(Button buttonArgument) {
                prompt.open(frame);

                Display displayLocal = DesktopApplicationContext.createDisplay(640, 480, 100, 100, true,
                    true, false, buttonArgument.getDisplay().getHostWindow(), null);

                Window window = new Window();
                window.setTitle("New Secondary Window");
                window.setMaximized(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) {
            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

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.