You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by bo...@apache.org on 2008/08/05 23:21:22 UTC

svn commit: r682952 - in /myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago: component/AbstractUILabel.java taglib/component/LabelTagDeclaration.java

Author: bommel
Date: Tue Aug  5 14:21:21 2008
New Revision: 682952

URL: http://svn.apache.org/viewvc?rev=682952&view=rev
Log:
(TOBAGO-690) Markup attribute for Label Extension Tags doesn't work

Added:
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUILabel.java   (with props)
Modified:
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/LabelTagDeclaration.java

Added: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUILabel.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUILabel.java?rev=682952&view=auto
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUILabel.java (added)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUILabel.java Tue Aug  5 14:21:21 2008
@@ -0,0 +1,50 @@
+package org.apache.myfaces.tobago.component;
+
+/*
+ * 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.
+ */
+
+import org.apache.myfaces.tobago.TobagoConstants;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.faces.context.FacesContext;
+import javax.faces.component.UIComponent;
+import java.io.IOException;
+
+public class AbstractUILabel extends UIOutput {
+
+   private static final Log LOG = LogFactory.getLog(AbstractUILabel.class);
+
+  @Override
+  public void encodeBegin(FacesContext facesContext) throws IOException {
+    String forComponent = (String) getAttributes().get(TobagoConstants.ATTR_FOR);
+    if (LOG.isDebugEnabled()) {
+      LOG.debug("for = '" + forComponent + "'");
+    }
+    if ("@auto".equals(forComponent)) {
+      for (Object object : getParent().getChildren()) {
+        UIComponent child = (UIComponent) object;
+        if (child instanceof javax.faces.component.UIInput) {
+          forComponent = child.getId();
+          getAttributes().put(TobagoConstants.ATTR_FOR, forComponent);
+          break;
+        }
+      }
+    }
+    super.encodeBegin(facesContext);
+  }
+}

Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUILabel.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUILabel.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/LabelTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/LabelTagDeclaration.java?rev=682952&r1=682951&r2=682952&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/LabelTagDeclaration.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/LabelTagDeclaration.java Tue Aug  5 14:21:21 2008
@@ -42,7 +42,7 @@
 @Tag(name = "label", bodyContent = BodyContent.EMPTY)
 @UIComponentTag(
     uiComponent = "org.apache.myfaces.tobago.component.UILabel",
-    uiComponentBaseClass = "javax.faces.component.UIOutput",
+    uiComponentBaseClass = "org.apache.myfaces.tobago.component.AbstractUILabel",
     rendererType = "Label",
     allowedChildComponenents = "NONE")
 public interface LabelTagDeclaration extends HasIdBindingAndRendered,