You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ma...@apache.org on 2009/03/25 22:03:38 UTC

svn commit: r758433 - in /myfaces/trinidad-maven/branches/1.2.10.1-branch/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces: ./ parse/

Author: matzew
Date: Wed Mar 25 21:03:29 2009
New Revision: 758433

URL: http://svn.apache.org/viewvc?rev=758433&view=rev
Log:
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

Modified:
    myfaces/trinidad-maven/branches/1.2.10.1-branch/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/GenerateFaceletsTaglibsMojo.java
    myfaces/trinidad-maven/branches/1.2.10.1-branch/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/ConverterBean.java
    myfaces/trinidad-maven/branches/1.2.10.1-branch/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/FacesConfigParser.java
    myfaces/trinidad-maven/branches/1.2.10.1-branch/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/ValidatorBean.java

Modified: myfaces/trinidad-maven/branches/1.2.10.1-branch/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/GenerateFaceletsTaglibsMojo.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad-maven/branches/1.2.10.1-branch/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/GenerateFaceletsTaglibsMojo.java?rev=758433&r1=758432&r2=758433&view=diff
==============================================================================
--- myfaces/trinidad-maven/branches/1.2.10.1-branch/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/GenerateFaceletsTaglibsMojo.java (original)
+++ myfaces/trinidad-maven/branches/1.2.10.1-branch/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/GenerateFaceletsTaglibsMojo.java Wed Mar 25 21:03:29 2009
@@ -324,7 +324,9 @@
     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 @@
     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    ");

Modified: myfaces/trinidad-maven/branches/1.2.10.1-branch/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/ConverterBean.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad-maven/branches/1.2.10.1-branch/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/ConverterBean.java?rev=758433&r1=758432&r2=758433&view=diff
==============================================================================
--- myfaces/trinidad-maven/branches/1.2.10.1-branch/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/ConverterBean.java (original)
+++ myfaces/trinidad-maven/branches/1.2.10.1-branch/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/ConverterBean.java Wed Mar 25 21:03:29 2009
@@ -58,6 +58,27 @@
   {
     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 @@
 
 
   private String  _converterId;
+  private String  _rootConverterId;
   private String  _converterClass;
   private String  _converterSuperClass;
   private int     _converterClassModifiers;

Modified: myfaces/trinidad-maven/branches/1.2.10.1-branch/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/FacesConfigParser.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad-maven/branches/1.2.10.1-branch/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/FacesConfigParser.java?rev=758433&r1=758432&r2=758433&view=diff
==============================================================================
--- myfaces/trinidad-maven/branches/1.2.10.1-branch/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/FacesConfigParser.java (original)
+++ myfaces/trinidad-maven/branches/1.2.10.1-branch/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/FacesConfigParser.java Wed Mar 25 21:03:29 2009
@@ -289,6 +289,8 @@
     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 @@
     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",

Modified: myfaces/trinidad-maven/branches/1.2.10.1-branch/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/ValidatorBean.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad-maven/branches/1.2.10.1-branch/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/ValidatorBean.java?rev=758433&r1=758432&r2=758433&view=diff
==============================================================================
--- myfaces/trinidad-maven/branches/1.2.10.1-branch/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/ValidatorBean.java (original)
+++ myfaces/trinidad-maven/branches/1.2.10.1-branch/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/ValidatorBean.java Wed Mar 25 21:03:29 2009
@@ -37,6 +37,27 @@
   {
     _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 @@
   }
 
   private String  _validatorId;
+  private String  _rootValidatorId;
   private String  _validatorClass;
   private String  _validatorSuperClass;
   private int     _validatorClassModifiers;