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 2021/11/05 16:00:57 UTC

[myfaces-tobago] branch tobago-5.x updated: fix: Default position of label should be configurable

This is an automated email from the ASF dual-hosted git repository.

lofwyr pushed a commit to branch tobago-5.x
in repository https://gitbox.apache.org/repos/asf/myfaces-tobago.git


The following commit(s) were added to refs/heads/tobago-5.x by this push:
     new 2753da5  fix: Default position of label should be configurable
2753da5 is described below

commit 2753da5349fd6d923948c6e38c8e0fc52f9fce84
Author: Udo Schnurpfeil <ud...@irian.eu>
AuthorDate: Fri Nov 5 16:09:30 2021 +0100

    fix: Default position of label should be configurable
    
    * requires new XML Scheme for Tobago 5.1
    
    issue: TOBAGO-2100
---
 .../apache/myfaces/tobago/config/TobagoConfig.java |  11 +
 .../config/TobagoConfigEntityResolver.java         |   1 +
 .../internal/config/TobagoConfigFragment.java      |  20 +-
 .../tobago/internal/config/TobagoConfigMerger.java |   5 +
 .../tobago/internal/config/TobagoConfigParser.java |  22 +-
 .../taglib/declaration/HasLabelLayout.java         |   9 +-
 .../src/main/resources/META-INF/tobago-config.xml  |  52 ++-
 .../myfaces/tobago/config/tobago-config-5.1.xsd    | 414 +++++++++++++++++++++
 .../config/TobagoConfigMergingUnitTest.java        |   7 +
 .../src/test/resources/tobago-config-5.1.xml       |  98 +++++
 .../resources/tobago-config-for-unit-tests.xml     |  52 ++-
 .../src/main/webapp/WEB-INF/tobago-config.xml      |  14 +-
 .../apache/myfaces/tobago/apt/AnnotationUtils.java |  49 ---
 .../myfaces/tobago/apt/generate/ComponentInfo.java |   3 +-
 .../apt/processor/CheckstyleConfigGenerator.java   |   7 +-
 .../tobago/apt/processor/ClassesGenerator.java     |  14 +-
 .../tobago/apt/processor/TaglibGenerator.java      |   6 +-
 .../org/apache/myfaces/tobago/apt/component.stg    |   6 +-
 18 files changed, 701 insertions(+), 89 deletions(-)

diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/config/TobagoConfig.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/config/TobagoConfig.java
index 0e48a95..6760129 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/config/TobagoConfig.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/config/TobagoConfig.java
@@ -19,6 +19,7 @@
 
 package org.apache.myfaces.tobago.config;
 
+import org.apache.myfaces.tobago.component.Tags;
 import org.apache.myfaces.tobago.context.Theme;
 import org.apache.myfaces.tobago.context.ThemeImpl;
 import org.apache.myfaces.tobago.exception.TobagoConfigurationException;
