You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2012/12/05 12:00:26 UTC
svn commit: r1417355 -
/myfaces/tobago/branches/tobago-1.5.x/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/FacesConfigAnnotationVisitor.java
Author: lofwyr
Date: Wed Dec 5 11:00:25 2012
New Revision: 1417355
URL: http://svn.apache.org/viewvc?rev=1417355&view=rev
Log:
TOBAGO-1222: Generated code should use sorted items
Modified:
myfaces/tobago/branches/tobago-1.5.x/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/FacesConfigAnnotationVisitor.java
Modified: myfaces/tobago/branches/tobago-1.5.x/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/FacesConfigAnnotationVisitor.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.5.x/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/FacesConfigAnnotationVisitor.java?rev=1417355&r1=1417354&r2=1417355&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.5.x/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/FacesConfigAnnotationVisitor.java (original)
+++ myfaces/tobago/branches/tobago-1.5.x/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/FacesConfigAnnotationVisitor.java Wed Dec 5 11:00:25 2012
@@ -59,6 +59,8 @@ import java.io.Writer;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
@@ -686,7 +688,7 @@ public class FacesConfigAnnotationVisito
}
protected void addElement(InterfaceDeclaration decl, List<Element> components, List<Element> renderer,
- Namespace namespace) throws IOException {
+ final Namespace namespace) throws IOException {
UIComponentTag componentTag = decl.getAnnotation(UIComponentTag.class);
if (componentTag != null) {
try {
@@ -701,8 +703,20 @@ public class FacesConfigAnnotationVisito
addAttributes(decl, uiComponentClass, properties, attributes, namespace);
if (!attributes.isEmpty()) {
element.addContent(attributes);
+ Collections.sort(attributes, new Comparator<Element>() {
+ public int compare(org.jdom.Element d1, org.jdom.Element d2) {
+ return d1.getChildText(ATTRIBUTE_NAME, namespace).compareTo(
+ d2.getChildText(ATTRIBUTE_NAME, namespace));
+ }
+ });
}
if (!properties.isEmpty()) {
+ Collections.sort(properties, new Comparator<Element>() {
+ public int compare(org.jdom.Element d1, org.jdom.Element d2) {
+ return d1.getChildText(PROPERTY_NAME, namespace).compareTo(
+ d2.getChildText(PROPERTY_NAME, namespace));
+ }
+ });
element.addContent(properties);
}
element.addContent(createElementExtension(decl, componentTag, namespace));