Created
May 20, 2010 09:32
-
-
Save lacco/407394 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- a/src/resources/apps/fr/includes/persistence-model.xml | |
+++ b/src/resources/apps/fr/includes/persistence-model.xml | |
@@ -121,6 +121,14 @@ | |
<xforms:action if="$form-data"> | |
<xxforms:variable name="xml-data" select="saxon:parse(saxon:base64Binary-to-string(xs:base64Binary($form-data), 'UTF-8'))"/> | |
<xforms:insert nodeset="xxforms:instance('fr-form-instance')" origin="$xml-data"/> | |
+ <xforms:rebuild model="fr-form-model"/> | |
+ <xforms:recalculate forceRecalculateDefaults="true" model="fr-form-model"/> | |
+ <xforms:revalidate model="fr-form-model"/> | |
+ <xforms:refresh model="fr-form-model"/> | |
</xforms:action> | |
</xforms:action> | |
</xforms:action> | |
--- a/src/java/org/orbeon/oxf/xforms/XFormsModel.java | |
+++ b/src/java/org/orbeon/oxf/xforms/XFormsModel.java | |
@@ -963,12 +963,13 @@ public class XFormsModel implements XFormsEventTarget, XFormsEventObserver, XFor | |
// Recalculate only if needed | |
if (instances.size() > 0 && binds != null && deferredActionContext.recalculate) { | |
// Apply calculate binds | |
- binds.applyCalculateBinds(propertyContext); | |
+ binds.applyCalculateBinds(propertyContext, deferredActionContext.recalculateDefaults); | |
} | |
// "Actions that directly invoke rebuild, recalculate, revalidate, or refresh always | |
// have an immediate effect, and clear the corresponding flag." | |
deferredActionContext.recalculate = false; | |
+ deferredActionContext.recalculateDefaults = false; | |
} | |
@@ -1073,6 +1074,7 @@ public class XFormsModel implements XFormsEventTarget, XFormsEventObserver, XFor | |
public boolean rebuild; | |
public boolean recalculate; | |
public boolean revalidate; | |
+ public boolean recalculateDefaults; | |
public void setAllDeferredFlags(boolean value) { | |
rebuild = value; | |
--- a/src/java/org/orbeon/oxf/xforms/XFormsModelBinds.java | |
+++ b/src/java/org/orbeon/oxf/xforms/XFormsModelBinds.java | |
@@ -145,8 +145,9 @@ public class XFormsModelBinds { | |
* Apply calculate binds. | |
* | |
* @param propertyContext current context | |
+ * @param rebuildDefaults force a rebuild of the defaults | |
*/ | |
- public void applyCalculateBinds(final PropertyContext propertyContext) { | |
+ public void applyCalculateBinds(final PropertyContext propertyContext, boolean rebuildDefaults) { | |
if (indentedLogger.isDebugEnabled()) | |
indentedLogger.startHandleOperation("model", "performing recalculate", "model id", model.getEffectiveId()); | |
@@ -159,7 +160,7 @@ public class XFormsModelBinds { | |
// Reset context stack just to re-evaluate the variables | |
model.getContextStack().resetBindingContext(propertyContext, model); | |
- if (isFirstCalculate) { | |
+ if (rebuildDefaults || isFirstCalculate) { | |
// Handle default values | |
iterateBinds(propertyContext, new BindRunner() { | |
public void applyBind(PropertyContext propertyContext, Bind bind, List<Item> nodeset, int position) { | |
--- a/src/java/org/orbeon/oxf/xforms/action/actions/XFormsRecalculateAction.java | |
+++ b/src/java/org/orbeon/oxf/xforms/action/actions/XFormsRecalculateAction.java | |
@@ -48,6 +48,8 @@ public class XFormsRecalculateAction extends XFormsAction { | |
// Because of inter-model dependencies, we consider for now that the action must force the operation | |
model.getDeferredActionContext().recalculate = true; | |
+ model.getDeferredActionContext().recalculateDefaults = actionElement.attributeValue("forceRecalculateDefaults") != null && | |
+ actionElement.attributeValue("forceRecalculateDefaults").equals("true"); | |
container.dispatchEvent(propertyContext, new XFormsRecalculateEvent(containingDocument, model)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment