001    /*
002     * $Id: StatusBarAddon.java 3405 2009-07-23 17:24:40Z kschaefe $
003     *
004     * Copyright 2004 Sun Microsystems, Inc., 4150 Network Circle,
005     * Santa Clara, California 95054, U.S.A. All rights reserved.
006     *
007     * This library is free software; you can redistribute it and/or
008     * modify it under the terms of the GNU Lesser General Public
009     * License as published by the Free Software Foundation; either
010     * version 2.1 of the License, or (at your option) any later version.
011     *
012     * This library is distributed in the hope that it will be useful,
013     * but WITHOUT ANY WARRANTY; without even the implied warranty of
014     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
015     * Lesser General Public License for more details.
016     *
017     * You should have received a copy of the GNU Lesser General Public
018     * License along with this library; if not, write to the Free Software
019     * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
020     */
021    package org.jdesktop.swingx.plaf;
022    
023    import org.jdesktop.swingx.JXStatusBar;
024    import org.jdesktop.swingx.plaf.windows.WindowsLookAndFeelAddons;
025    import org.jdesktop.swingx.util.OS;
026    
027    /**
028     * Addon for <code>JXStatusBar</code>.<br>
029     *
030     */
031    public class StatusBarAddon extends AbstractComponentAddon {
032        
033        public StatusBarAddon() {
034            super("JXStatusBar");
035        }
036        
037        @Override
038        protected void addBasicDefaults(LookAndFeelAddons addon, DefaultsList defaults) {
039            super.addBasicDefaults(addon, defaults);
040            
041            defaults.add(JXStatusBar.uiClassID,
042                    "org.jdesktop.swingx.plaf.basic.BasicStatusBarUI");
043        }
044        
045        @Override
046        protected void addMacDefaults(LookAndFeelAddons addon, DefaultsList defaults) {
047            super.addMacDefaults(addon, defaults);
048            
049            defaults.add(JXStatusBar.uiClassID,
050                    "org.jdesktop.swingx.plaf.macosx.MacOSXStatusBarUI");
051        }
052        
053        protected void addMetalDefaults(LookAndFeelAddons addon, DefaultsList defaults) {
054            super.addMetalDefaults(addon, defaults);
055            
056            defaults.add(JXStatusBar.uiClassID,
057                    "org.jdesktop.swingx.plaf.metal.MetalStatusBarUI");
058        }
059        
060        protected void addWindowsDefaults(LookAndFeelAddons addon, DefaultsList defaults) {
061            super.addWindowsDefaults(addon, defaults);
062            if (OS.isUsingWindowsVisualStyles()) {
063                defaults.add(JXStatusBar.uiClassID,
064                        "org.jdesktop.swingx.plaf.windows.WindowsStatusBarUI");
065                
066                String xpStyle = OS.getWindowsVisualStyle();
067                
068                if (WindowsLookAndFeelAddons.SILVER_VISUAL_STYLE.equalsIgnoreCase(xpStyle)
069                        || WindowsLookAndFeelAddons.VISTA_VISUAL_STYLE.equalsIgnoreCase(xpStyle)) {
070                    defaults.add("StatusBar.leftImage", "resources/silver-statusbar-left.png");
071                    defaults.add("StatusBar.middleImage", "resources/silver-statusbar-middle.png");
072                    defaults.add("StatusBar.rightImage", "resources/silver-statusbar-right.png");
073                } else {
074                    defaults.add("StatusBar.leftImage", "resources/statusbar-left.png");
075                    defaults.add("StatusBar.middleImage", "resources/statusbar-middle.png");
076                    defaults.add("StatusBar.rightImage", "resources/statusbar-right.png");
077                }
078            } else {
079                defaults.add(JXStatusBar.uiClassID,
080                        "org.jdesktop.swingx.plaf.windows.WindowsClassicStatusBarUI");
081            }
082        }
083    }