Examples of TabPane


Examples of org.apache.pivot.wtk.TabPane

        }
    }

    @Override
    public void paint(Graphics2D graphics) {
        TabPane tabPane = (TabPane)getComponent();

        Bounds tabPaneBounds = tabPane.getBounds();

        // Call the base class to paint the background
        super.paint(graphics);

        // Paint the content background and border
        int x = 0;
        int y = 0;
        int width = 0;
        int height = 0;

        switch (tabOrientation) {
            case HORIZONTAL: {
                x = 0;
                y = Math.max(buttonPanorama.getY() + buttonPanorama.getHeight() - 1, 0);
                width = tabPaneBounds.width;
                height = Math.max(tabPaneBounds.height - y, 0);

                break;
            }

            case VERTICAL: {
                x = Math.max(buttonPanorama.getX() + buttonPanorama.getWidth() - 1, 0);
                y = 0;
                width = Math.max(tabPaneBounds.width - x, 0);
                height = tabPaneBounds.height;

                break;
            }
        }

        int selectedIndex = tabPane.getSelectedIndex();
        if (selectedIndex != -1
            || selectionChangeTransition != null) {
            Bounds contentBounds = new Bounds(x, y, width, height);

            graphics.setPaint(activeTabColor);
View Full Code Here

Examples of org.apache.pivot.wtk.TabPane

        boolean consumed = super.keyPressed(component, keyCode, keyLocation);

        Keyboard.Modifier commandModifier = Platform.getCommandModifier();
        if (!consumed
            && Keyboard.isPressed(commandModifier)) {
            TabPane tabPane = (TabPane)getComponent();
            TabPane.TabSequence tabs = tabPane.getTabs();

            int selectedIndex = -1;

            switch (keyCode) {
                case Keyboard.KeyCode.KEYPAD_1:
                case Keyboard.KeyCode.N1: {
                    selectedIndex = 0;
                    break;
                }

                case Keyboard.KeyCode.KEYPAD_2:
                case Keyboard.KeyCode.N2: {
                    selectedIndex = 1;
                    break;
                }

                case Keyboard.KeyCode.KEYPAD_3:
                case Keyboard.KeyCode.N3: {
                    selectedIndex = 2;
                    break;
                }

                case Keyboard.KeyCode.KEYPAD_4:
                case Keyboard.KeyCode.N4: {
                    selectedIndex = 3;
                    break;
                }

                case Keyboard.KeyCode.KEYPAD_5:
                case Keyboard.KeyCode.N5: {
                    selectedIndex = 4;
                    break;
                }

                case Keyboard.KeyCode.KEYPAD_6:
                case Keyboard.KeyCode.N6: {
                    selectedIndex = 5;
                    break;
                }

                case Keyboard.KeyCode.KEYPAD_7:
                case Keyboard.KeyCode.N7: {
                    selectedIndex = 6;
                    break;
                }

                case Keyboard.KeyCode.KEYPAD_8:
                case Keyboard.KeyCode.N8: {
                    selectedIndex = 7;
                    break;
                }

                case Keyboard.KeyCode.KEYPAD_9:
                case Keyboard.KeyCode.N9: {
                    selectedIndex = 8;
                    break;
                }
            }

            if (selectedIndex >= 0
                && selectedIndex < tabs.getLength()
                && tabs.get(selectedIndex).isEnabled()) {
                tabPane.setSelectedIndex(selectedIndex);
                consumed = true;
            }
        }

        return consumed;
View Full Code Here

Examples of org.apache.pivot.wtk.TabPane

            if (selectionChangeTransition != null) {
                selectionChangeTransition.start(new TransitionListener() {
                    @Override
                    public void transitionCompleted(Transition transition) {
                        TabPane tabPane = (TabPane)getComponent();

                        SelectionChangeTransition selectionChangeTransition =
                            (SelectionChangeTransition)transition;

                        int selectedIndex;
                        if (selectionChangeTransition.expand) {
                            selectedIndex = tabPane.getTabs().indexOf(selectionChangeTransition.tab);
                        } else {
                            selectedIndex = -1;
                        }

                        tabPane.setSelectedIndex(selectedIndex);

                        TerraTabPaneSkin.this.selectionChangeTransition = null;
                    }
                });
            }
View Full Code Here

Examples of org.apache.pivot.wtk.TabPane

            return scale;
        }

        @Override
        public void start(TransitionListener transitionListener) {
            TabPane tabPane = (TabPane)getComponent();

            if (expand) {
                tab.setVisible(true);
            }

            tab.getDecorators().add(clipDecorator);
            tabPane.setEnabled(false);

            super.start(transitionListener);
        }
View Full Code Here

Examples of org.apache.pivot.wtk.TabPane

            super.start(transitionListener);
        }

        @Override
        public void stop() {
            TabPane tabPane = (TabPane)getComponent();

            if (!expand) {
                tab.setVisible(false);
            }

            tab.getDecorators().remove(clipDecorator);
            tabPane.setEnabled(true);

            super.stop();
        }
