Skip to content

Commit

Permalink
Explain how the previous item is handled when rendering form
Browse files Browse the repository at this point in the history
Additionally avoid useless ‘Map#putAll’ invokation.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1862227 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
mthl committed Jun 27, 2019
1 parent ae90412 commit b0c0ec7
Showing 1 changed file with 2 additions and 2 deletions.
Expand Up @@ -734,6 +734,7 @@ private void renderItemRows(Appendable writer, Map<String, Object> context, Form
int itemIndex = -1; int itemIndex = -1;
Object item = null; Object item = null;
context.put("wholeFormContext", context); context.put("wholeFormContext", context);
// Initialize previousItem with a sentry value since the first Item has no previous Item.
Map<String, Object> previousItem = new HashMap<>(); Map<String, Object> previousItem = new HashMap<>();
while ((item = safeNext(iter)) != null) { while ((item = safeNext(iter)) != null) {
itemIndex++; itemIndex++;
Expand Down Expand Up @@ -763,8 +764,7 @@ private void renderItemRows(Appendable writer, Map<String, Object> context, Form


localContext.push(); localContext.push();
localContext.put("previousItem", previousItem); localContext.put("previousItem", previousItem);
previousItem = new HashMap<>(); previousItem = new HashMap<>(itemMap);
previousItem.putAll(itemMap);


AbstractModelAction.runSubActions(modelForm.getRowActions(), localContext); AbstractModelAction.runSubActions(modelForm.getRowActions(), localContext);


Expand Down

0 comments on commit b0c0ec7

Please sign in to comment.