Package pivot.wtk

Examples of pivot.wtk.Component$ComponentKeyListenerList


        CardPane cardPane = (CardPane)getComponent();
        int width = getWidth();
        int height = getHeight();

        if (selectionChangeTransition == null) {
            Component selectedCard = cardPane.getSelectedCard();

            for (Component card : cardPane) {
                // Set the size of the selected component to the container's size
                // and show the card
                if (card == selectedCard) {
                    card.setLocation(0, 0);
                    card.setSize(width, height);
                    card.setVisible(true);
                } else {
                    card.setVisible(false);
                }
            }
        } else {
            if (matchSelectedCardSize) {
                Component previousSelectedCard = selectionChangeTransition.getPreviousSelectedCard();
                Component selectedCard = selectionChangeTransition.getSelectedCard();

                Orientation orientation = cardPane.getOrientation();

                if (selectionChangeTransition.isRunning()) {
                    for (Component card : cardPane) {
                        // Center old and new cards and ensure they are visible
                        if (card == previousSelectedCard
                            || card == selectedCard) {
                            int x = (orientation == Orientation.VERTICAL) ?
                                0 : Math.round((float)(width - card.getWidth()) / 2);
                            int y = (orientation == Orientation.HORIZONTAL) ?
                                0 : Math.round((float)(height - card.getHeight()) / 2);

                            card.setLocation(x, y);
                            card.setVisible(true);
                        } else {
                            card.setVisible(false);
                        }
                    }
                } else {
                    if (previousSelectedCard != null) {
                        previousSelectedCard.setSize(previousSelectedCard.getPreferredSize());
                    }

                    if (selectedCard != null) {
                        selectedCard.setSize(selectedCard.getPreferredSize());
                        selectedCard.setVisible(true);
                    }
                }
            } else {
                if (selectionChangeTransition.isRunning()) {
                    int previousSelectedIndex = selectionChangeTransition.previousSelectedIndex;
                    int selectedIndex = selectionChangeTransition.selectedIndex;

                    if (previousSelectedIndex != -1
                        && selectedIndex != -1) {
                        float percentComplete = selectionChangeTransition.getEasedSlidePercentComplete();

                        int direction = Integer.signum(previousSelectedIndex - selectedIndex);

                        int dx = (int)((float)width * percentComplete) * direction;
                        int dy = (int)((float)height * percentComplete) * direction;

                        Orientation orientation = cardPane.getOrientation();

                        for (int i = 0, n = cardPane.getLength(); i < n; i++) {
                            Component card = cardPane.get(i);

                            if (i == previousSelectedIndex) {
                                if (orientation == Orientation.HORIZONTAL) {
                                    card.setLocation(dx, 0);
                                } else {
                                    card.setLocation(0, dy);
                                }

                                card.setVisible(true);
                            } else if (i == selectedIndex) {
                                if (orientation == Orientation.HORIZONTAL) {
                                    card.setLocation(-width * direction + dx, 0);
                                } else {
                                    card.setLocation(0, -height * direction + dy);
                                }

                                card.setVisible(true);
                            } else {
                                card.setVisible(false);
                            }
                        }
                    }
                } else {
                    Component selectedCard = selectionChangeTransition.getSelectedCard();
                    Orientation orientation = cardPane.getOrientation();

                    if (selectedCard != null) {
                        if (orientation == Orientation.HORIZONTAL) {
                            for (Component card : cardPane) {
                                height = Math.max(height, card.getPreferredHeight(width));
                            }
                        } else {
                            for (Component card : cardPane) {
                                width = Math.max(height, card.getPreferredWidth(height));
                            }
                        }

                        selectedCard.setSize(width, height);
                        selectedCard.setVisible(true);
                    }
                }
            }
        }
    }
View Full Code Here


        MenuBar.Item menuBarItem = (MenuBar.Item)getComponent();

        if (keyCode == Keyboard.KeyCode.UP) {
            menuPopup.requestFocus();
            Component focusedComponent = Component.getFocusedComponent();
            if (focusedComponent != null) {
                focusedComponent.transferFocus(Direction.BACKWARD);
            }

            consumed = true;
        } else if (keyCode == Keyboard.KeyCode.DOWN) {
            menuPopup.requestFocus();
View Full Code Here

    public void buttonPressed(Button button) {
        if (menuPopup.isOpen()) {
            menuPopup.close();
        } else {
            MenuButton menuButton = (MenuButton)getComponent();
            Component content = menuPopup.getContent();

            // Determine the popup's location and preferred size, relative
            // to the button
            Window window = menuButton.getWindow();

            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();
                Dimensions popupSize = content.getPreferredSize();

                int x = buttonLocation.x;
                if (popupSize.width > width
                    && x + popupSize.width > displaySize.width) {
                    x = buttonLocation.x + width - popupSize.width;
View Full Code Here

            if (direction == null) {
                throw new IllegalArgumentException("direction is null.");
            }

            Component nextComponent = null;

            int n = container.getLength();
            if (n > 0) {
                switch (direction) {
                    case FORWARD: {
View Full Code Here

        if (keyCode == Keyboard.KeyCode.TAB
            && getComponent().isFocused()) {
            Direction direction = (Keyboard.isPressed(Keyboard.Modifier.SHIFT)) ?
                Direction.BACKWARD : Direction.FORWARD;

            Component previousFocusedComponent = Component.getFocusedComponent();
            previousFocusedComponent.transferFocus(direction);

            Component focusedComponent = Component.getFocusedComponent();

            consumed = (previousFocusedComponent != focusedComponent);
        }

        return consumed;
View Full Code Here

    ComponentLayoutListener, ComponentStateListener, ComponentMouseListener,
    ComponentMouseButtonListener, ComponentMouseWheelListener,
    ComponentKeyListener {
    private class ShowTooltipCallback implements Runnable {
        public void run() {
            Component component = getComponent();
            String tooltipText = component.getTooltipText();

            // The tooltip text may have been cleared while the timeout was
            // outstanding; if so, don't display the tooltip
            if (tooltipText != null) {
                Tooltip tooltip = new Tooltip(tooltipText);

                // TODO Ensure that the tooltip stays on screen
                Point mouseLocation = component.getDisplay().getMouseLocation();
                tooltip.setLocation(mouseLocation.x + 16, mouseLocation.y);
                tooltip.open(component.getWindow());
            }
        }
View Full Code Here

            LineMetrics lm = font.getLineMetrics(title, fontRenderContext);
            topThickness = Math.max((int)Math.ceil(lm.getAscent() + lm.getDescent()
                + lm.getLeading()), topThickness);
        }

        Component content = border.getContent();
        if (content != null
            && content.isDisplayable()) {
            if (height != -1) {
                height = Math.max(height - (topThickness + thickness) -
                    padding.top - padding.bottom, 0);
            }

            preferredWidth = content.getPreferredWidth(height);
        }

        preferredWidth += (padding.left + padding.right) + (thickness * 2);

        return preferredWidth;
View Full Code Here

            LineMetrics lm = font.getLineMetrics(title, fontRenderContext);
            topThickness = Math.max((int)Math.ceil(lm.getAscent() + lm.getDescent()
                + lm.getLeading()), topThickness);
        }

        Component content = border.getContent();
        if (content != null
            && content.isDisplayable()) {
            if (width != -1) {
                width = Math.max(width - (thickness * 2)
                    - padding.left - padding.right, 0);
            }

            preferredHeight = content.getPreferredHeight(width);
        }

        preferredHeight += (padding.top + padding.bottom) + (topThickness + thickness);

        return preferredHeight;
View Full Code Here

            LineMetrics lm = font.getLineMetrics(title, fontRenderContext);
            topThickness = Math.max((int)Math.ceil(lm.getAscent() + lm.getDescent()
                + lm.getLeading()), topThickness);
        }

        Component content = border.getContent();
        if (content != null) {
            if (content.isDisplayable()) {
                content.setVisible(true);

                content.setLocation(padding.left + thickness,
                    padding.top + topThickness);

                int contentWidth = Math.max(width - (padding.left + padding.right
                    + (thickness * 2)), 0);
                int contentHeight = Math.max(height - (padding.top + padding.bottom
                    + (topThickness + thickness)), 0);

                content.setSize(contentWidth, contentHeight);
            } else {
                content.setVisible(false);
            }
        }
    }
View Full Code Here

    public void startup(Display display, Dictionary<String, String> properties)
        throws Exception {
        WTKXSerializer wtkxSerializer = new WTKXSerializer();

        Component content =
            (Component)wtkxSerializer.readObject(getClass().getResource("fixed_column_table.wtkx"));

        // Get references to the table views and table view headers
        final TableView primaryTableView =
            (TableView)wtkxSerializer.getObjectByName("primaryTableView");
View Full Code Here

TOP

Related Classes of pivot.wtk.Component$ComponentKeyListenerList

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.