Author: alexsmirnov
Date: 2010-07-21 20:34:38 -0400 (Wed, 21 Jul 2010)
New Revision: 18188
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ComponentLibrary.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ConfigExtension.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/TagModel.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/FacesConfigParser.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ComponentBean.java
Log:
https://jira.jboss.org/browse/RF-8958
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ComponentLibrary.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ComponentLibrary.java 2010-07-21
19:48:06 UTC (rev 18187)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ComponentLibrary.java 2010-07-22
00:34:38 UTC (rev 18188)
@@ -87,7 +87,7 @@
private final ModelCollection<BehaviorModel> behaviors =
ModelSet.<BehaviorModel> create();
- private ConfigExtension extension;
+ private ConfigExtension extension = new ConfigExtension();
private String prefix;
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ConfigExtension.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ConfigExtension.java 2010-07-21
19:48:06 UTC (rev 18187)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ConfigExtension.java 2010-07-22
00:34:38 UTC (rev 18188)
@@ -30,13 +30,16 @@
import org.w3c.dom.Element;
+import com.google.common.collect.Lists;
+
/**
* <p class="changed_added_4_0">That class represents all faces-config
"extension" fields.</p>
*
* @author asmirnov(a)exadel.com
*/
public class ConfigExtension {
- private List<Element> extensions;
+
+ private List<Element> extensions = Lists.newArrayList();
/**
* <p class="changed_added_4_0"></p>
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/TagModel.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/TagModel.java 2010-07-21
19:48:06 UTC (rev 18187)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/TagModel.java 2010-07-22
00:34:38 UTC (rev 18188)
@@ -27,10 +27,13 @@
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import org.richfaces.cdk.annotations.TagType;
import org.richfaces.cdk.util.ComparatorUtils;
+import org.richfaces.cdk.xmlconfig.model.ClassAdapter;
/**
* <p class="changed_added_4_0">That bean represents VDL tag</p>
@@ -55,7 +58,7 @@
*/
private String name;
-
+ @XmlElement(name = "tag-name", namespace =
ComponentLibrary.CDK_EXTENSIONS_NAMESPACE)
public String getName() {
return name;
}
@@ -73,6 +76,7 @@
* <p class="changed_added_4_0"></p>
* @return the type
*/
+ @XmlElement(name = "tag-type", namespace =
ComponentLibrary.CDK_EXTENSIONS_NAMESPACE)
public TagType getType() {
return this.type;
}
@@ -90,6 +94,8 @@
* @return the targetClass
*/
@Merge
+ @XmlElement(name = "handler-class", namespace =
ComponentLibrary.CDK_EXTENSIONS_NAMESPACE)
+ @XmlJavaTypeAdapter(ClassAdapter.class)
public ClassName getTargetClass() {
return this.targetClass;
}
@@ -109,6 +115,8 @@
* @return the baseClass
*/
@Merge
+ @XmlElement(name = "base-class", namespace =
ComponentLibrary.CDK_EXTENSIONS_NAMESPACE)
+ @XmlJavaTypeAdapter(ClassAdapter.class)
public ClassName getBaseClass() {
return this.baseClass;
}
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/FacesConfigParser.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/FacesConfigParser.java 2010-07-21
19:48:06 UTC (rev 18187)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/FacesConfigParser.java 2010-07-22
00:34:38 UTC (rev 18188)
@@ -31,6 +31,7 @@
import org.richfaces.cdk.Source;
import org.richfaces.cdk.Sources;
import org.richfaces.cdk.model.ComponentLibrary;
+import org.richfaces.cdk.util.JavaUtils;
import org.richfaces.cdk.xmlconfig.model.FacesConfigAdapter;
import org.richfaces.cdk.xmlconfig.model.FacesConfigBean;
@@ -52,11 +53,11 @@
@Inject
private ComponentLibrary library;
-
- @Inject @Source(Sources.FACES_CONFIGS)
+
+ @Inject
+ @Source(Sources.FACES_CONFIGS)
private FileManager configFiles;
-
/*
* (non-Javadoc)
*
@@ -71,12 +72,24 @@
library.getComponents().addAll(facesConfig.getComponents());
library.getRenderKits().addAll(facesConfig.getRenderKits());
library.getConverters().addAll(facesConfig.getConverters());
- // TODO - merge changes into library.
- // library.getRenderers().addAll(unmarshal.getRenderers());
- // library.getValidators().addAll(unmarshal.getValidators);
- // library.getConverters().addAll(unmarshal.getConverters());
- // library.getBehaviors().addAll(unmarshal.getBehaviors());
- // library.setExtensions(unmarshal.getExtensions());
+ library.getValidators().addAll(facesConfig.getValidators());
+ library.getBehaviors().addAll(facesConfig.getBehaviors());
+ library.getFunctions().addAll(facesConfig.getFunctions());
+ library.getEvents().addAll(facesConfig.getEvents());
+ if (null != unmarshal.getMetadataComplete()) {
+ library.setMetadataComplete(unmarshal.getMetadataComplete());
+ }
+
library.getExtension().getExtensions().addAll(facesConfig.getExtension().getExtensions());
+ if (null != facesConfig.getTaglib()) {
+ if (null == library.getTaglib()) {
+ library.setTaglib(facesConfig.getTaglib());
+ } else {
+ JavaUtils.copyProperties(facesConfig.getTaglib(),
library.getTaglib());
+ }
+ }
+ if (null != facesConfig.getPrefix()) {
+ library.setPrefix(facesConfig.getPrefix());
+ }
}
}
}
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ComponentBean.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ComponentBean.java 2010-07-21
19:48:06 UTC (rev 18187)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ComponentBean.java 2010-07-22
00:34:38 UTC (rev 18188)
@@ -145,7 +145,7 @@
}
public static class ComponentExtension extends ExtensionBeanBase {
- private String rendererType;
+ private FacesId rendererType;
private List<EventModel> events = Lists.newArrayList();
private List<TagModel> tags = Lists.newArrayList();
private FacesId family;
@@ -174,8 +174,8 @@
*
* @param rendererType the rendererTypes to set
*/
- @XmlElement(name = "renderer-id", namespace =
ComponentLibrary.CDK_EXTENSIONS_NAMESPACE)
- public void setRendererType(String rendererType) {
+ @XmlElement(name = "renderer-type", namespace =
ComponentLibrary.CDK_EXTENSIONS_NAMESPACE)
+ public void setRendererType(FacesId rendererType) {
this.rendererType = rendererType;
}
@@ -184,7 +184,7 @@
*
* @return the rendererTypes
*/
- public String getRendererType() {
+ public FacesId getRendererType() {
return rendererType;
}