de.matthiasmann.twl.theme
Class ThemeManager

java.lang.Object
  extended by de.matthiasmann.twl.theme.ThemeManager

public class ThemeManager
extends java.lang.Object

The theme manager


Method Summary
static ThemeManager createThemeManager(java.net.URL url, Renderer renderer)
          Loads the specified theme using the provided renderer and a new cache context.
static ThemeManager createThemeManager(java.net.URL url, Renderer renderer, CacheContext cacheContext)
          Loads the specified theme using the provided renderer and cache context.
static ThemeManager createThemeManager(java.net.URL url, Renderer renderer, CacheContext cacheContext, java.util.Map<java.lang.String,java.lang.Object> constants)
          Loads the specified theme using the provided renderer and cache context.
 void destroy()
          Destroys the CacheContext and releases all OpenGL resources
 ThemeInfo findThemeInfo(java.lang.String themePath)
           
 CacheContext getCacheContext()
          Returns the associated cache context which was used to load this theme.
 ParameterMap getConstants()
           
 java.lang.Object getCursor(java.lang.String name)
           
 Font getDefaultFont()
           
 Font getFont(java.lang.String name)
           
 Image getImage(java.lang.String name)
           
 Image getImageNoWarning(java.lang.String name)
           
static
<E extends java.lang.Enum<E>>
void
registerEnumType(java.lang.String name, java.lang.Class<E> enumClazz)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getCacheContext

public CacheContext getCacheContext()
Returns the associated cache context which was used to load this theme.

Returns:
the cache context
See Also:
createThemeManager(java.net.URL, de.matthiasmann.twl.renderer.Renderer, de.matthiasmann.twl.renderer.CacheContext)

destroy

public void destroy()
Destroys the CacheContext and releases all OpenGL resources

See Also:
Resource.destroy(), getCacheContext()

getDefaultFont

public Font getDefaultFont()

createThemeManager

public static ThemeManager createThemeManager(java.net.URL url,
                                              Renderer renderer)
                                       throws java.io.IOException
Loads the specified theme using the provided renderer and a new cache context. This is equivalent to calling createThemeManager(url, renderer, renderer.createNewCacheContext())

Parameters:
url - The URL of the theme
renderer - The renderer which is used to load and render the resources
Returns:
a new ThemeManager
Throws:
java.io.IOException - if an error occured while loading
java.lang.NullPointerException - if one of the passed parameters is null
See Also:
createThemeManager(java.net.URL, de.matthiasmann.twl.renderer.Renderer, de.matthiasmann.twl.renderer.CacheContext), destroy()

createThemeManager

public static ThemeManager createThemeManager(java.net.URL url,
                                              Renderer renderer,
                                              CacheContext cacheContext)
                                       throws java.io.IOException
Loads the specified theme using the provided renderer and cache context. This is equivalent to calling createThemeManager(url, renderer, renderer.createNewCacheContext(), null)

Parameters:
url - The URL of the theme
renderer - The renderer which is used to load and render the resources
cacheContext - The cache context into which the resources are loaded
Returns:
a new ThemeManager
Throws:
java.io.IOException - if an error occured while loading
java.lang.IllegalArgumentException - if one of the passed parameters is null
See Also:
createThemeManager(java.net.URL, de.matthiasmann.twl.renderer.Renderer, de.matthiasmann.twl.renderer.CacheContext, java.util.Map), destroy()

createThemeManager

public static ThemeManager createThemeManager(java.net.URL url,
                                              Renderer renderer,
                                              CacheContext cacheContext,
                                              java.util.Map<java.lang.String,java.lang.Object> constants)
                                       throws java.io.IOException
Loads the specified theme using the provided renderer and cache context. The provided cacheContext is set active in the provided renderer. The cache context is stored inside the created ThemeManager. Calling destroy() on the returned ThemeManager instance will also destroy the cache context.

Parameters:
url - The URL of the theme
renderer - The renderer which is used to load and render the resources
cacheContext - The cache context into which the resources are loaded
constants - A map containing constants which as exposed to the theme as if defined by <constantDef/>, can be null.
Returns:
a new ThemeManager
Throws:
java.io.IOException - if an error occured while loading
java.lang.IllegalArgumentException - if one of the passed parameters is null
See Also:
Renderer.setActiveCacheContext(de.matthiasmann.twl.renderer.CacheContext), destroy()

registerEnumType

public static <E extends java.lang.Enum<E>> void registerEnumType(java.lang.String name,
                                                                  java.lang.Class<E> enumClazz)

findThemeInfo

public ThemeInfo findThemeInfo(java.lang.String themePath)

getImageNoWarning

public Image getImageNoWarning(java.lang.String name)

getImage

public Image getImage(java.lang.String name)

getCursor

public java.lang.Object getCursor(java.lang.String name)

getFont

public Font getFont(java.lang.String name)

getConstants

public ParameterMap getConstants()