Skip to content

Commit

Permalink
Fixes #51: o:massAttribute should be applied on NEW children only.
Browse files Browse the repository at this point in the history
  • Loading branch information
Bauke Scholtz committed Aug 18, 2014
1 parent 93df1a4 commit 4ac9011
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/main/java/org/omnifaces/taghandler/MassAttribute.java
Expand Up @@ -15,6 +15,7 @@
import static org.omnifaces.util.Utils.unmodifiableSet;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;

Expand Down Expand Up @@ -132,10 +133,13 @@ public MassAttribute(TagConfig config) {

@Override
public void apply(FaceletContext context, UIComponent parent) throws IOException {
List<UIComponent> oldChildren = new ArrayList<>(parent.getChildren());
nextHandler.apply(context, parent);

if (ComponentHandler.isNew(parent)) {
applyMassAttribute(context, parent.getChildren());
List<UIComponent> newChildren = new ArrayList<>(parent.getChildren());
newChildren.removeAll(oldChildren);
applyMassAttribute(context, newChildren);
}
}

Expand All @@ -156,4 +160,4 @@ private void applyMassAttribute(FaceletContext context, List<UIComponent> childr
}
}

}
}

0 comments on commit 4ac9011

Please sign in to comment.