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 2017/03/22 14:51:20 UTC

svn commit: r1788115 - in /myfaces/tobago/trunk: tobago-core/src/main/java/org/apache/myfaces/tobago/component/ tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/ tobago-core/src/main/java/org/apache/myfaces/tobago/interna...

Author: lofwyr
Date: Wed Mar 22 14:51:20 2017
New Revision: 1788115

URL: http://svn.apache.org/viewvc?rev=1788115&view=rev
Log:
TOBAGO-1725: Generator should support more than one rendererType per component tag

Added:
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectOneChoiceAlternativeInRenderer.java
Modified:
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/RendererTypes.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SelectOneChoiceTagDeclaration.java
    myfaces/tobago/trunk/tobago-tool/tobago-tool-annotation/src/main/java/org/apache/myfaces/tobago/apt/annotation/UIComponentTag.java
    myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/generate/ComponentInfo.java
    myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/generate/RendererInfo.java
    myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/generate/TagInfo.java
    myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/processor/FacesConfigGenerator.java
    myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/processor/TaglibGenerator.java

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/RendererTypes.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/RendererTypes.java?rev=1788115&r1=1788114&r2=1788115&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/RendererTypes.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/RendererTypes.java Wed Mar 22 14:51:20 2017
@@ -64,6 +64,7 @@ public enum RendererTypes {
   SelectManyListbox,
   SelectManyShuttle,
   SelectOneChoice,
+  SelectOneChoiceAlternativeIn,
   SelectOneRadio,
   SelectOneListbox,
   SelectReference,
@@ -127,6 +128,7 @@ public enum RendererTypes {
   public static final String SELECT_MANY_LISTBOX = "SelectManyListbox";
   public static final String SELECT_MANY_SHUTTLE = "SelectManyShuttle";
   public static final String SELECT_ONE_CHOICE = "SelectOneChoice";
+  public static final String SELECT_ONE_CHOICE_ALTERNATIVE_IN = "SelectOneChoiceAlternativeIn";
   public static final String SELECT_ONE_RADIO = "SelectOneRadio";
   public static final String SELECT_ONE_LISTBOX = "SelectOneListbox";
   public static final String SELECT_REFERENCE = "SelectReference";

Added: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectOneChoiceAlternativeInRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectOneChoiceAlternativeInRenderer.java?rev=1788115&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectOneChoiceAlternativeInRenderer.java (added)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectOneChoiceAlternativeInRenderer.java Wed Mar 22 14:51:20 2017
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.myfaces.tobago.internal.renderkit.renderer;
+
+public class SelectOneChoiceAlternativeInRenderer extends SelectOneChoiceRenderer {
+
+}

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SelectOneChoiceTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SelectOneChoiceTagDeclaration.java?rev=1788115&r1=1788114&r2=1788115&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SelectOneChoiceTagDeclaration.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SelectOneChoiceTagDeclaration.java Wed Mar 22 14:51:20 2017
@@ -58,7 +58,7 @@ import javax.faces.component.UISelectOne
     uiComponentBaseClass = "org.apache.myfaces.tobago.internal.component.AbstractUISelectOneChoice",
     uiComponentFacesClass = "javax.faces.component.UISelectOne",
     componentFamily = UISelectOne.COMPONENT_FAMILY,
-    rendererType = RendererTypes.SELECT_ONE_CHOICE,
+    rendererType = {RendererTypes.SELECT_ONE_CHOICE, RendererTypes.SELECT_ONE_CHOICE_ALTERNATIVE_IN},
     allowedChildComponenents = {
         "javax.faces.SelectItem",
         "javax.faces.SelectItems"

Modified: myfaces/tobago/trunk/tobago-tool/tobago-tool-annotation/src/main/java/org/apache/myfaces/tobago/apt/annotation/UIComponentTag.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-tool/tobago-tool-annotation/src/main/java/org/apache/myfaces/tobago/apt/annotation/UIComponentTag.java?rev=1788115&r1=1788114&r2=1788115&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-tool/tobago-tool-annotation/src/main/java/org/apache/myfaces/tobago/apt/annotation/UIComponentTag.java (original)
+++ myfaces/tobago/trunk/tobago-tool/tobago-tool-annotation/src/main/java/org/apache/myfaces/tobago/apt/annotation/UIComponentTag.java Wed Mar 22 14:51:20 2017
@@ -39,7 +39,7 @@ public @interface UIComponentTag {
 
   String componentFamily() default "";
 
-  String rendererType() default "";
+  String[] rendererType() default {};
 
   String faceletHandler() default "org.apache.myfaces.tobago.facelets.TobagoComponentHandler";
 

Modified: myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/generate/ComponentInfo.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/generate/ComponentInfo.java?rev=1788115&r1=1788114&r2=1788115&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/generate/ComponentInfo.java (original)
+++ myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/generate/ComponentInfo.java Wed Mar 22 14:51:20 2017
@@ -47,7 +47,7 @@ public class ComponentInfo extends TagIn
 
   @Deprecated
   public ComponentInfo(final String sourceClass, final String qualifiedName, final String rendererType) {
-    super(sourceClass, qualifiedName, rendererType);
+    super(sourceClass, qualifiedName, new String[]{rendererType});
   }
 
   public void addPropertyInfo(final ComponentPropertyInfo propertyInfo) {

Modified: myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/generate/RendererInfo.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/generate/RendererInfo.java?rev=1788115&r1=1788114&r2=1788115&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/generate/RendererInfo.java (original)
+++ myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/generate/RendererInfo.java Wed Mar 22 14:51:20 2017
@@ -20,21 +20,18 @@
 package org.apache.myfaces.tobago.apt.generate;
 
 public class RendererInfo extends ClassInfo {
-  private String rendererType;
+  private String[] rendererTypes;
 
   public RendererInfo(final String sourceClass, final String qualifiedName) {
     super(sourceClass, qualifiedName);
   }
 
-  public RendererInfo(final String sourceClass, final String qualifiedName, final String rendererType) {
+  public RendererInfo(final String sourceClass, final String qualifiedName, final String[] rendererTypes) {
     super(sourceClass, qualifiedName);
-    this.rendererType = rendererType;
+    this.rendererTypes = rendererTypes;
   }
 
-  public String getRendererType() {
-    if (rendererType != null && rendererType.length() == 0) {
-      return null;
-    }
-    return rendererType;
+  public String[] getRendererType() {
+    return rendererTypes;
   }
 }

Modified: myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/generate/TagInfo.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/generate/TagInfo.java?rev=1788115&r1=1788114&r2=1788115&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/generate/TagInfo.java (original)
+++ myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/generate/TagInfo.java Wed Mar 22 14:51:20 2017
@@ -31,7 +31,7 @@ public class TagInfo extends RendererInf
   private PropertyInfo bodyContent;
   private boolean checkBodyContent;
 
-  public TagInfo(final String sourceClass, final String qualifiedName, final String rendererType) {
+  public TagInfo(final String sourceClass, final String qualifiedName, final String[] rendererType) {
     super(sourceClass, qualifiedName, rendererType);
   }
 

Modified: myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/processor/FacesConfigGenerator.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/processor/FacesConfigGenerator.java?rev=1788115&r1=1788114&r2=1788115&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/processor/FacesConfigGenerator.java (original)
+++ myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/processor/FacesConfigGenerator.java Wed Mar 22 14:51:20 2017
@@ -358,8 +358,7 @@ public class FacesConfigGenerator extend
       final ComponentInfo componentInfo, final UIComponentTag componentTag, final List<org.jdom.Element> renderer,
       final Namespace namespace)
       throws IOException, NoSuchFieldException, IllegalAccessException {
-    final String rendererType = componentTag.rendererType();
-    if (rendererType != null && rendererType.length() > 0) {
+    for (final String rendererType : componentTag.rendererType()) {
       final org.jdom.Element element = new org.jdom.Element(RENDERER, namespace);
       String displayName = componentTag.displayName();
       if (displayName.equals("")) {

Modified: myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/processor/TaglibGenerator.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/processor/TaglibGenerator.java?rev=1788115&r1=1788114&r2=1788115&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/processor/TaglibGenerator.java (original)
+++ myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/processor/TaglibGenerator.java Wed Mar 22 14:51:20 2017
@@ -339,7 +339,18 @@ public class TaglibGenerator extends Abs
     description.append(componentTag.uiComponent());
     description.append("</p>");
     description.append("<p><b>RendererType: </b>");
-    description.append(componentTag.rendererType());
+    description.append("<ul>");
+    boolean first = true;
+    for (String rendererType : componentTag.rendererType()) {
+      description.append("<li>");
+      description.append(rendererType);
+      if (first) {
+        description.append(" (default)");
+      }
+      description.append("</li>");
+      first = false;
+    }
+    description.append("</ul>");
     description.append("</p>");
     final Facet[] facets = componentTag.facets();
     if (facets.length > 0) {
@@ -466,8 +477,8 @@ public class TaglibGenerator extends Abs
       tagElement.appendChild(componentElement);
       addLeafTextElement(
           AnnotationUtils.componentType(componentTag), "component-type", componentElement, document);
-      if (StringUtils.isNotBlank(componentTag.rendererType())) {
-        addLeafTextElement(componentTag.rendererType(), "renderer-type", componentElement, document);
+      if (componentTag.rendererType().length > 0) {
+        addLeafTextElement(componentTag.rendererType()[0], "renderer-type", componentElement, document);
       }
       addLeafTextElement(componentTag.faceletHandler(), "handler-class", componentElement, document);
     }