Package org.apache.pivot.wtk

Examples of org.apache.pivot.wtk.Menu$MenuListenerList


        MenuPopup menuPopup = (MenuPopup)component;
        menuPopup.getMenuPopupListeners().add(this);
        menuPopup.getMenuPopupStateListeners().add(this);

        Menu menu = menuPopup.getMenu();
        if (menu != null) {
            menu.getMenuItemSelectionListeners().add(menuItemSelectionListener);
        }

        panorama.setView(menu);
        menuPopup.setContent(border);
View Full Code Here


        Display display = window.getDisplay();
        display.getContainerMouseListeners().add(displayMouseListener);

        MenuPopup menuPopup = (MenuPopup)window;
        Menu menu = menuPopup.getMenu();
        if (menu != null) {
            Menu.Item activeItem = menu.getActiveItem();
            if (activeItem != null) {
                activeItem.setActive(false);
            }

            menu.requestFocus();
        }

        panorama.setScrollTop(0);

        // Always ensure that the menu popup fits on the display.
View Full Code Here

    public void menuChanged(MenuPopup menuPopup, Menu previousMenu) {
        if (previousMenu != null) {
            previousMenu.getMenuItemSelectionListeners().remove(menuItemSelectionListener);
        }

        Menu menu = menuPopup.getMenu();
        if (menu != null) {
            menu.getMenuItemSelectionListeners().add(menuItemSelectionListener);
        }

        panorama.setView(menu);
    }
View Full Code Here

            icon = (Image)button.getStyles().get("checkmarkImage");
        }

        // Update the image view
        Menu.Item menuItem = (Menu.Item)button;
        Menu menu = (Menu)menuItem.getParent();

        int margin = (Integer)menu.getStyles().get("margin");
        Insets padding = (Insets)getStyles().get("padding");

        imageView.setImage(icon);
        imageView.setPreferredWidth(margin - padding.left * 2);
        imageView.getStyles().put("opacity", button.isEnabled() ? 1.0f : 0.5f);

        // Update the labels
        textLabel.setText(text != null ? text : "");

        Font font = (Font)menu.getStyles().get("font");
        textLabel.getStyles().put("font", font);
        keyboardShortcutLabel.getStyles().put("font", font.deriveFont(Font.ITALIC));

        Color color;
        if (button.isEnabled()) {
            if (highlighted) {
                color = (Color)menu.getStyles().get("activeColor");
            } else {
                color = (Color)menu.getStyles().get("color");
            }
        } else {
            color = (Color)menu.getStyles().get("disabledColor");
        }

        textLabel.getStyles().put("color", color);
        keyboardShortcutLabel.getStyles().put("color", color);

        boolean showKeyboardShortcuts = false;
        if (menu.getStyles().containsKey("showKeyboardShortcuts")) {
            showKeyboardShortcuts = (Boolean)menu.getStyles().get("showKeyboardShortcuts");
        }

        if (showKeyboardShortcuts) {
            keyboardShortcutLabel.setVisible(true);
            keyboardShortcutLabel.setText(
View Full Code Here

        MenuPopup menuPopup = (MenuPopup)component;
        menuPopup.getMenuPopupListeners().add(this);
        menuPopup.getMenuPopupStateListeners().add(this);

        Menu menu = menuPopup.getMenu();
        if (menu != null) {
            menu.getMenuItemSelectionListeners().add(menuItemSelectionListener);
        }

        panorama.setView(menu);
        menuPopup.setContent(border);
View Full Code Here

        Display display = window.getDisplay();
        display.getContainerMouseListeners().add(displayMouseListener);

        MenuPopup menuPopup = (MenuPopup)window;
        Menu menu = menuPopup.getMenu();
        if (menu != null) {
            Menu.Item activeItem = menu.getActiveItem();
            if (activeItem != null) {
                activeItem.setActive(false);
            }

            menu.requestFocus();
        }

        if (menuPopup.isContextMenu()) {
            ApplicationContext.queueCallback(new RepositionCallback());
        }
View Full Code Here

    public void menuChanged(MenuPopup menuPopup, Menu previousMenu) {
        if (previousMenu != null) {
            previousMenu.getMenuItemSelectionListeners().remove(menuItemSelectionListener);
        }

        Menu menu = menuPopup.getMenu();
        if (menu != null) {
            menu.getMenuItemSelectionListeners().add(menuItemSelectionListener);
        }

        panorama.setView(menu);
    }
View Full Code Here

            icon = (Image)button.getStyles().get("checkmarkImage");
        }

        // Update the image view
        Menu.Item menuItem = (Menu.Item)button;
        Menu menu = (Menu)menuItem.getParent();

        int margin = (Integer)menu.getStyles().get("margin");
        Insets padding = (Insets)getStyles().get("padding");

        imageView.setImage(icon);
        imageView.setPreferredWidth(margin - padding.left * 2);
        imageView.getStyles().put("opacity", button.isEnabled() ? 1.0f : 0.5f);

        // Update the labels
        textLabel.setText(text);

        Font font = (Font)menu.getStyles().get("font");
        textLabel.getStyles().put("font", font);
        keyboardShortcutLabel.getStyles().put("font", font.deriveFont(Font.ITALIC));

        Color color;
        if (button.isEnabled()) {
            if (highlighted) {
                color = (Color)menu.getStyles().get("activeColor");
            } else {
                color = (Color)menu.getStyles().get("color");
            }
        } else {
            color = (Color)menu.getStyles().get("disabledColor");
        }

        textLabel.getStyles().put("color", color);
        keyboardShortcutLabel.getStyles().put("color", color);

        boolean showKeyboardShortcuts = false;
        if (menu.getStyles().containsKey("showKeyboardShortcuts")) {
            showKeyboardShortcuts = (Boolean)menu.getStyles().get("showKeyboardShortcuts");
        }

        if (showKeyboardShortcuts) {
            keyboardShortcutLabel.setVisible(true);
            keyboardShortcutLabel.setText(keyboardShortcut == null ?
View Full Code Here

    }

    @Override
    public void buttonPressed(Button button) {
        Menu.Item menuItem = (Menu.Item)getComponent();
        Menu menu = menuItem.getMenu();

        if (menu != null
            && !menuPopup.isOpen()) {
            Display display = menuItem.getDisplay();
            Point location = menuItem.mapPointToAncestor(display, getWidth(), 0);
View Full Code Here

    @Override
    public void install(Component component) {
        super.install(component);

        Menu menu = (Menu)component;
        menu.getMenuListeners().add(this);

        for (Menu.Section section : menu.getSections()) {
            section.getSectionListeners().add(this);
        }

        menu.setFocusTraversalPolicy(new IndexFocusTraversalPolicy(true));
    }
View Full Code Here

TOP

Related Classes of org.apache.pivot.wtk.Menu$MenuListenerList

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.