001/*
002 * $Id: MetalLookAndFeelAddons.java 4092 2011-11-30 18:04:36Z 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 */
021package org.jdesktop.swingx.plaf.metal;
022
023import static javax.swing.UIManager.getCrossPlatformLookAndFeelClassName;
024import static javax.swing.UIManager.getLookAndFeel;
025
026import javax.swing.LookAndFeel;
027import javax.swing.plaf.metal.MetalLookAndFeel;
028
029import org.jdesktop.swingx.plaf.LookAndFeelAddons;
030import org.jdesktop.swingx.plaf.basic.BasicLookAndFeelAddons;
031import org.kohsuke.MetaInfServices;
032
033/**
034 * MetalLookAndFeelAddons.<br>
035 * 
036 */
037@MetaInfServices(LookAndFeelAddons.class)
038public class MetalLookAndFeelAddons extends BasicLookAndFeelAddons {
039    /**
040     * {@inheritDoc}
041     */
042    @Override
043    protected boolean matches() {
044        LookAndFeel laf = getLookAndFeel();
045        
046        if (getCrossPlatformLookAndFeelClassName().equals(laf.getClass().getName())) {
047            //just in case someone sets Nimbus as the cross platform Look and Feel
048            return !laf.getID().equals("Nimbus");
049        }
050        
051        return getLookAndFeel() instanceof MetalLookAndFeel;
052    }
053
054    @Override
055    public void initialize() {
056        super.initialize();
057        loadDefaults(getDefaults());
058    }
059
060    @Override
061    public void uninitialize() {
062        super.uninitialize();
063        unloadDefaults(getDefaults());
064    }
065
066    private Object[] getDefaults() {
067        return new Object[] {
068        // "DirectoryChooserUI",
069        // "org.jdesktop.jdnc.swing.plaf.windows.WindowsDirectoryChooserUI",
070        };
071    }
072}