Package org.apache.pivot.wtk

Examples of org.apache.pivot.wtk.Point


        if (resizable && button == Mouse.Button.LEFT) {
            Bounds resizeHandleBounds = resizeHandle.getBounds();

            if (resizeHandleBounds.contains(x, y)) {
                resizeOffset = new Point(getWidth() - x, getHeight() - y);
                Mouse.capture(container);
            }
        }

        return consumed;
View Full Code Here


        Sheet sheet = (Sheet)getComponent();

        Window owner = sheet.getOwner();
        Bounds clientArea = owner.getClientArea();

        Point location = owner.mapPointToAncestor(owner.getDisplay(), clientArea.x, clientArea.y);
        sheet.setLocation(location.x + (clientArea.width - getWidth()) / 2, location.y);
    }
View Full Code Here

                if (image != null) {
                    imageView.setImage((Image)null);
                    content = new LocalManifest();
                    content.putImage(image);
                    offset = new Point(x - (imageView.getWidth() - image.getWidth()) / 2,
                        y - (imageView.getHeight() - image.getHeight()) / 2);
                }

                return (image != null);
            }
View Full Code Here

        }
    }

    private Component addPointControl(final Dictionary<String, Object> dictionary,
        final String key, Form.Section section) {
        Point point = (Point)dictionary.get(key);

        BoxPane boxPane = new BoxPane(Orientation.VERTICAL);
        section.add(boxPane);
        Form.setLabel(boxPane, key);

        FlowPane flowPane = new FlowPane();
        flowPane.getStyles().put("alignToBaseline", true);
        flowPane.getStyles().put("horizontalSpacing", 5);
        boxPane.add(flowPane);

        TextInput textInput = new TextInput();
        textInput.setTextSize(3);
        textInput.setMaximumLength(4);
        textInput.setValidator(new IntValidator());
        textInput.setText(String.valueOf(point.x));
        flowPane.add(textInput);

        textInput.getComponentStateListeners().add(new ComponentStateListener.Adapter() {
            @Override
            public void focusedChanged(Component component, Component obverseComponent) {
                if (!component.isFocused()) {
                    TextInput textInput = (TextInput)component;
                    Point point = (Point)dictionary.get(key);

                    try {
                        int x = Integer.parseInt(textInput.getText());
                        dictionary.put(key, new Point(x, point.y));
                    } catch (Exception exception) {
                        displayErrorMessage(exception, component.getWindow());
                        textInput.setText(String.valueOf(point.x));
                    }
                }
            }
        });

        Label label = new Label("x");
        label.getStyles().put("font", "{italic:true}");
        flowPane.add(label);

        flowPane = new FlowPane();
        flowPane.getStyles().put("alignToBaseline", true);
        flowPane.getStyles().put("horizontalSpacing", 5);
        boxPane.add(flowPane);

        textInput = new TextInput();
        textInput.setTextSize(3);
        textInput.setMaximumLength(4);
        textInput.setValidator(new IntValidator());
        textInput.setText(String.valueOf(point.y));
        flowPane.add(textInput);

        textInput.getComponentStateListeners().add(new ComponentStateListener.Adapter() {
            @Override
            public void focusedChanged(Component component, Component obverseComponent) {
                if (!component.isFocused()) {
                    TextInput textInput = (TextInput)component;
                    Point point = (Point)dictionary.get(key);

                    try {
                        int y = Integer.parseInt(textInput.getText());
                        dictionary.put(key, new Point(point.x, y));
                    } catch (Exception exception) {
                        displayErrorMessage(exception, component.getWindow());
                        textInput.setText(String.valueOf(point.y));
                    }
                }
View Full Code Here

    private void updatePointControl(Dictionary<String, Object> dictionary, String key) {
        BoxPane boxPane = (BoxPane)controls.get(key);

        if (boxPane != null) {
            Point point = (Point)dictionary.get(key);

            TextInput xTextInput = (TextInput)((FlowPane)boxPane.get(0)).get(0);
            TextInput yTextInput = (TextInput)((FlowPane)boxPane.get(1)).get(0);

            xTextInput.setText(String.valueOf(point.x));
View Full Code Here

        listView.scrollAreaToVisible(editBounds.x, editBounds.y,
            textBounds.width + padding.left + 1, editBounds.height);

        // Constrain the bounds by what is visible through viewport ancestors
        editBounds = listView.getVisibleArea(editBounds);
        Point location = listView.mapPointToAncestor(listView.getDisplay(), editBounds.x, editBounds.y);

        textInput.setPreferredWidth(editBounds.width);
        setLocation(location.x, location.y + (editBounds.height - getPreferredHeight(-1)) / 2);

        // Open the editor
View Full Code Here

        // Scroll to make the row as visible as possible
        tableView.scrollAreaToVisible(rowBounds.x, rowBounds.y, rowBounds.width, rowBounds.height);

        // Constrain the bounds by what is visible through viewport ancestors
        rowBounds = tableView.getVisibleArea(rowBounds);
        Point location = tableView.mapPointToAncestor(tableView.getDisplay(), rowBounds.x, rowBounds.y);

        // Set size and location and match scroll left
        setPreferredWidth(rowBounds.width);
        setLocation(location.x, location.y + (rowBounds.height - getPreferredHeight(-1)) / 2);
View Full Code Here

        treeView.scrollAreaToVisible(editBounds.x, editBounds.y,
            textBounds.width + padding.left + 1, editBounds.height);

        // Constrain the bounds by what is visible through viewport ancestors
        editBounds = treeView.getVisibleArea(editBounds);
        Point location = treeView.mapPointToAncestor(treeView.getDisplay(), editBounds.x, editBounds.y);

        textInput.setPreferredWidth(editBounds.width);
        setLocation(location.x, location.y + (editBounds.height - getPreferredHeight(-1)) / 2);

        // Open the editor
View Full Code Here

        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);
            menuPopup.open(menuItem.getWindow());
View Full Code Here

        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

TOP

Related Classes of org.apache.pivot.wtk.Point

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.