org.apache.wicket
Class SharedResources

java.lang.Object
  extended by org.apache.wicket.SharedResources

public class SharedResources
extends java.lang.Object

Class which holds shared resources. Resources can be shared by name. An optional scope can be given to prevent naming conflicts and a locale and/or style can be given as well.

Author:
Jonathan Locke, Johan Compagner, Gili Tzabari

Method Summary
 void add(java.lang.Class scope, java.lang.String name, java.util.Locale locale, java.lang.String style, Resource resource)
          Adds a resource.
 void add(java.lang.String name, java.util.Locale locale, Resource resource)
          Adds a resource.
 void add(java.lang.String name, Resource resource)
          Adds a resource.
 Resource get(java.lang.Class scope, java.lang.String name, java.util.Locale locale, java.lang.String style, boolean exact)
           
 Resource get(java.lang.String key)
          THIS METHOD IS NOT PART OF THE WICKET PUBLIC API.
 java.lang.Class getAliasClass(java.lang.String alias)
          Gets the class for a given resource alias.
 void putClassAlias(java.lang.Class clz, java.lang.String alias)
          Sets an alias for a class so that a resource url can look like: resources/images/Image.jpg instead of resources/org.apache.wicket.resources.ResourceClass/Image.jpg
 void remove(java.lang.String key)
          Removes a shared resource.
 java.lang.String resourceKey(java.lang.Class scope, java.lang.String path, java.util.Locale locale, java.lang.String style)
          THIS METHOD IS NOT PART OF THE WICKET PUBLIC API.
static java.lang.String resourceKey(java.lang.String path, java.util.Locale locale, java.lang.String style)
          THIS METHOD IS NOT PART OF THE WICKET PUBLIC API.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

resourceKey

public static java.lang.String resourceKey(java.lang.String path,
                                           java.util.Locale locale,
                                           java.lang.String style)
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT CALL IT. Inserts _[locale] and _[style] into path just before any extension that might exist.

Parameters:
path - The resource path
locale - The locale
style - The style (see Session)
Returns:
The localized path

add

public final void add(java.lang.Class scope,
                      java.lang.String name,
                      java.util.Locale locale,
                      java.lang.String style,
                      Resource resource)
Adds a resource.

Parameters:
scope - Scope of resource
name - Logical name of resource
locale - The locale of the resource
style - The resource style (see Session)
resource - Resource to store

add

public final void add(java.lang.String name,
                      java.util.Locale locale,
                      Resource resource)
Adds a resource.

Parameters:
name - Logical name of resource
locale - The locale of the resource
resource - Resource to store

add

public final void add(java.lang.String name,
                      Resource resource)
Adds a resource.

Parameters:
name - Logical name of resource
resource - Resource to store

get

public final Resource get(java.lang.Class scope,
                          java.lang.String name,
                          java.util.Locale locale,
                          java.lang.String style,
                          boolean exact)
Parameters:
scope - The resource's scope
name - Name of resource to get
locale - The locale of the resource
style - The resource style (see Session)
exact - If true then only return the resource that is registered for the given locale and style.
Returns:
The logical resource

get

public final Resource get(java.lang.String key)
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT USE IT.

Parameters:
key - Shared resource key
Returns:
The resource

putClassAlias

public final void putClassAlias(java.lang.Class clz,
                                java.lang.String alias)
Sets an alias for a class so that a resource url can look like: resources/images/Image.jpg instead of resources/org.apache.wicket.resources.ResourceClass/Image.jpg

Parameters:
clz - The class that has to be aliased.
alias - The alias string.

getAliasClass

public final java.lang.Class getAliasClass(java.lang.String alias)
Gets the class for a given resource alias.

Parameters:
alias -
Returns:
The class this is an alias for.
See Also:
putClassAlias(Class, String)

remove

public final void remove(java.lang.String key)
Removes a shared resource.

Parameters:
key - Shared resource key

resourceKey

public java.lang.String resourceKey(java.lang.Class scope,
                                    java.lang.String path,
                                    java.util.Locale locale,
                                    java.lang.String style)
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT CALL IT.

Parameters:
scope - The scope of the resource
path - The resource path
locale - The locale
style - The style (see Session)
Returns:
The localized path


Copyright © 2004-2010 Apache Software Foundation. All Rights Reserved.