001/*
002 * $Id: WindowsClassicLookAndFeelAddons.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.windows;
022
023import static javax.swing.UIManager.getLookAndFeel;
024import static javax.swing.UIManager.getSystemLookAndFeelClassName;
025
026import org.jdesktop.swingx.plaf.LookAndFeelAddons;
027import org.jdesktop.swingx.util.OS;
028import org.kohsuke.MetaInfServices;
029
030/**
031 * Adds new pluggable UI following the Windows Classic look and feel. Currently
032 * it extends the XP look and feel and overrides the <code>JTaskPane</code>
033 * and <code>JTaskPaneGroup</code> UIs.
034 */
035@MetaInfServices(LookAndFeelAddons.class)
036public class WindowsClassicLookAndFeelAddons extends WindowsLookAndFeelAddons {
037    
038    /**
039     * {@inheritDoc}
040     */
041    @Override
042    protected boolean matches() {
043        String laf = getLookAndFeel().getClass().getName();
044        
045        if (isSystemAddon()) {
046            //special-case the jgoodies to ensure that we can match it
047            return getSystemLookAndFeelClassName().equals(laf)
048                    || "com.jgoodies.looks.windows.WindowsLookAndFeel".equals(laf);
049        }
050        
051        return "com.sun.java.swing.plaf.windows.WindowsClassicLookAndFeel".equals(laf);
052    }
053
054    /**
055     * {@inheritDoc}
056     */
057    @Override
058    protected boolean isSystemAddon() {
059        return OS.isWindows() && !OS.isUsingWindowsVisualStyles();
060    }
061}