Package org.apache.pivot.wtk

Examples of org.apache.pivot.wtk.Button


        }
    }

    @Override
    public void closeableChanged(TabPane tabPane) {
        Button selectedTabButton = tabButtonGroup.getSelection();

        if (selectedTabButton != null) {
            selectedTabButton.invalidate();
        }
    }
View Full Code Here


        int selectedIndex = tabPane.getSelectedIndex();

        if (selectedIndex != previousSelectedIndex) {
            // This was not an indirect selection change
            if (selectedIndex == -1) {
                Button button = tabButtonGroup.getSelection();
                if (button != null) {
                    button.setSelected(false);
                }
            } else {
                final Button button = (Button)tabButtonBoxPane.get(selectedIndex);
                button.setSelected(true);

                Component selectedTab = tabPane.getTabs().get(selectedIndex);
                selectedTab.setVisible(true);
                selectedTab.requestFocus();

                ApplicationContext.queueCallback(new Runnable(){
                    @Override
                    public void run() {
                        button.scrollAreaToVisible(0, 0, button.getWidth(), button.getHeight());
                    }
                });
            }

            if (previousSelectedIndex != -1) {
View Full Code Here

        });

        horizontalScrollBarPolicyGroup.getButtonGroupListeners().add(new ButtonGroupListener.Adapter() {
            @Override
            public void selectionChanged(ButtonGroup buttonGroup, Button previousSelection) {
                Button button = buttonGroup.getSelection();

                ScrollBarPolicy horizontalScrollBarPolicy = null;

                if (button == horizontalAutoButton) {
                    horizontalScrollBarPolicy = ScrollBarPolicy.AUTO;
                } else if (button == horizontalFillButton) {
                    horizontalScrollBarPolicy = ScrollBarPolicy.FILL;
                } else if (button == horizontalFillToCapacityButton) {
                    horizontalScrollBarPolicy = ScrollBarPolicy.FILL_TO_CAPACITY;
                } else if (button == horizontalNeverButton) {
                    horizontalScrollBarPolicy = ScrollBarPolicy.NEVER;
                } else if (button == horizontalAlwaysButton) {
                    horizontalScrollBarPolicy = ScrollBarPolicy.ALWAYS;
                }

                if (horizontalScrollBarPolicy != null) {
                    contentScrollPane.setHorizontalScrollBarPolicy(horizontalScrollBarPolicy);
                }
            }
        });

        verticalScrollBarPolicyGroup.getButtonGroupListeners().add(new ButtonGroupListener.Adapter() {
            @Override
            public void selectionChanged(ButtonGroup buttonGroup, Button previousSelection) {
                Button button = buttonGroup.getSelection();

                ScrollBarPolicy verticalScrollBarPolicy = null;

                if (button == verticalAutoButton) {
                    verticalScrollBarPolicy = ScrollBarPolicy.AUTO;
View Full Code Here

        buttonPanorama.setView(buttonBoxPane);

        tabButtonGroup.getButtonGroupListeners().add(new ButtonGroupListener.Adapter() {
            @Override
            public void selectionChanged(ButtonGroup buttonGroup, Button previousSelection) {
                Button button = tabButtonGroup.getSelection();
                int index = (button == null) ? -1 : buttonBoxPane.indexOf(button);

                TabPane tabPane = (TabPane)getComponent();
                tabPane.setSelectedIndex(index);
            }
View Full Code Here

    @Override
    public void selectedIndexChanged(TabPane tabPane, int previousSelectedIndex) {
        int selectedIndex = tabPane.getSelectedIndex();
        if (selectedIndex == -1) {
            Button button = tabButtonGroup.getSelection();
            if (button != null) {
                button.setSelected(false);
            }
        } else {
            final Button button = (Button)buttonBoxPane.get(selectedIndex);
            button.setSelected(true);

            Component selectedTab = tabPane.getTabs().get(selectedIndex);
            selectedTab.setVisible(true);
            selectedTab.requestFocus();

            ApplicationContext.queueCallback(new Runnable(){
                @Override
                public void run() {
                    button.scrollAreaToVisible(0, 0, button.getWidth(), button.getHeight());
                }
            });
        }

        if (previousSelectedIndex != -1) {
View Full Code Here

        buttonBevelColor = TerraTheme.brighten(buttonBackgroundColor);

        panelHeaderGroup.getButtonGroupListeners().add(new ButtonGroupListener.Adapter() {
            @Override
            public void selectionChanged(ButtonGroup buttonGroup, Button previousSelection) {
                Button button = panelHeaderGroup.getSelection();
                int index = (button == null) ? -1 : panelHeaders.indexOf((PanelHeader)button);

                Accordion accordion = (Accordion)getComponent();
                accordion.setSelectedIndex(index);
            }
View Full Code Here

    @Override
    public void selectedIndexChanged(Accordion accordion, int previousSelectedIndex) {
        int selectedIndex = accordion.getSelectedIndex();

        if (selectedIndex == -1) {
            Button button = panelHeaderGroup.getSelection();
            if (button != null) {
                button.setSelected(false);
            }
        } else {
            Button button = panelHeaders.get(selectedIndex);
            button.setSelected(true);

            Component selectedPanel = accordion.getPanels().get(selectedIndex);
            selectedPanel.requestFocus();
        }
View Full Code Here

        dateButtonGroup.getButtonGroupListeners().add(new ButtonGroupListener.Adapter() {
            @Override
            public void selectionChanged(ButtonGroup buttonGroup, Button previousSelection) {
                Calendar calendar = (Calendar)getComponent();

                Button selection = buttonGroup.getSelection();
                if (selection == null) {
                    CalendarDate selectedDate = calendar.getSelectedDate();

                    // If no date was selected, or the selection changed as a
                    // result of the user toggling the date button (as opposed
                    // to changing the month or year), clear the selection
                    if (selectedDate == null
                        || (selectedDate.year == yearSpinner.getSelectedIndex()
                            && selectedDate.month == monthSpinner.getSelectedIndex())) {
                        calendar.setSelectedDate((CalendarDate)null);
                    }
                } else {
                    calendar.setSelectedDate((CalendarDate)selection.getButtonData());
                }
            }
        });

        for (int j = 0; j < 6; j++) {
View Full Code Here

        updateSelection(calendar.getSelectedDate());
    }

    private void updateSelection(CalendarDate selectedDate) {
        Calendar calendar = (Calendar)getComponent();
        Button selection = dateButtonGroup.getSelection();

        if (selectedDate == null) {
            if (selection != null) {
                selection.setSelected(false);
            }
        } else {
            int year = selectedDate.year;
            int month = selectedDate.month;

            if (year == calendar.getYear()
                && month == calendar.getMonth()) {
                int day = selectedDate.day;

                // Update the button group
                int cellIndex = getCellIndex(year, month, day, calendar.getLocale());
                int rowIndex = cellIndex / 7;
                int columnIndex = cellIndex % 7;

                TablePane.Row row = calendarTablePane.getRows().get(rowIndex + 2);
                DateButton dateButton = (DateButton)row.get(columnIndex);
                dateButton.setSelected(true);
            } else {
                if (selection != null) {
                    selection.setSelected(false);
                }
            }
        }
    }
View Full Code Here

                rollup.setContent(component);

                alertButton.getButtonPressListeners().add(new ButtonPressListener() {
                    @Override
                    public void buttonPressed(Button button) {
                        Button selection = messageTypeGroup.getSelection();

                        Map<String, ?> userData;
                        try {
                            userData = JSONSerializer.parseMap((String)selection.getUserData().get("messageInfo"));
                        } catch (SerializationException exception) {
                            throw new RuntimeException(exception);
                        }

                        String messageType = (String)userData.get("messageType");

                        if (messageType == null) {
                            ArrayList<String> options = new ArrayList<String>();
                            options.add("OK");
                            options.add("Cancel");

                            Component body = null;
                            WTKXSerializer wtkxSerializer = new WTKXSerializer();
                            try {
                                body = (Component)wtkxSerializer.readObject(this, "alert.wtkx");
                            } catch(Exception exception) {
                                System.err.println(exception);
                            }

                            Alert alert = new Alert(MessageType.QUESTION, "Please select your favorite icon:",
                                options, body);
                            alert.setTitle("Select Icon");
                            alert.setSelectedOption(0);
                            alert.getDecorators().update(0, new ReflectionDecorator());
                            alert.open(window);
                        } else {
                            String message = (String)userData.get("message");
                            Alert.alert(MessageType.valueOf(messageType.toUpperCase()), message, window);
                        }
                    }
                });

                promptButton.getButtonPressListeners().add(new ButtonPressListener() {
                    @Override
                    public void buttonPressed(Button button) {
                        Button selection = messageTypeGroup.getSelection();

                        Map<String, ?> userData;
                        try {
                            userData = JSONSerializer.parseMap((String)selection.getUserData().get("messageInfo"));
                        } catch (SerializationException exception) {
                            throw new RuntimeException(exception);
                        }

                        String messageType = (String)userData.get("messageType");
View Full Code Here

TOP

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

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.