org.apache.wicket.resource.aggregation
Class AbstractDependencyRespectingResourceAggregatingHeaderResponse<R extends ResourceReferenceCollection,K>

java.lang.Object
  extended by org.apache.wicket.markup.html.DecoratingHeaderResponse
      extended by org.apache.wicket.resource.aggregation.AbstractResourceAggregatingHeaderResponse<R,K>
          extended by org.apache.wicket.resource.aggregation.AbstractDependencyRespectingResourceAggregatingHeaderResponse<R,K>
Type Parameters:
R - the type of ResourceReferenceCollection returned by AbstractResourceAggregatingHeaderResponse.newResourceReferenceCollection() and passed to all the methods that take a ResourceReferenceCollection. You will typically just use ResourceReferenceCollection for this param, unless you are returning a specific type of ResourceReferenceCollection from your subclass.
K - the class of the key that you will create from AbstractResourceAggregatingHeaderResponse.newGroupingKey(ResourceReferenceAndStringData)
All Implemented Interfaces:
IHeaderResponse

public abstract class AbstractDependencyRespectingResourceAggregatingHeaderResponse<R extends ResourceReferenceCollection,K>
extends AbstractResourceAggregatingHeaderResponse<R,K>

An implementation of AbstractResourceAggregatingHeaderResponse that renders references in the correct order if they are AbstractResourceDependentResourceReference references, ensuring that dependencies are rendered in the proper order before their parent (even if they do not appear in the same group as the parent of the depdencies).

Author:
Jeremy Thomerson

Constructor Summary
AbstractDependencyRespectingResourceAggregatingHeaderResponse(IHeaderResponse real)
          Construct.
 
Method Summary
protected  void renderCollection(Set<ResourceReferenceAndStringData> alreadyRendered, K key, R coll)
          When the entire hierarchy has been traversed and AbstractResourceAggregatingHeaderResponse.close() is called, we loop through the grouped collections and render them in this method.
 
Methods inherited from class org.apache.wicket.resource.aggregation.AbstractResourceAggregatingHeaderResponse
close, getGroupingKeyComparator, newGroupingKey, newResourceReferenceCollection, onAllCollectionsRendered, render, renderCSSReference, renderCSSReference, renderCSSReference, renderCSSReference, renderIfNotAlreadyRendered, renderJavascriptReference, renderJavascriptReference, renderJavascriptReference, renderJavascriptReference
 
Methods inherited from class org.apache.wicket.markup.html.DecoratingHeaderResponse
getRealResponse, getResponse, isClosed, markRendered, renderJavascript, renderOnDomReadyJavascript, renderOnEventJavascript, renderOnLoadJavascript, renderString, wasRendered
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractDependencyRespectingResourceAggregatingHeaderResponse

public AbstractDependencyRespectingResourceAggregatingHeaderResponse(IHeaderResponse real)
Construct.

Parameters:
real - the header response we decorate
Method Detail

renderCollection

protected void renderCollection(Set<ResourceReferenceAndStringData> alreadyRendered,
                                K key,
                                R coll)
Description copied from class: AbstractResourceAggregatingHeaderResponse
When the entire hierarchy has been traversed and AbstractResourceAggregatingHeaderResponse.close() is called, we loop through the grouped collections and render them in this method. This method is typically overridden to render your collection how you want to render them. For instance, if you want to aggregate your groups into a single HTTP request, you can override this method, create the URL to your aggregation servlet (or Resource), and then call getRealResponse().renderJavascriptReference(yourUrl), or the appropriate method to render the URL for a group of CSS references.

Overrides:
renderCollection in class AbstractResourceAggregatingHeaderResponse<R extends ResourceReferenceCollection,K>
Parameters:
alreadyRendered - a set of resource references that have already been rendered in other groups
key - they grouping key for this group
coll - the collection of resource references to render


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