com.tensegrity.composite.style
Class StyleService

java.lang.Object
  extended bycom.tensegrity.composite.style.StyleService

public class StyleService
extends java.lang.Object

This class holds static methods that will be helpful when dealing with StyleItems. Styles for Composites respectively Primitives are set up in a XML-file (usually: styles.xml). Within this file the "look" (Colors, Paint- and StrokeFormat, etc.) of elements is defined.

Version:
$Id: StyleService.java,v 1.39 2005/07/26 13:13:01 MichaelKegel Exp $
Author:
MichaelKegel

Method Summary
static void applyItemtoPrimitive(Primitive primitive, StyleItem item)
          Applies the StyleItem item to the given Primitive.
static void applyItemtoPrimitiveEx(Primitive primitive, StyleItem item)
          This method applies the given StyleItem to the parameter primitive.
static AttributeSet getItemAttributes(int itemType)
          Returns an AttributeSet containing all Attributes of the given type.
static void loadStylesFromResource(java.lang.String filename, java.lang.Class resourceclass)
          Loads the style-definition from file given by filename relatively located to Class resourceclass.
static void loadStylesFromResource(java.lang.String filename, java.lang.Class resourceclass, boolean overwriteExisting)
          Loads the style-definition from file given by filename relatively located to Class resourceclass.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

loadStylesFromResource

public static final void loadStylesFromResource(java.lang.String filename,
                                                java.lang.Class resourceclass)
                                         throws ReadException
Loads the style-definition from file given by filename relatively located to Class resourceclass. as resourcelocater. An InvalidArgumentException is thrown, if the filename is null or an empty String.

Parameters:
filename - the non-null, non-empty filename.
resourceclass - the rescource-class to use.
Throws:
ReadException

loadStylesFromResource

public static final void loadStylesFromResource(java.lang.String filename,
                                                java.lang.Class resourceclass,
                                                boolean overwriteExisting)
                                         throws ReadException
Loads the style-definition from file given by filename relatively located to Class resourceclass. as resourcelocater. An InvalidArgumentException is thrown, if the filename is null or an empty String.

Parameters:
filename - the non-null, non-empty filename.
resourceclass - the rescource-class to use.
overwriteExisting - overwrites existing definitions while loading new
Throws:
ReadException

getItemAttributes

public static final AttributeSet getItemAttributes(int itemType)
Returns an AttributeSet containing all Attributes of the given type.

Parameters:
itemType - the type to look up.
Returns:
the AttribubteSet of the the given type.

applyItemtoPrimitiveEx

public static final void applyItemtoPrimitiveEx(Primitive primitive,
                                                StyleItem item)
This method applies the given StyleItem to the parameter primitive. Neither it takes care about the type of primitive, nor the style type.

Note:
This one is Experimental and might be deleted in future version of the framework.

Parameters:
primitive - the Primitive to apply the given style to.
item - the StyleItem to apply.

applyItemtoPrimitive

public static final void applyItemtoPrimitive(Primitive primitive,
                                              StyleItem item)
                                       throws StyleItemApplyException
Applies the StyleItem item to the given Primitive.

Parameters:
primitive - the Primitive to apply the StyleItem to.
item - the StyleItem to apply.
Throws:
StyleItemApplyException


Copyright © 2005 Tensegrity Software GmbH. All Rights Reserved. Date of creation: 09.06.2006.