org.apache.wicket.resource.dependencies
Class AbstractResourceDependentResourceReference

java.lang.Object
  extended by org.apache.wicket.request.resource.ResourceReference
      extended by org.apache.wicket.resource.dependencies.AbstractResourceDependentResourceReference
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
ResourceDependentResourceReference

public abstract class AbstractResourceDependentResourceReference
extends ResourceReference

A resource reference that also has resources that it is dependent on. For instance, you may have foo.js that calls functions defined in base-utils.js. By creating a ResourceReference for foo.js, your IResourceReferenceDependencyConfigurationService can create an AbstractResourceDependentResourceReference that has base-utils.js as its dependency.

Author:
Jeremy Thomerson
See Also:
IResourceReferenceDependencyConfigurationService, Serialized Form

Nested Class Summary
static class AbstractResourceDependentResourceReference.ResourceType
          The type of resource that an AbstractResourceDependentResourceReference represents.
 
Nested classes/interfaces inherited from class org.apache.wicket.request.resource.ResourceReference
ResourceReference.Key, ResourceReference.UrlAttributes
 
Constructor Summary
AbstractResourceDependentResourceReference(java.lang.Class<?> scope, java.lang.String name)
          Construct.
AbstractResourceDependentResourceReference(java.lang.Class<?> scope, java.lang.String name, java.util.Locale locale, java.lang.String style, java.lang.String variation)
          Construct.
AbstractResourceDependentResourceReference(java.lang.String name)
          Construct.
 
Method Summary
abstract  AbstractResourceDependentResourceReference[] getDependentResourceReferences()
          Returns all ResourceReferences that this ResourceReference is depending on.
 java.lang.String getMedia()
          If you call ResourceReferenceDependencyInjectingHeaderResponse.renderCSSReference(yourReference, "some-media"), the media is set in this field so that it can later render itself properly to the wrapped IHeaderResponse
 AbstractResourceDependentResourceReference.ResourceType getResourceType()
          Defaults to returning JS, but returns CSS if the name property ends with ".css".
 java.lang.String getUniqueId()
          A globally-unique (to your application(s)) ID for this resource reference.
 void setMedia(java.lang.String media)
          If you call ResourceReferenceDependencyInjectingHeaderResponse.renderCSSReference(yourReference, "some-media"), the media is set in this field so that it can later render itself properly to the wrapped IHeaderResponse
 void setUniqueId(java.lang.String uniqueId)
          A globally-unique (to your application(s)) ID for this resource reference.
 
Methods inherited from class org.apache.wicket.request.resource.ResourceReference
canBeRegistered, equals, getExtension, getLocale, getName, getResource, getScope, getStyle, getUrlAttributes, getVariation, hashCode, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractResourceDependentResourceReference

public AbstractResourceDependentResourceReference(java.lang.Class<?> scope,
                                                  java.lang.String name,
                                                  java.util.Locale locale,
                                                  java.lang.String style,
                                                  java.lang.String variation)
Construct.

Parameters:
scope -
name -
locale -
style -
variation -

AbstractResourceDependentResourceReference

public AbstractResourceDependentResourceReference(java.lang.Class<?> scope,
                                                  java.lang.String name)
Construct.

Parameters:
scope -
name -

AbstractResourceDependentResourceReference

public AbstractResourceDependentResourceReference(java.lang.String name)
Construct.

Parameters:
name -
Method Detail

setUniqueId

public void setUniqueId(java.lang.String uniqueId)
A globally-unique (to your application(s)) ID for this resource reference. This is optional, and is set for you if you call IHeaderResponse.renderJavaScriptReference(yourReference, "some-id").

Parameters:
uniqueId -

getUniqueId

public java.lang.String getUniqueId()
A globally-unique (to your application(s)) ID for this resource reference. This is optional, and is set for you if you call IHeaderResponse.renderJavaScriptReference(yourReference, "some-id").

Returns:
globally-unique (to your application(s)) ID for this resource reference

setMedia

public void setMedia(java.lang.String media)
If you call ResourceReferenceDependencyInjectingHeaderResponse.renderCSSReference(yourReference, "some-media"), the media is set in this field so that it can later render itself properly to the wrapped IHeaderResponse

Parameters:
media -

getMedia

public java.lang.String getMedia()
If you call ResourceReferenceDependencyInjectingHeaderResponse.renderCSSReference(yourReference, "some-media"), the media is set in this field so that it can later render itself properly to the wrapped IHeaderResponse

Returns:
the media set on calling ResourceReferenceDependencyInjectingHeaderResponse.renderCSSReference(yourReference, "some-media")

getResourceType

public AbstractResourceDependentResourceReference.ResourceType getResourceType()
Defaults to returning JS, but returns CSS if the name property ends with ".css". You can override this method if you need more sophisticated behavior.

Returns:
the ResourceType this reference represents, so that it can be properly added to the IHeaderResponse

getDependentResourceReferences

public abstract AbstractResourceDependentResourceReference[] getDependentResourceReferences()
Returns all ResourceReferences that this ResourceReference is depending on.

Returns:
all ResourceReferences that this ResourceReference is depending on.


Copyright © 2006-2011 Apache Software Foundation. All Rights Reserved.