Skip to content

Commit

Permalink
Merge branch 'tapx-prototype-fix-zonemanager' of https://github.com/j…
Browse files Browse the repository at this point in the history
…ochenberger/tapx into jochenberger-tapx-prototype-fix-zonemanager

Conflicts:
	tapx-prototype/src/main/java/com/howardlewisship/tapx/prototype/PrototypeModule.java
  • Loading branch information
hlship committed Apr 4, 2011
2 parents aa9983e + 64fa5c1 commit d8c9cd7
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2009 Howard M. Lewis Ship
// Copyright 2009, 2011 Howard M. Lewis Ship
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -17,10 +17,23 @@
import org.apache.tapestry5.ioc.Configuration;
import org.apache.tapestry5.ioc.MappedConfiguration;
import org.apache.tapestry5.services.LibraryMapping;
import org.apache.tapestry5.Asset;
import org.apache.tapestry5.MarkupWriter;
import org.apache.tapestry5.annotations.Path;
import org.apache.tapestry5.ioc.MappedConfiguration;
import org.apache.tapestry5.ioc.OrderedConfiguration;
import org.apache.tapestry5.ioc.annotations.Inject;
import org.apache.tapestry5.json.JSONObject;
import org.apache.tapestry5.services.Environment;
import org.apache.tapestry5.services.MarkupRenderer;
import org.apache.tapestry5.services.MarkupRendererFilter;
import org.apache.tapestry5.services.PartialMarkupRenderer;
import org.apache.tapestry5.services.PartialMarkupRendererFilter;
import org.apache.tapestry5.services.javascript.JavaScriptSupport;

public class PrototypeModule
{
public void contributeFactoryDefaults(MappedConfiguration<String, String> configuration)
public static void contributeFactoryDefaults(MappedConfiguration<String, String> configuration)
{
configuration.override("tapestry.scriptaculous.path", "com/howardlewisship/tapx/prototype");
}
Expand All @@ -30,4 +43,18 @@ public static void contributeComponentClassResolver(final Configuration<LibraryM
configuration.add(new LibraryMapping("tapx", "com.howardlewisship.tapx.prototype"));
}

public static void contributeMarkupRenderer(
final OrderedConfiguration<MarkupRendererFilter> configuration,
final Environment environment,
@Inject @Path("classpath:com/howardlewisship/tapx/prototype/tapestry-js-fixes.js") final Asset tapestryPatches) {
MarkupRendererFilter tapestryFixesFilter = new MarkupRendererFilter() {
public void renderMarkup(final MarkupWriter writer, final MarkupRenderer renderer) {
JavaScriptSupport javaScriptSupport = environment.peekRequired(JavaScriptSupport.class);
javaScriptSupport.importJavaScriptLibrary(tapestryPatches);
renderer.renderMarkup(writer);
}
};

configuration.add("TapestryFixes", tapestryFixesFilter, "after:RenderSupport");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Tapestry.ZoneManager.addMethods({
processReply : function(reply) {
Tapestry.loadScriptsInReply(reply, function() {
/*
* In a multi-zone update, the reply.content may be missing, in which
* case, leave the curent content in place. TAP5-1177
*/
reply.content != undefined && this.show(reply.content);

/*
* zones is an object of zone ids and zone content that will be present in
* a multi-zone update response.
*/
reply.zones && Object.keys(reply.zones).each(function(zoneId) {
var manager = Tapestry.findZoneManagerForZone(zoneId);

if (manager) {
var zoneContent = reply.zones[zoneId];
manager.show(zoneContent);
}
});
}.bind(this));
}
});

0 comments on commit d8c9cd7

Please sign in to comment.