You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by de...@apache.org on 2017/09/17 18:05:42 UTC
[myfaces-trinidad-maven] 05/17: TRINIDAD-1438 - M2 Plugins: Need a
way to define a new converter or validator tag with the existing Id
This is an automated email from the ASF dual-hosted git repository.
deki pushed a commit to branch 1.2.10.1-branch
in repository https://gitbox.apache.org/repos/asf/myfaces-trinidad-maven.git
commit 6c2db849603d13d93f555e4a9093def32d520bba
Author: Matthias Wessendorf <ma...@apache.org>
AuthorDate: Wed Mar 25 21:03:29 2009 +0000
TRINIDAD-1438 - M2 Plugins: Need a way to define a new converter or validator tag with the existing Id
Thx to Max Starets for the patch
---
.../plugin/faces/GenerateFaceletsTaglibsMojo.java | 8 ++++++--
.../plugin/faces/parse/ConverterBean.java | 22 ++++++++++++++++++++++
.../plugin/faces/parse/FacesConfigParser.java | 4 ++++
.../plugin/faces/parse/ValidatorBean.java | 22 ++++++++++++++++++++++
4 files changed, 54 insertions(+), 2 deletions(-)
diff --git a/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/GenerateFaceletsTaglibsMojo.java b/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/GenerateFaceletsTaglibsMojo.java
index d2d04cf..4c269b8 100644
--- a/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/GenerateFaceletsTaglibsMojo.java
+++ b/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/GenerateFaceletsTaglibsMojo.java
@@ -324,7 +324,9 @@ public class GenerateFaceletsTaglibsMojo extends AbstractFacesMojo
stream.writeStartElement("validator");
stream.writeCharacters("\n ");
stream.writeStartElement("validator-id");
- stream.writeCharacters(validator.getValidatorId());
+ String id = validator.getRootValidatorId() == null ?
+ validator.getValidatorId() : validator.getRootValidatorId();
+ stream.writeCharacters(id);
stream.writeEndElement();
stream.writeCharacters("\n ");
@@ -350,7 +352,9 @@ public class GenerateFaceletsTaglibsMojo extends AbstractFacesMojo
stream.writeStartElement("converter");
stream.writeCharacters("\n ");
stream.writeStartElement("converter-id");
- stream.writeCharacters(converter.getConverterId());
+ String id = converter.getRootConverterId() == null ?
+ converter.getConverterId() : converter.getRootConverterId();
+ stream.writeCharacters(id);
stream.writeEndElement();
stream.writeCharacters("\n ");
diff --git a/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/ConverterBean.java b/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/ConverterBean.java
index 7937afa..25c14ac 100644
--- a/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/ConverterBean.java
+++ b/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/ConverterBean.java
@@ -58,6 +58,27 @@ public class ConverterBean extends AbstractTagBean {
{
return _converterId;
}
+
+ /**
+ * Sets the "root" converter Id representing the ID defined in faces-config
+ * The root id will be used while the tag definition is written out,
+ * while the regular Id is used for the lookup of existing converters.
+ * This allows us to define new tags for the existing converter IDs
+ * @param id root converter id
+ */
+ public void setRootConverterId(String id)
+ {
+ _rootConverterId = id;
+ }
+
+ /**
+ * Returns the root converter id
+ * @return root converter id
+ */
+ public String getRootConverterId()
+ {
+ return _rootConverterId;
+ }
/**
* Sets the converter class for this component.
@@ -141,6 +162,7 @@ public class ConverterBean extends AbstractTagBean {
private String _converterId;
+ private String _rootConverterId;
private String _converterClass;
private String _converterSuperClass;
private int _converterClassModifiers;
diff --git a/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/FacesConfigParser.java b/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/FacesConfigParser.java
index b9aff09..0de5e3f 100644
--- a/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/FacesConfigParser.java
+++ b/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/FacesConfigParser.java
@@ -289,6 +289,8 @@ public class FacesConfigParser
digester.setRuleNamespaceURI("http://myfaces.apache.org/maven-faces-plugin");
// faces-config/converter/converter-extension
+ digester.addBeanPropertySetter("faces-config/converter/converter-extension/root-converter-id",
+ "rootConverterId");
digester.addBeanPropertySetter("faces-config/converter/converter-extension/long-description",
"longDescription");
digester.addBeanPropertySetter("faces-config/converter/converter-extension/tag-class",
@@ -345,6 +347,8 @@ public class FacesConfigParser
digester.setRuleNamespaceURI("http://myfaces.apache.org/maven-faces-plugin");
// faces-config/validator/validator-extension
+ digester.addBeanPropertySetter("faces-config/validator/validator-extension/root-validator-id",
+ "rootValidatorId");
digester.addBeanPropertySetter("faces-config/validator/validator-extension/long-description",
"longDescription");
digester.addBeanPropertySetter("faces-config/validator/validator-extension/tag-class",
diff --git a/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/ValidatorBean.java b/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/ValidatorBean.java
index aeec6bc..7b3f497 100644
--- a/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/ValidatorBean.java
+++ b/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/ValidatorBean.java
@@ -37,6 +37,27 @@ public class ValidatorBean extends AbstractTagBean {
{
_validatorId = validatorId;
}
+
+ /**
+ * Sets the "root" validator Id representing the ID defined in faces-config
+ * The root id will be used while the tag definition is written out,
+ * while the regular Id is used for the lookup of existing validators.
+ * This allows us to define new tags for the existing validator IDs
+ * @param id root validator id
+ */
+ public void setRootValidatorId(String id)
+ {
+ _rootValidatorId = id;
+ }
+
+ /**
+ * Returns the root validator id
+ * @return root validator id
+ */
+ public String getRootValidatorId()
+ {
+ return _rootValidatorId;
+ }
/**
* Returns true if the validator identifier is specified, otherwise false.
@@ -139,6 +160,7 @@ public class ValidatorBean extends AbstractTagBean {
}
private String _validatorId;
+ private String _rootValidatorId;
private String _validatorClass;
private String _validatorSuperClass;
private int _validatorClassModifiers;
--
To stop receiving notification emails like this one, please contact
"commits@myfaces.apache.org" <co...@myfaces.apache.org>.