Package pivot.wtk

Examples of pivot.wtk.Menu$MenuItemSelectionListenerList


        if (menuPopup.isOpen()) {
            Component.getComponentClassListeners().add(this);
        }

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

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


        if (menuPopup.isOpen()) {
            Component.getComponentClassListeners().remove(this);
        }

        Menu menu = menuPopup.getMenu();
        if (menu != null) {
            menu.getMenuItemSelectionListeners().remove(menuItemPressListener);
        }

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

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

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

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

        // No-op
    }

    public void paint(Graphics2D graphics) {
        Menu.Item menuItem = (Menu.Item)getComponent();
        Menu menu = menuItem.getSection().getMenu();

        int width = getWidth();
        int height = getHeight();

        boolean highlight = (menuItem.isFocused()
            || menuPopup.isOpen());

        // Paint highlight state
        if (highlight) {
            Color highlightBackgroundColor = (Color)menu.getStyles().get("highlightBackgroundColor");
            graphics.setPaint(new GradientPaint(width / 2, 0, TerraTheme.brighten(highlightBackgroundColor),
                width / 2, height, highlightBackgroundColor));
            graphics.fillRect(0, 0, width, height);
        }

        // Paint the content
        Button.DataRenderer dataRenderer = menuItem.getDataRenderer();
        dataRenderer.render(menuItem.getButtonData(), menuItem, highlight);
        dataRenderer.setSize(Math.max(width - EXPANDER_SIZE, 0), height);

        dataRenderer.paint(graphics);

        // Paint the expander
        if (menuItem.getMenu() != null) {
            Color color = (Color)(highlight ?
                menu.getStyles().get("highlightColor") : menu.getStyles().get("color"));
            graphics.setColor(color);
            graphics.setStroke(new BasicStroke(0));

            graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                RenderingHints.VALUE_ANTIALIAS_ON);
View Full Code Here

            return SIZE;
        }

        public void paint(Graphics2D graphics) {
            Menu.Item menuItem = (Menu.Item)getComponent();
            Menu menu = menuItem.getSection().getMenu();

            Color color = (Color)menu.getStyles().get("color");
            graphics.setColor(color);
            graphics.setStroke(new BasicStroke(2.5f));

            graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                RenderingHints.VALUE_ANTIALIAS_ON);
View Full Code Here

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

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

        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
        Object font = menu.getStyles().get("font");
        if (font instanceof Font) {
            textLabel.getStyles().put("font", font);
            keyboardShortcutLabel.getStyles().put("font",
                ((Font)font).deriveFont(Font.ITALIC));
        }

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

        if (color instanceof Color) {
            textLabel.getStyles().put("color", color);
            keyboardShortcutLabel.getStyles().put("color", color);
        }

        textLabel.setText(text);

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

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

    }

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

        Menu menu = (Menu)component;
        menu.getMenuListeners().add(this);
    }
View Full Code Here

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

    public void uninstall() {
        Menu menu = (Menu)getComponent();
        menu.getMenuListeners().remove(this);

        super.uninstall();
    }
View Full Code Here

    }

    public int getPreferredWidth(int height) {
        int preferredWidth = 0;

        Menu menu = (Menu)getComponent();
        Menu.SectionSequence sections = menu.getSections();

        for (int i = 0, n = sections.getLength(); i < n; i++) {
            Menu.Section section = sections.get(i);

            for (Menu.Item item : section) {
View Full Code Here

    }

    public int getPreferredHeight(int width) {
        int preferredHeight = 0;

        Menu menu = (Menu)getComponent();
        Menu.SectionSequence sections = menu.getSections();

        for (int i = 0, n = sections.getLength(); i < n; i++) {
            Menu.Section section = sections.get(i);

            for (Menu.Item item : section) {
View Full Code Here

TOP

Related Classes of pivot.wtk.Menu$MenuItemSelectionListenerList

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.