Author: jkuhnert
Date: Sat Mar 10 15:20:57 2007
New Revision: 516810
URL: http://svn.apache.org/viewvc?view=rev&rev=516810
Log:
Fixed issues with nested widgets in Dialogs. Removed block in AbstractWidget
that tried to return under certain conditions.
Modified:
tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/context/Home.html
tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/java/org/apache/tapestry/timetracker/model/Project.java
tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/java/org/apache/tapestry/timetracker/page/TaskEntryPage.java
tapestry/tapestry4/trunk/tapestry-framework/src/descriptor/META-INF/tapestry.globals.xml
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/AbstractComponent.java
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/IScriptProcessor.java
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/AbstractWidget.java
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/script/ParsedScript.java
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/script/ScriptSessionImpl.java
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/ResponseBuilder.java
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/DojoAjaxResponseBuilder.java
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/util/PageRenderSupportImpl.java
tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/core.js
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/junit/script/MockScriptProcessor.java
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/services/impl/DojoAjaxResponseBuilderTest.java
Modified:
tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/context/Home.html
URL:
http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/context/Home.html?view=diff&rev=516810&r1=516809&r2=516810
==============================================================================
---
tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/context/Home.html
(original)
+++
tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/context/Home.html
Sat Mar 10 15:20:57 2007
@@ -60,6 +60,18 @@
<a href="#" onClick="dojo.widget.byId('testDialog').hide();return
false">Close</a>
</p>
+
+ <div style="display:block;background:#ffffff;width:20em;">
+ <a jwcid="@DirectLink" listener="listener:showSubProject"
updateComponents="subArea" >Show sub project</a>
+
+ <span jwcid="[EMAIL PROTECTED]">
+ <span jwcid="@If" condition="ognl:showSubProject"
renderTag="false">
+ <form jwcid="@Form">
+ Another: <select jwcid="[EMAIL PROTECTED]"
model="ognl:projectModel" value="ognl:subProject"
displayName="message:choose.project" />
+ </form>
+ </span>
+ </span>
+ </div>
</div>
<div jwcid="[EMAIL PROTECTED]" >
Modified:
tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/java/org/apache/tapestry/timetracker/model/Project.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/java/org/apache/tapestry/timetracker/model/Project.java?view=diff&rev=516810&r1=516809&r2=516810
==============================================================================
---
tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/java/org/apache/tapestry/timetracker/model/Project.java
(original)
+++
tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/java/org/apache/tapestry/timetracker/model/Project.java
Sat Mar 10 15:20:57 2007
@@ -18,8 +18,6 @@
/**
* Represents a project for which time will be tracked.
- *
- * @author jkuhnert
*/
public class Project implements Serializable, Persistent
{
Modified:
tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/java/org/apache/tapestry/timetracker/page/TaskEntryPage.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/java/org/apache/tapestry/timetracker/page/TaskEntryPage.java?view=diff&rev=516810&r1=516809&r2=516810
==============================================================================
---
tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/java/org/apache/tapestry/timetracker/page/TaskEntryPage.java
(original)
+++
tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/java/org/apache/tapestry/timetracker/page/TaskEntryPage.java
Sat Mar 10 15:20:57 2007
@@ -57,6 +57,13 @@
public abstract E getSelectedProject();
public abstract void setSelectedProject(E val);
+ public abstract void setSubProject(E value);
+ public abstract E getSubProject();
+
+ @Persist
+ public abstract void setShowSubProject(boolean show);
+ public abstract boolean getShowSubProject();
+
public abstract Project getCurrentProject();
@Component(bindings = {"value=date",
@@ -140,5 +147,10 @@
getBuilder().updateComponent("projectChoose");
setSelectedProject(getSelectedProject());
}
+ }
+
+ public void showSubProject()
+ {
+ setShowSubProject(true);
}
}
Modified:
tapestry/tapestry4/trunk/tapestry-framework/src/descriptor/META-INF/tapestry.globals.xml
URL:
http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/descriptor/META-INF/tapestry.globals.xml?view=diff&rev=516810&r1=516809&r2=516810
==============================================================================
---
tapestry/tapestry4/trunk/tapestry-framework/src/descriptor/META-INF/tapestry.globals.xml
(original)
+++
tapestry/tapestry4/trunk/tapestry-framework/src/descriptor/META-INF/tapestry.globals.xml
Sat Mar 10 15:20:57 2007
@@ -49,7 +49,6 @@
</invoke-factory>
<interceptor service-id="hivemind.LoggingInterceptor" />
-
</service-point>
<service-point id="HttpServletRequest"
interface="javax.servlet.http.HttpServletRequest">
Modified:
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/AbstractComponent.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/AbstractComponent.java?view=diff&rev=516810&r1=516809&r2=516810
==============================================================================
---
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/AbstractComponent.java
(original)
+++
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/AbstractComponent.java
Sat Mar 10 15:20:57 2007
@@ -217,12 +217,22 @@
}
/**
+ * Returns the list of of [EMAIL PROTECTED] IRender} elements contained by
this component. Ie whatever
+ * has been added via [EMAIL PROTECTED] #addBody(IRender)}.
+ *
+ * @return The values, if any. Null otherwise.
+ */
+ protected IRender[] getContainedRenderers()
+ {
+ return _body;
+ }
+
+ /**
* Invokes [EMAIL PROTECTED] #finishLoad()}. Subclasses may overide as
needed, but must invoke this
* implementation. [EMAIL PROTECTED] BaseComponent} loads its HTML
template.
*/
- public void finishLoad(IRequestCycle cycle, IPageLoader loader,
- IComponentSpecification specification)
+ public void finishLoad(IRequestCycle cycle, IPageLoader loader,
IComponentSpecification specification)
{
finishLoad();
}
Modified:
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/IScriptProcessor.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/IScriptProcessor.java?view=diff&rev=516810&r1=516809&r2=516810
==============================================================================
---
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/IScriptProcessor.java
(original)
+++
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/IScriptProcessor.java
Sat Mar 10 15:20:57 2007
@@ -96,6 +96,37 @@
void addExternalScript(IComponent target, Resource resource);
/**
+ * Determines if the specified component should have its javascript
+ * body added to the response.
+ *
+ * @param target
+ * The component to allow/disallow body script content from.
+ * @return True if the component script should be allowed.
+ */
+ boolean isBodyScriptAllowed(IComponent target);
+
+ /**
+ * Determines if the specified component should have its javascript
+ * initialization added to the response.
+ *
+ * @param target
+ * The component to allow/disallow initialization script content
from.
+ * @return True if the component script should be allowed.
+ */
+ boolean isInitializationScriptAllowed(IComponent target);
+
+ /**
+ * Determines if the specified component should have its javascript
+ * external resource scripts added to the response.
+ *
+ * @param target
+ * The component to check for inclusion/exclusion.
+ * @return True if external scripts from this component should be added to
+ * the response.
+ */
+ boolean isExternalScriptAllowed(IComponent target);
+
+ /**
* Ensures that the given string is unique. The string is either returned
unchanged, or a suffix
* is appended to ensure uniqueness.
*/
Modified:
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/AbstractWidget.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/AbstractWidget.java?view=diff&rev=516810&r1=516809&r2=516810
==============================================================================
---
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/AbstractWidget.java
(original)
+++
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/AbstractWidget.java
Sat Mar 10 15:20:57 2007
@@ -47,17 +47,10 @@
|| cycle.getResponseBuilder().explicitlyContains(this)) {
setDestroy(false);
- } else
+ } else {
+
setDestroy(true);
- }
-
- // don't render if not part of update response
-
- if (cycle.getResponseBuilder().isDynamic()
- && (!cycle.getResponseBuilder().explicitlyContains(this)
- && !cycle.getResponseBuilder().contains(this))) {
-
- return;
+ }
}
renderWidget(writer, cycle);
Modified:
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/script/ParsedScript.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/script/ParsedScript.java?view=diff&rev=516810&r1=516809&r2=516810
==============================================================================
---
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/script/ParsedScript.java
(original)
+++
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/script/ParsedScript.java
Sat Mar 10 15:20:57 2007
@@ -62,8 +62,7 @@
* Creates the [EMAIL PROTECTED] ScriptSessionImpl}and invokes
* [EMAIL PROTECTED]
org.apache.tapestry.script.AbstractToken#writeChildren(java.lang.StringBuffer,
org.apache.tapestry.script.ScriptSession)}.
*/
- public void execute(IRequestCycle cycle, IScriptProcessor processor,
- Map symbols)
+ public void execute(IRequestCycle cycle, IScriptProcessor processor, Map
symbols)
{
ScriptSession session = new ScriptSessionImpl(_scriptResource, cycle,
processor, _evaluator, _valueConverter, symbols);
Modified:
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/script/ScriptSessionImpl.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/script/ScriptSessionImpl.java?view=diff&rev=516810&r1=516809&r2=516810
==============================================================================
---
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/script/ScriptSessionImpl.java
(original)
+++
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/script/ScriptSessionImpl.java
Sat Mar 10 15:20:57 2007
@@ -26,7 +26,7 @@
/**
* The result of executing a script, the session is used during the parsing
* process as well. Following
- * [EMAIL PROTECTED]
org.apache.tapestry.IScript#execute(org.apache.tapestry.IRequestCycle,
org.apache.tapestry.IScriptProcessor, java.util.Map)},
+ * [EMAIL PROTECTED] org.apache.tapestry.IScript#execute(IComponent,
org.apache.tapestry.IRequestCycle, org.apache.tapestry.IScriptProcessor,
java.util.Map)},
* the session provides access to output symbols as well as the body and
* initialization blocks created by the script tokens.
*
@@ -113,9 +113,34 @@
addBodyScript(_component, script);
}
+ /**
+ * [EMAIL PROTECTED]
+ */
+ public boolean isBodyScriptAllowed(IComponent target)
+ {
+ return _processor.isBodyScriptAllowed(target);
+ }
+
+ /**
+ * [EMAIL PROTECTED]
+ */
+ public boolean isExternalScriptAllowed(IComponent target)
+ {
+ return _processor.isExternalScriptAllowed(target);
+ }
+
+ /**
+ * [EMAIL PROTECTED]
+ */
+ public boolean isInitializationScriptAllowed(IComponent target)
+ {
+ return _processor.isInitializationScriptAllowed(target);
+ }
+
public void addBodyScript(IComponent target, String script)
{
- _processor.addBodyScript(target, script);
+ if (_processor.isBodyScriptAllowed(target))
+ _processor.addBodyScript(target, script);
}
public void addExternalScript(Resource resource)
@@ -125,7 +150,8 @@
public void addExternalScript(IComponent target, Resource resource)
{
- _processor.addExternalScript(target, resource);
+ if (_processor.isExternalScriptAllowed(target))
+ _processor.addExternalScript(target, resource);
}
public void addInitializationScript(String script)
@@ -135,7 +161,8 @@
public void addInitializationScript(IComponent target, String script)
{
- _processor.addInitializationScript(target, script);
+ if (_processor.isInitializationScriptAllowed(target))
+ _processor.addInitializationScript(target, script);
}
public String getUniqueString(String baseValue)
Modified:
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/ResponseBuilder.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/ResponseBuilder.java?view=diff&rev=516810&r1=516809&r2=516810
==============================================================================
---
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/ResponseBuilder.java
(original)
+++
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/ResponseBuilder.java
Sat Mar 10 15:20:57 2007
@@ -312,35 +312,4 @@
* @return True if the component script should be allowed.
*/
boolean isImageInitializationAllowed(IComponent target);
-
- /**
- * Determines if the specified component should have its javascript
- * body added to the response.
- *
- * @param target
- * The component to allow/disallow body script content from.
- * @return True if the component script should be allowed.
- */
- boolean isBodyScriptAllowed(IComponent target);
-
- /**
- * Determines if the specified component should have its javascript
- * initialization added to the response.
- *
- * @param target
- * The component to allow/disallow initialization script content
from.
- * @return True if the component script should be allowed.
- */
- boolean isInitializationScriptAllowed(IComponent target);
-
- /**
- * Determines if the specified component should have its javascript
- * external resource scripts added to the response.
- *
- * @param target
- * The component to check for inclusion/exclusion.
- * @return True if external scripts from this component should be added to
- * the response.
- */
- boolean isExternalScriptAllowed(IComponent target);
}
Modified:
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/DojoAjaxResponseBuilder.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/DojoAjaxResponseBuilder.java?view=diff&rev=516810&r1=516809&r2=516810
==============================================================================
---
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/DojoAjaxResponseBuilder.java
(original)
+++
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/DojoAjaxResponseBuilder.java
Sat Mar 10 15:20:57 2007
@@ -281,6 +281,11 @@
*/
public boolean isInitializationScriptAllowed(IComponent target)
{
+ if (_log.isDebugEnabled()) {
+
+ _log.debug("isInitializationScriptAllowed(" + target + ")
contains?: " + contains(target) + " _pageRender: " + _pageRender);
+ }
+
if (_pageRender)
return true;
@@ -530,7 +535,6 @@
if (IComponent.class.isInstance(render)
&& contains((IComponent)render,
((IComponent)render).peekClientId()))
{
- _pageRender = true;
render.render(getComponentWriter(
((IComponent)render).peekClientId() ), cycle);
return;
}
Modified:
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/util/PageRenderSupportImpl.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/util/PageRenderSupportImpl.java?view=diff&rev=516810&r1=516809&r2=516810
==============================================================================
---
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/util/PageRenderSupportImpl.java
(original)
+++
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/util/PageRenderSupportImpl.java
Sat Mar 10 15:20:57 2007
@@ -20,6 +20,8 @@
import java.util.Map;
import org.apache.commons.lang.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.apache.hivemind.Locatable;
import org.apache.hivemind.Location;
import org.apache.hivemind.Resource;
@@ -165,6 +167,30 @@
_bodyScript.append("\n").append(val);
}
+ /**
+ * [EMAIL PROTECTED]
+ */
+ public boolean isBodyScriptAllowed(IComponent target)
+ {
+ return _builder.isBodyScriptAllowed(target);
+ }
+
+ /**
+ * [EMAIL PROTECTED]
+ */
+ public boolean isExternalScriptAllowed(IComponent target)
+ {
+ return _builder.isExternalScriptAllowed(target);
+ }
+
+ /**
+ * [EMAIL PROTECTED]
+ */
+ public boolean isInitializationScriptAllowed(IComponent target)
+ {
+ return _builder.isInitializationScriptAllowed(target);
+ }
+
public void addInitializationScript(String script)
{
addInitializationScript(null, script);
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/core.js
URL:
http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/core.js?view=diff&rev=516810&r1=516809&r2=516810
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/core.js
(original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/core.js Sat Mar
10 15:20:57 2007
@@ -216,7 +216,7 @@
var content=tapestry.html.getContentAsString(element);
if (djConfig["isDebug"]) {
- dojo.log.debug("Received element content for id <" + id + ">
of:", content);
+ dojo.log.debug("Received element content for id <" + id + ">
of: ", content);
}
if (content && content.length > 0) {
node.innerHTML=content;
@@ -485,8 +485,9 @@
_getContentAsStringIE:function(node){
var s="";
- for (var i = 0; i < node.childNodes.length; i++)
+ for (var i = 0; i < node.childNodes.length; i++){
s += node.childNodes[i].xml;
+ }
return s;
},
Modified:
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/junit/script/MockScriptProcessor.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/junit/script/MockScriptProcessor.java?view=diff&rev=516810&r1=516809&r2=516810
==============================================================================
---
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/junit/script/MockScriptProcessor.java
(original)
+++
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/junit/script/MockScriptProcessor.java
Sat Mar 10 15:20:57 2007
@@ -96,6 +96,30 @@
addExternalScript(null, scriptResource);
}
+ /**
+ * [EMAIL PROTECTED]
+ */
+ public boolean isBodyScriptAllowed(IComponent target)
+ {
+ return true;
+ }
+
+ /**
+ * [EMAIL PROTECTED]
+ */
+ public boolean isExternalScriptAllowed(IComponent target)
+ {
+ return true;
+ }
+
+ /**
+ * [EMAIL PROTECTED]
+ */
+ public boolean isInitializationScriptAllowed(IComponent target)
+ {
+ return true;
+ }
+
public void addExternalScript(IComponent target, Resource scriptResource)
{
if (_externalScripts == null)
Modified:
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/services/impl/DojoAjaxResponseBuilderTest.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/services/impl/DojoAjaxResponseBuilderTest.java?view=diff&rev=516810&r1=516809&r2=516810
==============================================================================
---
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/services/impl/DojoAjaxResponseBuilderTest.java
(original)
+++
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/services/impl/DojoAjaxResponseBuilderTest.java
Sat Mar 10 15:20:57 2007
@@ -306,6 +306,35 @@
verify();
}
+ public void test_Script_Contains_Stack()
+ {
+ IRequestCycle cycle = newMock(IRequestCycle.class);
+ IComponent comp = newMock(IComponent.class);
+ checkOrder(comp, false);
+
+ IMarkupWriter writer = newWriter();
+
+ List parts = new ArrayList();
+ parts.add("comp1");
+
+ List stack = new ArrayList();
+ stack.add(comp);
+
+ ResponseBuilder builder = new DojoAjaxResponseBuilder(cycle, writer,
parts);
+
+ expect(comp.getClientId()).andReturn("comp").anyTimes();
+
+
expect(cycle.renderStackIterator()).andReturn(stack.iterator()).anyTimes();
+
+ replay();
+
+ assertFalse(builder.isBodyScriptAllowed(comp));
+ assertFalse(builder.isExternalScriptAllowed(comp));
+ assertFalse(builder.isInitializationScriptAllowed(comp));
+
+ verify();
+ }
+
public void test_Write_Body_Script()
{
MarkupFilter filter = new UTFMarkupFilter();