Package org.flexdock.plaf.icons

Examples of org.flexdock.plaf.icons.IconResource


        return icon;
    }

    protected Icon getActionIcon(AbstractButton button, boolean pressed, boolean active, boolean hover) {
        Action action = button.getAction();
        IconResource resource = action==null? null: (IconResource)action.getValue(ICON_RESOURCE);
        if(resource==null)
            return null;

        boolean disabled = !button.isEnabled() || !button.getModel().isEnabled();
        boolean selected = button.isSelected();


        if(pressed && !disabled) {
            Icon icon = selected? resource.getIconSelectedPressed(): null;
            if(icon==null)
                icon = resource.getIconPressed();
            return icon;
        }

        if(active) {
            if(disabled) {
                Icon icon = selected? resource.getIconSelectedActiveDisabled(): null;
                if(icon==null)
                    icon = resource.getIconActiveDisabled();
                return icon==null? resource.getIconActive(): icon;
            }

            if(hover) {
                Icon icon = selected? resource.getIconSelectedActiveHover(): null;
                if(icon==null)
                    icon = resource.getIconActiveHover();
                return icon;
            }

            Icon icon = selected? resource.getIconSelectedActive(): null;
            if(icon==null)
                icon = resource.getIconActive();
            return icon;
        }

        if(disabled) {
            Icon icon = selected? resource.getIconSelectedDisabled(): null;
            if(icon==null)
                icon = resource.getIconDisabled();
            return icon==null? resource.getIcon(): icon;
        }

        if(hover) {
            Icon icon = selected? resource.getIconSelectedHover(): null;
            if(icon==null)
                icon = resource.getIconHover();
            return icon;
        }

        Icon icon = selected? resource.getIconSelected(): null;
        if(icon==null)
            icon = resource.getIcon();
        return icon;
    }
View Full Code Here


        String toolTip = (String)action.getValue(Action.SHORT_DESCRIPTION);
        if(toolTip!=null)
            return;

        IconResource resource = action==null? null: (IconResource)action.getValue(ICON_RESOURCE);
        if(resource==null)
            return;

        toolTip = button.isSelected()? resource.getTooltipSelected(): resource.getTooltip();
        if(toolTip==null)
            toolTip = resource.getTooltip();

        if(toolTip!=null)
            button.setToolTipText(toolTip);
    }
View Full Code Here

    public void configureAction(Action action) {
        if (action == null)
            return;

        IconResource icons = getIcons(action);
        if (icons != null) {
            action.putValue(ICON_RESOURCE, icons);
        }
    }
View Full Code Here

    public IconResource getIcons(String key) {
        return defaultIcons == null ? null : defaultIcons.getIcons(key);
    }

    public Action getAction(String actionKey) {
        IconResource resource = getIcons(actionKey);
        Action action = resource==null? null: resource.getAction();
        if(action!=null)
            action.putValue(Action.NAME, actionKey);
        return action;
    }
View Full Code Here

TOP

Related Classes of org.flexdock.plaf.icons.IconResource

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.