FileDocCategorySizeDatePackage
SWTSkinPropertiesClone.javaAPI DocAzureus 3.0.3.46269Sun May 06 00:56:46 BST 2007com.aelitis.azureus.ui.swt.skin

SWTSkinPropertiesClone

public class SWTSkinPropertiesClone extends Object implements SWTSkinPropertiesParam
Simple extension of SWTSkinProperties that first checks the original cloning id before checking the keys that it's cloning.

Cloned Skin Objects will be calling this class with a Config ID of "" plus whatever property name string they add on.

author
TuxPaper
created
Jun 26, 2006

Fields Summary
private static final String
IGNORE_NAME
private static final boolean
DEBUG
private final SWTSkinProperties
properties
private final String
sCloneConfigID
private final String
sTemplateConfigID
private final String[]
sCloneParams
Constructors Summary
public SWTSkinPropertiesClone(SWTSkinProperties properties, String sCloneConfigID, String[] sCloneParams)
Initialize

param
properties Where to read properties from
param
sCloneConfigID The config key that told us to clone something


	                    	 
	  
			    
		this.properties = properties;
		this.sCloneConfigID = sCloneConfigID;
		this.sCloneParams = sCloneParams;
		this.sTemplateConfigID = sCloneParams[0];
	
Methods Summary
public voidaddProperty(java.lang.String name, java.lang.String value)

		properties.addProperty(sCloneConfigID + name, value);
	
private voidcheckName(java.lang.String name)

param
name

		if (name.startsWith(sTemplateConfigID)) {
			System.err.println(name + " shouldn't have template prefix of "
					+ sTemplateConfigID + "; " + Debug.getStackTrace(true, false));
		}

		if (name.startsWith(sCloneConfigID)) {
			System.err.println(name + " shouldn't have clone prefix of "
					+ sCloneConfigID + "; " + Debug.getStackTrace(true, false));
		}
	
public booleangetBooleanValue(java.lang.String name, boolean def)

		if (DEBUG) {
			checkName(name);
		}
		if (!name.equals(IGNORE_NAME)) {
			if (properties.getStringValue(sCloneConfigID + name) != null) {
				return properties.getBooleanValue(sCloneConfigID + name, def);
			}
		}
		return properties.getBooleanValue(sTemplateConfigID + name, def);
	
public org.eclipse.swt.graphics.ColorgetColor(java.lang.String name)

		if (DEBUG) {
			checkName(name);
		}

		Color val = properties.getColor(sCloneConfigID + name);
		if (val != null) {
			return val;
		}

		return properties.getColor(sTemplateConfigID + name);
	
public int[]getColorValue(java.lang.String name)

		if (DEBUG) {
			checkName(name);
		}
		if (!name.equals(IGNORE_NAME)) {
			int[] val = properties.getColorValue(sCloneConfigID + name);
			if (val[0] < 0) {
				return val;
			}
		}

		return properties.getColorValue(sTemplateConfigID + name);
	
public intgetIntValue(java.lang.String name, int def)

		if (DEBUG) {
			checkName(name);
		}
		if (!name.equals(IGNORE_NAME)) {
			if (properties.getStringValue(sCloneConfigID + name) != null) {
				return properties.getIntValue(sCloneConfigID + name, def);
			}
		}
		return properties.getIntValue(sTemplateConfigID + name, def);
	
public SWTSkinPropertiesgetOriginalProperties()

		return properties;
	
public java.lang.String[]getParamValues()

		return sCloneParams;
	
public java.util.PropertiesgetProperties()

		return properties.getProperties();
	
public java.lang.String[]getStringArray(java.lang.String name, java.lang.String[] params)

		if (DEBUG) {
			checkName(name);
		}
		if (!name.equals(IGNORE_NAME)) {
			String[] val = properties.getStringArray(sCloneConfigID + name, params);
			if (val != null) {
				return val;
			}
		}

		return properties.getStringArray(sTemplateConfigID + name, params);
	
public java.lang.String[]getStringArray(java.lang.String name)

		if (DEBUG) {
			checkName(name);
		}
		if (!name.equals(IGNORE_NAME)) {
			String[] val = properties.getStringArray(sCloneConfigID + name,
					sCloneParams);
			if (val != null) {
				return val;
			}
		}

		return properties.getStringArray(sTemplateConfigID + name, sCloneParams);
	
public java.lang.StringgetStringValue(java.lang.String name)

		if (DEBUG) {
			checkName(name);
		}
		if (!name.equals(IGNORE_NAME)) {
			String val = properties.getStringValue(sCloneConfigID + name,
					sCloneParams);
			if (val != null) {
				return val;
			}
		}

		return properties.getStringValue(sTemplateConfigID + name, sCloneParams);
	
public java.lang.StringgetStringValue(java.lang.String name, java.lang.String[] params, java.lang.String def)

		if (DEBUG) {
			checkName(name);
		}
		if (!name.equals(IGNORE_NAME)) {
			String val = properties.getStringValue(sCloneConfigID + name, params);
			if (val != null) {
				return val;
			}
		}

		return properties.getStringValue(sTemplateConfigID + name, params, def);
	
public java.lang.StringgetStringValue(java.lang.String name, java.lang.String[] params)

		if (DEBUG) {
			checkName(name);
		}
		if (!name.equals(IGNORE_NAME)) {
			String val = properties.getStringValue(sCloneConfigID + name, params);
			if (val != null) {
				return val;
			}
		}

		return properties.getStringValue(sTemplateConfigID + name, params);
	
public java.lang.StringgetStringValue(java.lang.String name, java.lang.String def)

		if (DEBUG) {
			checkName(name);
		}
		if (!name.equals(IGNORE_NAME)) {
			String val = properties.getStringValue(sCloneConfigID + name,
					sCloneParams);
			if (val != null) {
				return val;
			}
		}

		return properties.getStringValue(sTemplateConfigID + name, sCloneParams,
				def);