com.alee.managers.style.data.SkinInfo Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of weblaf-ui Show documentation
Show all versions of weblaf-ui Show documentation
WebLaf is a Java Swing Look and Feel and extended components library for cross-platform applications
/*
* This file is part of WebLookAndFeel library.
*
* WebLookAndFeel library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* WebLookAndFeel library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with WebLookAndFeel library. If not, see .
*/
package com.alee.managers.style.data;
import com.alee.api.IconSupport;
import com.alee.api.TitleSupport;
import com.alee.managers.log.Log;
import com.alee.managers.style.StyleException;
import com.alee.managers.style.StyleId;
import com.alee.managers.style.StyleableComponent;
import com.alee.utils.ReflectUtils;
import com.alee.utils.TextUtils;
import com.thoughtworks.xstream.annotations.XStreamAlias;
import com.thoughtworks.xstream.annotations.XStreamConverter;
import com.thoughtworks.xstream.annotations.XStreamImplicit;
import javax.swing.*;
import java.io.Serializable;
import java.net.URL;
import java.util.List;
import java.util.Map;
/**
* Skin information class.
*
* @author Mikle Garin
* @see How to use StyleManager
* @see com.alee.managers.style.StyleManager
*/
@XStreamAlias ( "skin" )
@XStreamConverter ( SkinInfoConverter.class )
public final class SkinInfo implements IconSupport, TitleSupport, Serializable
{
/**
* Unique skin ID.
* Used to collect and manage skins within StyleManager.
*/
private String id;
/**
* Skin icon.
*/
private Icon icon;
/**
* Skin title.
* Might be used to display skin selection and options.
*/
private String title;
/**
* Skin description.
* You are free to put here any description you like.
*/
private String description;
/**
* Skin author name.
*/
private String author;
/**
* List of OS supported by this skin separated by "," character.
* List of OS IDs constants can be found in SystemUtils class.
* If skin supports all OS you can simply put "all" here.
*/
private String supportedSystems;
/**
* Skin class canonical name.
* Used to locate included resources.
*/
@XStreamAlias ( "class" )
private String skinClass;
/**
* List of skin styles.
* This list contains all styling settings and painter directions.
*/
@XStreamImplicit
private List styles;
/**
* Skin styles cache map.
* This map is automatically filled-in by the {@link com.alee.managers.style.data.SkinInfoConverter} with compiled styles.
*/
private transient Map> stylesCache;
/**
* Constructs new skin information.
*/
public SkinInfo ()
{
super ();
}
/**
* Returns skin ID.
*
* @return skin ID
*/
public String getId ()
{
return id;
}
/**
* Sets skin ID.
*
* @param id new skin ID
*/
public void setId ( final String id )
{
this.id = id;
}
/**
* Returns skin icon.
*
* @return skin icon
*/
@Override
public Icon getIcon ()
{
return icon != null ? icon : getDefaultIcon ();
}
/**
* Returns default skin icon.
*
* @return default skin icon
*/
protected Icon getDefaultIcon ()
{
final Class