@@ -66,6 +67,7 @@ public class TobagoConfig {
   private boolean decodeLineFeed;
   private Map<String, String> mimeTypes;
   private boolean enableTobagoExceptionHandler;
+  private Map<String, String> tagAttributeDefaults;
 
   private boolean locked = false;
 
@@ -113,6 +115,7 @@ public class TobagoConfig {
     contentSecurityPolicy = new ContentSecurityPolicy(ContentSecurityPolicy.Mode.OFF.getValue());
     mimeTypes = new HashMap<>();
     enableTobagoExceptionHandler = true;
+    tagAttributeDefaults = new HashMap<>();
 
     // internal
     final List<TobagoConfigFragment> fragments = new ArrayList<>();
@@ -368,4 +371,12 @@ public class TobagoConfig {
     builder.append('}');
     return builder.toString();
   }
+
+  public Map<String, String> getTagAttributeDefaults() {
+    return tagAttributeDefaults;
+  }
+
+  public String getTagAttributeDefault(Tags tag, String attribute) {
+    return tagAttributeDefaults.get(tag.name() + ' ' + attribute);
+  }
 }
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/config/TobagoConfigEntityResolver.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/config/TobagoConfigEntityResolver.java
index 535ed1a..673b8a3 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/config/TobagoConfigEntityResolver.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/config/TobagoConfigEntityResolver.java
@@ -46,6 +46,7 @@ public class TobagoConfigEntityResolver extends DefaultHandler {
   protected static final String TOBAGO_CONFIG_XSD_3_0 = "/org/apache/myfaces/tobago/config/tobago-config-3.0.xsd";
   protected static final String TOBAGO_CONFIG_XSD_4_0 = "/org/apache/myfaces/tobago/config/tobago-config-4.0.xsd";
   protected static final String TOBAGO_CONFIG_XSD_5_0 = "/org/apache/myfaces/tobago/config/tobago-config-5.0.xsd";
+  protected static final String TOBAGO_CONFIG_XSD_5_1 = "/org/apache/myfaces/tobago/config/tobago-config-5.1.xsd";
 
   private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
 
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/config/TobagoConfigFragment.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/config/TobagoConfigFragment.java
index 8bb0b30..a46bc26 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/config/TobagoConfigFragment.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/config/TobagoConfigFragment.java
@@ -31,10 +31,10 @@ import java.util.Properties;
 public class TobagoConfigFragment {
 
   private String name;
-  private List<String> before;
-  private List<String> after;
+  private final List<String> before;
+  private final List<String> after;
 
-  private List<String> supportedThemeNames;
+  private final List<String> supportedThemeNames;
   private String defaultThemeName;
   private Boolean createSessionSecret;
   private Boolean checkSessionSecret;
@@ -42,13 +42,14 @@ public class TobagoConfigFragment {
   private ContentSecurityPolicy contentSecurityPolicy;
   private SecurityAnnotation securityAnnotation;
   private Boolean setNosniffHeader;
-  private List<ThemeImpl> themeDefinitions;
+  private final List<ThemeImpl> themeDefinitions;
   private URL url;
   private String sanitizerClass;
   private Boolean decodeLineFeed;
   private Properties sanitizerProperties;
-  private Map<String, String> mimeTypes;
+  private final Map<String, String> mimeTypes;
   private Boolean enableTobagoExceptionHandler;
+  private final Map<String, String> tagAttributeDefaults;
 
   public TobagoConfigFragment() {
     before = new ArrayList<>();
@@ -56,6 +57,7 @@ public class TobagoConfigFragment {
     supportedThemeNames = new ArrayList<>();
     themeDefinitions = new ArrayList<>();
     mimeTypes = new HashMap<>();
+    tagAttributeDefaults = new HashMap<>();
   }
 
   public void addSupportedThemeName(final String supportedThemeName) {
@@ -202,6 +204,14 @@ public class TobagoConfigFragment {
     this.enableTobagoExceptionHandler = enableTobagoExceptionHandler;
   }
 
+  public void addTagDefault(String tag, String attribute, String defaultValue) {
+    tagAttributeDefaults.put(tag + ' ' + attribute, defaultValue);
+  }
+
+  public Map<String, String> getTagAttributeDefaults() {
+    return tagAttributeDefaults;
+  }
+
   @Override
   public String toString() {
     return name != null ? name : "(id=" + System.identityHashCode(this) + ")";
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/config/TobagoConfigMerger.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/config/TobagoConfigMerger.java
index 79e54a2..f682870 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/config/TobagoConfigMerger.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/config/TobagoConfigMerger.java
@@ -122,6 +122,11 @@ public class TobagoConfigMerger {
         mimeTypes.put(entry.getKey(), entry.getValue());
       }
 
+      final Map<String, String> tagAttributeDefaults = tobagoConfig.getTagAttributeDefaults();
+      for (final Map.Entry<String, String> entry : fragment.getTagAttributeDefaults().entrySet()) {
+        tagAttributeDefaults.put(entry.getKey(), entry.getValue());
+      }
+
     }
 
     resolveThemes(tobagoConfig.getAvailableThemes());
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/config/TobagoConfigParser.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/config/TobagoConfigParser.java
index baf57e0..af9f370 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/config/TobagoConfigParser.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/config/TobagoConfigParser.java
@@ -111,12 +111,17 @@ public class TobagoConfigParser extends TobagoConfigEntityResolver {
   private static final int EXTENSION = -612557761;
   private static final int TYPE = 3575610;
 
+  private static final int TAGS = 3552281;
+  private static final int TAG = 114586;
+  private static final int ATTRIBUTE = 13085340;
+
   private static final String ATTR_MODE = "mode";
   private static final String ATTR_PRODUCTION = "production";
   private static final String ATTR_NAME = "name";
   private static final String ATTR_KEY = "key";
   private static final String ATTR_PRIORITY = "priority";
   private static final String ATTR_TYPE = "type";
+  private static final String ATTR_DEFAULT = "default";
 
   private static final int MAX_PRIORITY = 65536;
 
@@ -130,6 +135,7 @@ public class TobagoConfigParser extends TobagoConfigEntityResolver {
   private String directiveName;
   private String extension;
   private String type;
+  private String tagName;
 
   private Stack<String> stack;
 
@@ -267,6 +273,14 @@ public class TobagoConfigParser extends TobagoConfigEntityResolver {
         directiveName = attributes.getValue(ATTR_NAME);
         break;
 
+      case TAG:
+        tagName = attributes.getValue(ATTR_NAME);
+        break;
+
+      case ATTRIBUTE:
+        tobagoConfig.addTagDefault(tagName, attributes.getValue(ATTR_NAME), attributes.getValue(ATTR_DEFAULT));
+        break;
+
       case NAME:
       case ORDERING:
       case BEFORE:
@@ -295,6 +309,7 @@ public class TobagoConfigParser extends TobagoConfigEntityResolver {
       case RENDERERS:
       case RENDERER:
       case INCLUDES:
+      case TAGS:
         // nothing to do
         break;
 
@@ -464,6 +479,9 @@ public class TobagoConfigParser extends TobagoConfigEntityResolver {
       case MARKUP:
       case INCLUDES:
       case VERSIONED:
+      case ATTRIBUTE:
+      case TAG:
+      case TAGS:
         // nothing to do
         break;
 
@@ -494,7 +512,9 @@ public class TobagoConfigParser extends TobagoConfigEntityResolver {
 
     final SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
     final Schema schema;
-    if ("5.0".equals(version.getVersion())) {
+    if ("5.1".equals(version.getVersion())) {
+      schema = schemaFactory.newSchema(getClass().getResource(TOBAGO_CONFIG_XSD_5_1));
+    } else if ("5.0".equals(version.getVersion())) {
       schema = schemaFactory.newSchema(getClass().getResource(TOBAGO_CONFIG_XSD_5_0));
     } else if ("4.0".equals(version.getVersion())) {
       schema = schemaFactory.newSchema(getClass().getResource(TOBAGO_CONFIG_XSD_4_0));
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/declaration/HasLabelLayout.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/declaration/HasLabelLayout.java
index 173573f..3982c24 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/declaration/HasLabelLayout.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/declaration/HasLabelLayout.java
@@ -33,8 +33,9 @@ public interface HasLabelLayout {
   @TagAttribute
   @UIComponentTagAttribute(
       type = "org.apache.myfaces.tobago.component.LabelLayout",
-      defaultCode = "getLabel() != null "
-          + "? org.apache.myfaces.tobago.component.LabelLayout.flexLeft "
-          + ": org.apache.myfaces.tobago.component.LabelLayout.none")
-  void setLabelLayout(String markup);
+      defaultCode = "getLabel() == null\n"
+          + "        ? LabelLayout.none\n"
+          + "        : LabelLayout.valueOf(org.apache.myfaces.tobago.config.TobagoConfig"
+          + ".getInstance(getFacesContext()).getTagAttributeDefault(TAG, \"labelLayout\"))")
+  void setLabelLayout(String labelLayout);
 }
diff --git a/tobago-core/src/main/resources/META-INF/tobago-config.xml b/tobago-core/src/main/resources/META-INF/tobago-config.xml
index 3d06928..cf11a07 100644
--- a/tobago-core/src/main/resources/META-INF/tobago-config.xml
+++ b/tobago-core/src/main/resources/META-INF/tobago-config.xml
@@ -20,8 +20,8 @@
 <tobago-config
     xmlns="http://myfaces.apache.org/tobago/tobago-config"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-    xsi:schemaLocation="http://myfaces.apache.org/tobago/tobago-config http://myfaces.apache.org/tobago/tobago-config-5.0.xsd"
-    version="5.0">
+    xsi:schemaLocation="http://myfaces.apache.org/tobago/tobago-config http://myfaces.apache.org/tobago/tobago-config-5.1.xsd"
+    version="5.1">
 
   <name>tobago-core</name>
 
@@ -33,4 +33,52 @@
     <directive name="frame-ancestors">'none'</directive>
   </content-security-policy>
 
+  <tags>
+    <tag name="date">
+      <attribute name="labelLayout" default="flexLeft"/>
+    </tag>
+    <tag name="file">
+      <attribute name="labelLayout" default="flexLeft"/>
+    </tag>
+    <tag name="in">
+     <attribute name="labelLayout" default="flexLeft"/>
+    </tag>
+    <tag name="out">
+      <attribute name="labelLayout" default="flexLeft"/>
+    </tag>
+    <tag name="range">
+      <attribute name="labelLayout" default="flexLeft"/>
+    </tag>
+    <tag name="selectBooleanCheckbox">
+      <attribute name="labelLayout" default="flexLeft"/>
+    </tag>
+    <tag name="selectBooleanToggle">
+      <attribute name="labelLayout" default="flexLeft"/>
+    </tag>
+    <tag name="selectManyCheckbox">
+      <attribute name="labelLayout" default="flexLeft"/>
+    </tag>
+    <tag name="selectManyListbox">
+      <attribute name="labelLayout" default="flexLeft"/>
+    </tag>
+    <tag name="selectManyShuttle">
+      <attribute name="labelLayout" default="flexLeft"/>
+    </tag>
+    <tag name="selectOneChoice">
+      <attribute name="labelLayout" default="flexLeft"/>
+    </tag>
+    <tag name="selectOneListbox">
+      <attribute name="labelLayout" default="flexLeft"/>
+    </tag>
+    <tag name="selectOneRadio">
+      <attribute name="labelLayout" default="flexLeft"/>
+    </tag>
+    <tag name="stars">
+      <attribute name="labelLayout" default="flexLeft"/>
+    </tag>
+    <tag name="textarea">
+      <attribute name="labelLayout" default="flexLeft"/>
+    </tag>
+  </tags>
+
 </tobago-config>
diff --git a/tobago-core/src/main/resources/org/apache/myfaces/tobago/config/tobago-config-5.1.xsd b/tobago-core/src/main/resources/org/apache/myfaces/tobago/config/tobago-config-5.1.xsd
new file mode 100644
index 0000000..c8a3e8c
--- /dev/null
+++ b/tobago-core/src/main/resources/org/apache/myfaces/tobago/config/tobago-config-5.1.xsd
@@ -0,0 +1,414 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<xs:schema
+    targetNamespace="http://myfaces.apache.org/tobago/tobago-config"
+    xmlns:tobago="http://myfaces.apache.org/tobago/tobago-config"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    elementFormDefault="qualified"
+    version="5.1">
+
+  <xs:annotation>
+    <xs:documentation>
+      <![CDATA[
+      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.
+      ]]>
+    </xs:documentation>
+  </xs:annotation>
+
+  <xs:annotation>
+    <xs:documentation>
+      <![CDATA[
+
+      ************************************************************************************
+      ************************************************************************************
+      WARNING
+      THIS IS A PRE-RELEASE VERSION OF THIS FILE, PLEASE CHECK IF THERE IS AN UPDATE ON
+      http://myfaces.apache.org/tobago/tobago-config-5.1.xsd
+      ************************************************************************************
+      ************************************************************************************
+
+      This is the XML schema for the Tobago configuration files version 5.1.
+
+      Use the following definition:
+
+      <tobago-config
+          xmlns="http://myfaces.apache.org/tobago/tobago-config"
+          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+          xsi:schemaLocation="http://myfaces.apache.org/tobago/tobago-config http://myfaces.apache.org/tobago/tobago-config-5.1.xsd"
+          version="5.1">
+        ...
+      </tobago-config>
+      ]]>
+    </xs:documentation>
+  </xs:annotation>
+
+  <xs:element name="tobago-config" type="tobago:tobago-config-type"/>
+
+  <xs:complexType name="tobago-config-type">
+    <xs:sequence>
+      <xs:element name="name" type="tobago:name-type" minOccurs="0">
+        <xs:annotation>
+          <xs:documentation>
+            Name of this instance of the configuration to be referenced in other tobago-config.xml files.
+          </xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="ordering" type="tobago:ordering-type" minOccurs="0">
+        <xs:annotation>
+          <xs:documentation>
+            Can be used to order this instance of the configuration against other tobago-config.xml files.
+          </xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="theme-config" type="tobago:theme-config-type" minOccurs="0">
+        <xs:annotation>
+          <xs:documentation>
+            Configure the themes to be used.
+          </xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="create-session-secret" type="xs:boolean" minOccurs="0" default="true">
+
+      </xs:element>
+      <xs:element name="check-session-secret" type="xs:boolean" minOccurs="0" default="true">
+
+      </xs:element>
+      <xs:element name="prevent-frame-attacks" type="xs:boolean" minOccurs="0" default="true">
+        <xs:annotation>
+          <xs:documentation>
+            Sets the HTTP header "X-Frame-Options" to "DENY".
+            This setting is deprecated but needed for IE11. The current way to configure this is using
+            the Content Security Policy directive 'frame-ancestors'.
+          </xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="set-nosniff-header" type="xs:boolean" minOccurs="0" default="true">
+        <xs:annotation>
+          <xs:documentation>
+            Sets the HTTP header "X-Content-Type-Options" to "nosniff".
+          </xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="classic-date-time-picker" type="xs:boolean" minOccurs="0" default="false">
+        <xs:annotation>
+          <xs:documentation>
+            Warning: No longer supported.
+          </xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="content-security-policy" type="tobago:content-security-policy-type" minOccurs="0">
+        <xs:annotation>
+          <xs:documentation>
+            Define rule for CSP.
+          </xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="sanitizer" type="tobago:sanitizer-type" minOccurs="0">
+        <xs:annotation>
+          <xs:documentation>
+            <![CDATA[
+            Define a Java class which implements org.apache.myfaces.tobago.sanitizer.Sanitizer
+            to protect against HTML content of <tc:out escape="true"/> and
+            <tc:textarea/>.
+
+            This is the default:
+            <sanitizer>
+              <sanitizer-class>org.apache.myfaces.tobago.sanitizer.JsoupSanitizer</sanitizer-class>
+              <properties>
+                <entry key="whitelist">relaxed</entry>
+              </properties>
+            </sanitizer>
+            ]]>
+          </xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="enable-tobago-exception-handler" type="xs:boolean" minOccurs="0" default="true">
+        <xs:annotation>
+          <xs:documentation>
+            Use an instance of org.apache.myfaces.tobago.context.TobagoExceptionHandler as
+            exception handler. Set to false to deactivate.
+          </xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="decode-line-feed" type="xs:boolean" minOccurs="0" default="true">
+        <xs:annotation>
+          <xs:documentation>
+            Use LF instead of CR+LF in textarea while decoding.
+            HTTP transports usually a line break with CR+LF
+            (see https://www.w3.org/TR/html401/interact/forms.html#h-17.13.4).
+            When this property is set to true (by default), the Java bean will get the string only with LF ('\n').
+
+            When this property is set to false, there might be a conflict with the length validator,
+            because you have 2 character for each line break.
+          </xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="security-annotation" type="tobago:security-annotation-type" minOccurs="0" default="disable">
+        <xs:annotation>
+          <xs:documentation>
+            Defines the behavior of actions in buttons and links, if the MethodExpression
+            has a security annotation.
+          </xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="theme-definitions" type="tobago:theme-definitions-type" minOccurs="0">
+        <xs:annotation>
+          <xs:documentation>
+            Configuration of a new theme which may come with this JAR file.
+          </xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="tags" type="tobago:tags-type" minOccurs="0">
+        <xs:annotation>
+          <xs:documentation>
+            Configuration of tags, if supported.
+          </xs:documentation>
+        </xs:annotation>
+      </xs:element>
+    </xs:sequence>
+    <xs:attribute name="version"
+                  type="tobago:tobago-config-version-type"
+                  use="required"/>
+  </xs:complexType>
+
+  <xs:simpleType name="security-annotation-type">
+    <xs:restriction base="xs:token">
+      <xs:enumeration value="hide"/>
+      <xs:enumeration value="disable"/>
+      <xs:enumeration value="ignore"/>
+    </xs:restriction>
+  </xs:simpleType>
+
+  <xs:simpleType name="tobago-config-version-type">
+    <xs:restriction base="xs:token">
+      <xs:enumeration value="5.1"/>
+    </xs:restriction>
+  </xs:simpleType>
+
+  <xs:complexType name="ordering-type">
+    <xs:sequence>
+      <xs:element name="after" type="tobago:before-after-type" minOccurs="0">
+        <xs:annotation>
+          <xs:documentation>
+            This configuration instance needs to be applied after the referenced instance.
+          </xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="before" type="tobago:before-after-type" minOccurs="0">
+        <xs:annotation>
+          <xs:documentation>
+            This configuration instance needs to be applied before the referenced instance.
+          </xs:documentation>
+        </xs:annotation>
+      </xs:element>
+    </xs:sequence>
+  </xs:complexType>
+
+  <xs:complexType name="before-after-type">
+    <xs:sequence>
+      <xs:element name="name" type="tobago:name-type" maxOccurs="unbounded"/>
+    </xs:sequence>
+  </xs:complexType>
+
+  <xs:complexType name="theme-config-type">
+    <xs:sequence>
+      <xs:element name="default-theme" type="xs:string">
+        <xs:annotation>
+          <xs:documentation>
+            The default theme, which is used when no theme is selected programmatically.
+          </xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="supported-theme" type="xs:string" minOccurs="0" maxOccurs="unbounded">
+        <xs:annotation>
+          <xs:documentation>
+            Other supported theme for this application.
+          </xs:documentation>
+        </xs:annotation>
+      </xs:element>
+    </xs:sequence>
+  </xs:complexType>
+
+  <xs:complexType name="content-security-policy-type">
+    <xs:sequence>
+      <xs:element name="directive" type="tobago:directive-type" maxOccurs="unbounded" minOccurs="0">
+        <xs:annotation>
+          <xs:documentation>
+            CSP directive to be added to the HTTP header.
+            It is possible to define more than one directive with the same name, to allow
+            more than one value.
+            The mode defines, if the SCP headers should be written, not written, or only
+            reporting headers should be written.
+
+            For more information about the directives see
+            https://www.w3.org/TR/CSP/
+          </xs:documentation>
+        </xs:annotation>
+      </xs:element>
+    </xs:sequence>
+    <xs:attribute name="mode" type="tobago:csp-mode-type" use="required"/>
+  </xs:complexType>
+
+  <xs:complexType name="directive-type">
+    <xs:simpleContent>
+      <xs:extension base="xs:string">
+        <xs:attribute name="name" type="xs:string" use="required">
+          <xs:annotation>
+            <xs:documentation>
+              Name of the CSP directive e. g. script-src, style-src, frame-ancestors, child-src, ...
+            </xs:documentation>
+          </xs:annotation>
+        </xs:attribute>
+      </xs:extension>
+    </xs:simpleContent>
+  </xs:complexType>
+
+  <xs:complexType name="sanitizer-type">
+    <xs:sequence>
+      <xs:element name="sanitizer-class" type="xs:string"/>
+      <xs:element name="properties" type="tobago:properties-type" minOccurs="0"/>
+    </xs:sequence>
+  </xs:complexType>
+
+  <xs:complexType name="properties-type">
+    <xs:sequence>
+      <xs:element name="entry" type="tobago:entry-type" maxOccurs="unbounded"/>
+    </xs:sequence>
+  </xs:complexType>
+
+  <xs:complexType name="entry-type">
+    <xs:simpleContent>
+      <xs:extension base="xs:string">
+        <xs:attribute name="key" type="xs:string" use="required"/>
+      </xs:extension>
+    </xs:simpleContent>
+  </xs:complexType>
+
+  <xs:simpleType name="csp-mode-type">
+    <xs:restriction base="xs:token">
+      <xs:enumeration value="on"/>
+      <xs:enumeration value="off"/>
+      <xs:enumeration value="report-only"/>
+    </xs:restriction>
+  </xs:simpleType>
+
+  <xs:complexType name="theme-definitions-type">
+    <xs:sequence>
+      <xs:element name="theme-definition" type="tobago:theme-definition-type" maxOccurs="unbounded"/>
+    </xs:sequence>
+  </xs:complexType>
+
+  <xs:complexType name="theme-definition-type">
+    <xs:sequence>
+      <xs:element name="name" type="xs:string">
+        <xs:annotation>
+          <xs:documentation>
+            The technical name of the theme, which e. g. is used in paths.
+          </xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="display-name" type="xs:string" minOccurs="0">
+        <xs:annotation>
+          <xs:documentation>
+            The display name of the theme, which may be used in a theme selector.
+          </xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="fallback" type="xs:string" minOccurs="0">
+        <xs:annotation>
+          <xs:documentation>
+            The parent of the theme.
+          </xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="version" type="xs:string">
+        <xs:annotation>
+          <xs:documentation>
+            The version of the theme. The version string will be encoded into the
+            resource path, to avoid caching problems. The version can be accessed by
+            #{tobagoContext.theme.version}.
+          </xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="resources" type="tobago:resources-type" minOccurs="0" maxOccurs="unbounded">
+        <xs:annotation>
+          <xs:documentation>
+            A list of resources this theme is using.
+          </xs:documentation>
+        </xs:annotation>
+      </xs:element>
+    </xs:sequence>
+  </xs:complexType>
+
+  <xs:complexType name="resources-type">
+    <xs:annotation>
+      <xs:documentation>
+        Resources can be added, or removed (if they are coming from its fallback theme).
+        To removed the resources, put it inside the "excludes" with the same name it was included
+        in the parent.
+
+        There a two different sets of resources, one for production and one for development.
+        Use the production flag to set this mode explicitly.
+      </xs:documentation>
+    </xs:annotation>
+    <xs:sequence>
+      <xs:element name="includes" type="tobago:includes-excludes-type" minOccurs="0"/>
+      <xs:element name="excludes" type="tobago:includes-excludes-type" minOccurs="0"/>
+    </xs:sequence>
+    <xs:attribute name="production" type="xs:boolean" use="required"/>
+  </xs:complexType>
+
+  <xs:complexType name="includes-excludes-type">
+    <xs:sequence>
+      <xs:element name="script" type="tobago:script-type" minOccurs="0" maxOccurs="unbounded"/>
+      <xs:element name="style" type="tobago:style-type" minOccurs="0" maxOccurs="unbounded"/>
+    </xs:sequence>
+  </xs:complexType>
+
+  <xs:complexType name="script-type">
+    <xs:attribute name="name" type="xs:string" use="required"/>
+    <xs:attribute name="type" type="xs:string"/>
+    <xs:attribute name="priority" type="xs:unsignedShort"/>
+  </xs:complexType>
+
+  <xs:complexType name="style-type">
+    <xs:attribute name="name" type="xs:string" use="required"/>
+    <xs:attribute name="priority" type="xs:unsignedShort"/>
+  </xs:complexType>
+
+  <xs:simpleType name="name-type">
+    <xs:restriction base="xs:string"/>
+  </xs:simpleType>
+
+  <xs:complexType name="tags-type">
+    <xs:sequence>
+      <xs:element name="tag" type="tobago:tag-type" maxOccurs="unbounded"/>
+    </xs:sequence>
+  </xs:complexType>
+
+  <xs:complexType name="tag-type">
+    <xs:sequence>
+      <xs:element name="attribute" type="tobago:attribute-type" minOccurs="0" maxOccurs="unbounded"/>
+    </xs:sequence>
+    <xs:attribute name="name" type="xs:string" use="required"/>
+  </xs:complexType>
+
+  <xs:complexType name="attribute-type">
+    <xs:attribute name="name" type="xs:string" use="required"/>
+    <xs:attribute name="default" type="xs:string"/>
+  </xs:complexType>
+
+</xs:schema>
diff --git a/tobago-core/src/test/java/org/apache/myfaces/tobago/internal/config/TobagoConfigMergingUnitTest.java b/tobago-core/src/test/java/org/apache/myfaces/tobago/internal/config/TobagoConfigMergingUnitTest.java
index b4c1c94..9db0fd5 100644
--- a/tobago-core/src/test/java/org/apache/myfaces/tobago/internal/config/TobagoConfigMergingUnitTest.java
+++ b/tobago-core/src/test/java/org/apache/myfaces/tobago/internal/config/TobagoConfigMergingUnitTest.java
@@ -19,6 +19,7 @@
 
 package org.apache.myfaces.tobago.internal.config;
 
+import org.apache.myfaces.tobago.component.Tags;
 import org.apache.myfaces.tobago.config.TobagoConfig;
 import org.apache.myfaces.tobago.context.Theme;
 import org.apache.myfaces.tobago.context.ThemeScript;
@@ -169,4 +170,10 @@ public class TobagoConfigMergingUnitTest {
     Assertions.assertEquals("script-2", scripts21[1].getName());
   }
 
+  @Test
+  public void test51() {
+    final TobagoConfig config = new TobagoConfig(null, "tobago-config-5.1.xml");
+
+    Assertions.assertEquals("top", config.getTagAttributeDefault(Tags.date, "labelLayout"));
+  }
 }
diff --git a/tobago-core/src/test/resources/tobago-config-5.1.xml b/tobago-core/src/test/resources/tobago-config-5.1.xml
new file mode 100644
index 0000000..89d0795
--- /dev/null
+++ b/tobago-core/src/test/resources/tobago-config-5.1.xml
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ * 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.
+-->
+
+<tobago-config
+    xmlns="http://myfaces.apache.org/tobago/tobago-config"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://myfaces.apache.org/tobago/tobago-config http://myfaces.apache.org/tobago/tobago-config-5.1.xsd"
+    version="5.1">
+
+  <name>my-name</name>
+
+  <ordering>
+    <after>
+      <name>my-after</name>
+    </after>
+    <before>
+      <name>my-before-1</name>
+      <name>my-before-2</name>
+    </before>
+  </ordering>
+
+  <theme-config>
+    <default-theme>my-theme-1</default-theme>
+    <supported-theme>my-theme-2</supported-theme>
+  </theme-config>
+
+  <create-session-secret>false</create-session-secret>
+  <check-session-secret>false</check-session-secret>
+  <prevent-frame-attacks>false</prevent-frame-attacks>
+  <set-nosniff-header>false</set-nosniff-header>
+
+  <content-security-policy mode="on">
+    <directive name="default-src">'self'</directive>
+    <directive name="child-src"> http://apache.org</directive>
+  </content-security-policy>
+
+  <security-annotation>ignore</security-annotation>
+
+  <theme-definitions>
+    <theme-definition>
+      <name>my-theme-1</name>
+      <display-name>My Theme 1</display-name>
+      <version>some-version-1</version>
+      <resources production="true">
+        <includes>
+          <script name="script-1.js" priority="1"/>
+          <script name="script-undefined-a.js"/>
+          <script name="script-4.js" priority="4"/>
+          <script name="script-undefined-b.js"/>
+          <script name="script-3.js" priority="3"/>
+          <script name="script-undefined-c.js"/>
+          <script name="script-5.js" priority="5"/>
+          <script name="script-undefined-d.js"/>
+          <script name="script-2.js" priority="2"/>
+          <script name="script-undefined-e.js"/>
+          <style name="style-2.css" priority="2"/>
+          <style name="style.css"/>
+          <style name="style-1.css" priority="1"/>
+        </includes>
+      </resources>
+    </theme-definition>
+
+    <theme-definition>
+      <name>my-theme-2</name>
+      <fallback>my-theme-1</fallback>
+      <version>some-version-1</version>
+      <resources production="false"/>
+    </theme-definition>
+
+  </theme-definitions>
+
+  <tags>
+    <tag name="in">
+      <attribute name="labelLayout" default="top"/>
+      <attribute name="test" default="test"/>
+    </tag>
+    <tag name="date">
+      <attribute name="labelLayout" default="top"/>
+    </tag>
+  </tags>
+
+</tobago-config>
diff --git a/tobago-core/src/test/resources/tobago-config-for-unit-tests.xml b/tobago-core/src/test/resources/tobago-config-for-unit-tests.xml
index 4a9c10d..c68be5e 100644
--- a/tobago-core/src/test/resources/tobago-config-for-unit-tests.xml
+++ b/tobago-core/src/test/resources/tobago-config-for-unit-tests.xml
@@ -20,8 +20,8 @@
 <tobago-config
     xmlns="http://myfaces.apache.org/tobago/tobago-config"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-    xsi:schemaLocation="http://myfaces.apache.org/tobago/tobago-config http://myfaces.apache.org/tobago/tobago-config-5.0.xsd"
-    version="5.0">
+    xsi:schemaLocation="http://myfaces.apache.org/tobago/tobago-config http://myfaces.apache.org/tobago/tobago-config-5.1.xsd"
+    version="5.1">
 
   <theme-definitions>
     <theme-definition>
@@ -30,4 +30,52 @@
     </theme-definition>
   </theme-definitions>
 
+  <tags>
+    <tag name="date">
+      <attribute name="labelLayout" default="flexLeft"/>
+    </tag>
+    <tag name="file">
+      <attribute name="labelLayout" default="flexLeft"/>
+    </tag>
+    <tag name="in">
+     <attribute name="labelLayout" default="flexLeft"/>
+    </tag>
+    <tag name="out">
+      <attribute name="labelLayout" default="flexLeft"/>
+    </tag>
+    <tag name="range">
+      <attribute name="labelLayout" default="flexLeft"/>
+    </tag>
+    <tag name="selectBooleanCheckbox">
+      <attribute name="labelLayout" default="flexLeft"/>
+    </tag>
+    <tag name="selectBooleanToggle">
+      <attribute name="labelLayout" default="flexLeft"/>
+    </tag>
+    <tag name="selectManyCheckbox">
+      <attribute name="labelLayout" default="flexLeft"/>
+    </tag>
+    <tag name="selectManyListbox">
+      <attribute name="labelLayout" default="flexLeft"/>
+    </tag>
+    <tag name="selectManyShuttle">
+      <attribute name="labelLayout" default="flexLeft"/>
+    </tag>
+    <tag name="selectOneChoice">
+      <attribute name="labelLayout" default="flexLeft"/>
+    </tag>
+    <tag name="selectOneListbox">
+      <attribute name="labelLayout" default="flexLeft"/>
+    </tag>
+    <tag name="selectOneRadio">
+      <attribute name="labelLayout" default="flexLeft"/>
+    </tag>
+    <tag name="stars">
+      <attribute name="labelLayout" default="flexLeft"/>
+    </tag>
+    <tag name="textarea">
+      <attribute name="labelLayout" default="flexLeft"/>
+    </tag>
+  </tags>
+
 </tobago-config>
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/tobago-config.xml b/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/tobago-config.xml
index 14ffd92..024270d 100644
--- a/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/tobago-config.xml
+++ b/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/tobago-config.xml
@@ -20,8 +20,8 @@
 <tobago-config
     xmlns="http://myfaces.apache.org/tobago/tobago-config"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-    xsi:schemaLocation="http://myfaces.apache.org/tobago/tobago-config http://myfaces.apache.org/tobago/tobago-config-5.0.xsd"
-    version="5.0">
+    xsi:schemaLocation="http://myfaces.apache.org/tobago/tobago-config http://myfaces.apache.org/tobago/tobago-config-5.1.xsd"
+    version="5.1">
 
   <name>demo</name>
 
@@ -95,4 +95,14 @@
   <!-- true is the default -->
   <!--<decode-line-feed>false</decode-line-feed>-->
 
+  <!-- example for different label position
+  <tags>
+    <tag name="in">
+      <attribute name="labelLayout" default="top"/>
+    </tag>
+    <tag name="textarea">
+      <attribute name="labelLayout" default="top"/>
+    </tag>
+  </tags>
+  -->
 </tobago-config>
diff --git a/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/AnnotationUtils.java b/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/AnnotationUtils.java
deleted file mode 100644
index d55be7c..0000000
--- a/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/AnnotationUtils.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * 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.apt;
-
-import org.apache.myfaces.tobago.apt.annotation.UIComponentTag;
-
-import javax.lang.model.element.TypeElement;
-
-public final class AnnotationUtils {
-
-  private AnnotationUtils() {
-  }
-
-  /**
-   * @deprecated since 4.4.0. Will set automatically.
-   */
-  @Deprecated
-  public static String componentType(final UIComponentTag componentTag) {
-    final String s = componentTag.componentType();
-    if (s != null && s.length() > 0) {
-      return s;
-    } else {
-      return componentTag.uiComponent().replace(".component.UI", ".");
-    }
-  }
-
-  public static String generatedTagName(final TypeElement typeElement) {
-    final String s = typeElement.getQualifiedName().toString();
-    return s.replace(".component.", ".");
-  }
-
-}
diff --git a/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/generate/ComponentInfo.java b/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/generate/ComponentInfo.java
index 5967779..2cb352f 100644
--- a/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/generate/ComponentInfo.java
+++ b/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/generate/ComponentInfo.java
@@ -19,7 +19,6 @@
 
 package org.apache.myfaces.tobago.apt.generate;
 
-import org.apache.myfaces.tobago.apt.AnnotationUtils;
 import org.apache.myfaces.tobago.apt.annotation.UIComponentTag;
 
 import javax.lang.model.element.TypeElement;
@@ -40,7 +39,7 @@ public class ComponentInfo extends TagInfo {
   public ComponentInfo(final TypeElement declaration, final UIComponentTag componentTag) {
     super(declaration.getQualifiedName().toString(), componentTag.uiComponent(), componentTag.rendererType());
 
-    setComponentType(AnnotationUtils.componentType(componentTag));
+    setComponentType(componentTag.uiComponent().replace(".component.UI", "."));
     setComponentFamily(componentTag.componentFamily());
     setComponentClassName(componentTag.uiComponent());
   }
diff --git a/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/processor/CheckstyleConfigGenerator.java b/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/processor/CheckstyleConfigGenerator.java
index 25b6cad..baa6330 100644
--- a/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/processor/CheckstyleConfigGenerator.java
+++ b/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/processor/CheckstyleConfigGenerator.java
@@ -21,7 +21,6 @@ package org.apache.myfaces.tobago.apt.processor;
 
 
 import org.apache.commons.lang3.StringUtils;
-import org.apache.myfaces.tobago.apt.AnnotationUtils;
 import org.apache.myfaces.tobago.apt.annotation.ConverterTag;
 import org.apache.myfaces.tobago.apt.annotation.SimpleTag;
 import org.apache.myfaces.tobago.apt.annotation.Tag;
@@ -149,10 +148,10 @@ public class CheckstyleConfigGenerator extends AbstractGenerator {
       final String className;
       if (typeElement.getAnnotation(SimpleTag.class) != null || typeElement.getAnnotation(ValidatorTag.class) != null
           || typeElement.getAnnotation(ConverterTag.class) != null) {
-        className = AnnotationUtils.generatedTagName(typeElement);
+        final String s = typeElement.getQualifiedName().toString();
+        className = s.replace(".component.", ".");
       } else if (typeElement.getAnnotation(UIComponentTag.class) != null) {
-        className = "org.apache.myfaces.tobago.internal.taglib." + StringUtils.capitalize(annotationTag.name())
-            + "Tag";
+        className = "org.apache.myfaces.tobago.internal.taglib." + StringUtils.capitalize(annotationTag.name()) + "Tag";
       } else {
         throw new TobagoGeneratorException("Not supported: " + typeElement.getQualifiedName());
       }
diff --git a/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/processor/ClassesGenerator.java b/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/processor/ClassesGenerator.java
index f118ff8..3f41549 100644
--- a/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/processor/ClassesGenerator.java
+++ b/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/processor/ClassesGenerator.java
@@ -110,19 +110,7 @@ public class ClassesGenerator extends AbstractGenerator {
           + tag.name().substring(0, 1).toUpperCase() + tag.name().substring(1);
       final StringTemplate componentStringTemplate = componentStringTemplateGroup.getInstanceOf("component");
       final ComponentInfo componentInfo = new ComponentInfo(declaration, componentTag);
-      String componentBaseClass = componentTag.uiComponentBaseClass();
-      if ("".equals(componentBaseClass)) {
-        componentBaseClass = generic;
-      }
-      componentInfo.setSuperClass(componentBaseClass);
-
-      // check
-      if (!componentBaseClass.equals(generic)) {
-        warn("**********************************************************************************");
-        warn("generic name is unequal to the defined name: " + componentBaseClass + " != " + generic);
-        warn("**********************************************************************************");
-      }
-
+      componentInfo.setSuperClass(generic);
       componentInfo.setDescription(getDescription(declaration));
       componentInfo.setDeprecated(declaration.getAnnotation(Deprecated.class) != null);
       for (final String interfaces : componentTag.interfaces()) {
diff --git a/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/processor/TaglibGenerator.java b/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/processor/TaglibGenerator.java
index 142a97b..b51681d 100644
--- a/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/processor/TaglibGenerator.java
+++ b/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/processor/TaglibGenerator.java
@@ -20,7 +20,6 @@
 package org.apache.myfaces.tobago.apt.processor;
 
 import org.apache.commons.lang3.StringUtils;
-import org.apache.myfaces.tobago.apt.AnnotationUtils;
 import org.apache.myfaces.tobago.apt.annotation.ConverterTag;
 import org.apache.myfaces.tobago.apt.annotation.Facet;
 import org.apache.myfaces.tobago.apt.annotation.Markup;
@@ -497,7 +496,10 @@ public class TaglibGenerator extends AbstractGenerator {
       final Element componentElement = document.createElement("component");
       tagElement.appendChild(componentElement);
       addLeafTextElement(
-          AnnotationUtils.componentType(componentTag), "component-type", componentElement, document);
+          componentTag.uiComponent().replace(".component.UI", "."),
+          "component-type",
+          componentElement,
+          document);
       if (componentTag.rendererType().length > 0) {
         addLeafTextElement(componentTag.rendererType()[0], "renderer-type", componentElement, document);
       }
diff --git a/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/component.stg b/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/component.stg
index f903fb9..d51ee60 100644
--- a/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/component.stg
+++ b/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/component.stg
@@ -72,10 +72,10 @@ import javax.el.ValueExpression;
 public class <componentInfo.className>
     extends <componentInfo.superClassName> <first(componentInfo.interfaces):{ n | implements <n>}><rest(componentInfo.interfaces):{ n |, <n>}> {
 
-  <if(componentInfo.componentType)>
-  public static final String COMPONENT_TYPE = Tags.<componentInfo.tagName>.componentType();
+  private static final Tags TAG = Tags.<componentInfo.tagName>;
+
+  public static final String COMPONENT_TYPE = TAG.componentType();
 
-  <endif>
   <if(componentInfo.componentFamily)>
   public static final String COMPONENT_FAMILY = "<componentInfo.componentFamily>";