View Full Code Here

Examples of org.apache.pivot.wtk.TabPane

import org.apache.pivot.wtk.TabPaneSelectionListener;

public class Pivot751WithoutGUI extends Application.Adapter {

    public static void main(String[] args) {
        final TabPane tabPane = new TabPane();

        tabPane.getTabPaneSelectionListeners().add(new TabPaneSelectionListener.Adapter() {
            @Override
            public void selectedIndexChanged(TabPane tabPaneArgument, int previousSelectedIndex) {
                System.out.println(String.format("tabs     : %-16d actual selectedIndex    : %d",
                        tabPaneArgument.getTabs().getLength(), tabPaneArgument.getSelectedIndex()));
                System.out.println(String.format("indirect : %-16s 'previousSelectedIndex' : %d",
                        (previousSelectedIndex == tabPaneArgument.getSelectedIndex()), previousSelectedIndex));
            }
        });

        System.out.println("Empty TabPane sequence");
        System.out.println(String.format("tabs     : %-16d actual selectedIndex    : %d",
                tabPane.getTabs().getLength(), tabPane.getSelectedIndex()));

        System.out.println("\nAdding first Label to the sequence");
        tabPane.getTabs().add(new Label("1"));

        System.out.println("\nAdding second Label at the end of the sequence");
        tabPane.getTabs().add(new Label("2"));

        System.out.println("\nInserting third Label at the start of the sequence");
        tabPane.getTabs().insert(new Label("3"), 0);

        System.out.println("\nAdding a fourth Label at the end of the sequence");
        tabPane.getTabs().add(new Label("4"));

        System.out.println("\nExplicitly select the last tab");
        tabPane.setSelectedIndex(3);

        System.out.println("\nRemoving the first 2 Labels from the start of the sequence");
        tabPane.getTabs().remove(0, 2);

        System.out.println("\nRemoving the tab at the end of the sequence");
        tabPane.getTabs().remove(1, 1);
    }
View Full Code Here

Examples of org.apache.pivot.wtk.TabPane

    private static MyWindow buildWindow() {
        final HashMap<String, Object> namespace = new HashMap<String, Object>();

        return new MyWindow() {
            {   setContent(new TabPane() {
                    {   namespace.put("tabPane", this);

                        getTabs().add(new Label() {
                            {   setText("Label 1");
                                TabPane.setTabData(this, "Label 1");
View Full Code Here

Examples of org.apache.pivot.wtk.TabPane

            throw new UnsupportedOperationException();
        }

        @Override
        public Button.DataRenderer getDataRenderer() {
            TabPane tabPane = (TabPane)TerraTabPaneSkin.this.getComponent();
            return tabPane.getTabDataRenderer();
        }
View Full Code Here

Examples of org.apache.pivot.wtk.TabPane

        @Override
        public void press() {
            // If the tab pane is collapsible, toggle the button selection;
            // otherwise, select it
            TabPane tabPane = (TabPane)TerraTabPaneSkin.this.getComponent();
            setSelected(tabPane.isCollapsible() ? !isSelected() : true);
            super.press();
        }
View Full Code Here

Examples of org.apache.pivot.wtk.TabPane

        }

        @Override
        public Dimensions getPreferredSize() {
            TabButton tabButton = (TabButton)getComponent();
            TabPane tabPane = (TabPane)TerraTabPaneSkin.this.getComponent();

            Button.DataRenderer dataRenderer = tabButton.getDataRenderer();
            dataRenderer.render(tabButton.getButtonData(), tabButton, false);

            Dimensions preferredContentSize = dataRenderer.getPreferredSize();

            int preferredWidth = 0;
            int preferredHeight = 0;
            switch (tabOrientation) {
                case HORIZONTAL: {
                    preferredWidth = preferredContentSize.width
                        + buttonPadding.left + buttonPadding.right + 2;

                    preferredHeight = preferredContentSize.height
                        + buttonPadding.top + buttonPadding.bottom + 2;

                    if (tabPane.isCloseable()
                        && tabButton.isSelected()) {
                        preferredWidth += CLOSE_TRIGGER_SIZE + buttonSpacing;
                    }

                    break;
                }

                case VERTICAL: {
                    preferredWidth = preferredContentSize.height
                        + buttonPadding.top + buttonPadding.bottom + 2;

                    preferredHeight = preferredContentSize.width
                        + buttonPadding.left + buttonPadding.right + 2;

                    if (tabPane.isCloseable()
                        && tabButton.isSelected()) {
                        preferredHeight += CLOSE_TRIGGER_SIZE + buttonSpacing;
                    }

                    break;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.