Skip to content

Commit

Permalink
Revert "#35 suppress MyFaces re-rendering of resource"
Browse files Browse the repository at this point in the history
This reverts commit c7855e8.
  • Loading branch information
Bauke Scholtz committed May 30, 2014
1 parent 40a0bb2 commit 7e3b92d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 20 deletions.
13 changes: 3 additions & 10 deletions src/org/omnifaces/resourcehandler/CombinedResourceHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -378,9 +378,7 @@ else if (rendererType.equals(RENDERER_TYPE_CSS)) {
stylesheets.add(context, component, id);
}
else if (rendererType.equals(RENDERER_TYPE_JS)) {
if (scripts.add(context, component, id)) {
Hacks.setScriptResourceRendered(context, id); // Prevents future forced additions by libs.
}
scripts.add(context, component, id);
}
else if (component instanceof DeferredScript) {
String group = (String) component.getAttributes().get("group");
Expand Down Expand Up @@ -438,15 +436,15 @@ private CombinedResourceBuilder(String extension, String target) {
componentResourcesToRemove = new ArrayList<UIComponent>(3);
}

private boolean add(FacesContext context, UIComponent componentResource, ResourceIdentifier resourceIdentifier) {
private void add(FacesContext context, UIComponent componentResource, ResourceIdentifier resourceIdentifier) {
String library = resourceIdentifier.getLibrary();
String name = resourceIdentifier.getName();

if ((componentResource != null && !componentResource.isRendered()) // Component resource has rendered="false".
|| (!(componentResource instanceof DeferredScript) // It already calls setScriptResourceRendered.
&& Hacks.isScriptResourceRendered(context, library, name))) { // Apparently auto-added by a lib.
Hacks.setScriptResourceRendered(context, library, name); // Prevents future forced additions by libs.
componentResourcesToRemove.add(componentResource); // Prevents duplicate rendering.
return true;
}
else if (excludedResources.isEmpty() || !excludedResources.contains(resourceIdentifier)) {
info.add(resourceIdentifier);
Expand All @@ -462,15 +460,10 @@ else if (excludedResources.isEmpty() || !excludedResources.contains(resourceIden
}
componentResourcesToRemove.add(componentResource);
}

return true;
}
else if (suppressedResources.contains(resourceIdentifier)) {
componentResourcesToRemove.add(componentResource);
return true;
}

return false;
}

private void mergeAttribute(UIComponent originalComponent, UIComponent newComponent, String name) {
Expand Down
10 changes: 0 additions & 10 deletions src/org/omnifaces/util/Hacks.java
Original file line number Diff line number Diff line change
Expand Up @@ -375,16 +375,6 @@ public static boolean isMyFacesUsed() {
return MYFACES_USED;
}

/**
* Set the given script resource as rendered.
* @param context The involved faces context.
* @param id The resource identifier.
* @since 1.8
*/
public static void setScriptResourceRendered(FacesContext context, ResourceIdentifier id) {
setScriptResourceRendered(context, id.getLibrary(), id.getName());
}

/**
* Set the given script resource as rendered.
* @param context The involved faces context.
Expand Down

0 comments on commit 7e3b92d

Please sign in to comment.