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 2015/02/18 21:39:13 UTC

svn commit: r1660721 - in /myfaces/tobago/trunk: ./ tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/extension/ tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/extension/ tobago-example/tobago-example-demo/src/main/webap...

Author: lofwyr
Date: Wed Feb 18 20:39:12 2015
New Revision: 1660721

URL: http://svn.apache.org/r1660721
Log:
Merged from tobago-3.0.x
TOBAGO-1430: New tag <tx:out> as labeled version of <tc:out> [from revision 1646189]
TOBAGO-1430: New tag <tx:out> as labeled version of <tc:out> [from revision 1646226]

Added:
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/extension/OutExtensionHandler.java
      - copied unchanged from r1646189, myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/extension/OutExtensionHandler.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/extension/OutExtensionTag.java
      - copied, changed from r1646189, myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/extension/OutExtensionTag.java
Modified:
    myfaces/tobago/trunk/   (props changed)
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/01-basic/01/output.xhtml

Propchange: myfaces/tobago/trunk/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Feb 18 20:39:12 2015
@@ -1,3 +1,3 @@
 /myfaces/tobago/branches/tobago-1.5.x:1356585,1357124
-/myfaces/tobago/branches/tobago-3.0.x:1650101,1660635
+/myfaces/tobago/branches/tobago-3.0.x:1646189,1646226,1650101,1660635
 /myfaces/tobago/branches/tobago-tree-table:1226794-1341423

Copied: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/extension/OutExtensionTag.java (from r1646189, myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/extension/OutExtensionTag.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/extension/OutExtensionTag.java?p2=myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/extension/OutExtensionTag.java&p1=myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/extension/OutExtensionTag.java&r1=1646189&r2=1660721&rev=1660721&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/extension/OutExtensionTag.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/extension/OutExtensionTag.java Wed Feb 18 20:39:12 2015
@@ -24,8 +24,10 @@ import org.apache.myfaces.tobago.apt.ann
 import org.apache.myfaces.tobago.apt.annotation.Tag;
 import org.apache.myfaces.tobago.apt.annotation.TagAttribute;
 import org.apache.myfaces.tobago.apt.annotation.UIComponentTagAttribute;
+import org.apache.myfaces.tobago.internal.taglib.OutTag;
 
 import javax.el.ValueExpression;
+import javax.servlet.jsp.JspException;
 
 /**
  * Renders a text output field with a label.
@@ -49,7 +51,94 @@ import javax.el.ValueExpression;
 @ExtensionTag(
     baseClassName = "org.apache.myfaces.tobago.internal.taglib.OutTag",
     faceletHandler = "org.apache.myfaces.tobago.facelets.extension.OutExtensionHandler")
-public interface OutExtensionTag  {
+public class OutExtensionTag extends TobagoExtensionBodyTagSupport {
+
+  private ValueExpression binding;
+  private ValueExpression converter;
+  private ValueExpression label;
+  private ValueExpression rendered;
+  private ValueExpression tip;
+  private ValueExpression value;
+  private ValueExpression markup;
+  private ValueExpression labelWidth;
+  private String fieldId;
+
+  private LabelExtensionTag labelTag;
+  private OutTag outTag;
+
+  @Override
+  public int doStartTag() throws JspException {
+
+    labelTag = new LabelExtensionTag();
+    labelTag.setPageContext(pageContext);
+    if (id != null) {
+      labelTag.setId(id);
+    }
+    if (label != null) {
+      labelTag.setValue(label);
+    }
+    if (tip != null) {
+      labelTag.setTip(tip);
+    }
+    if (rendered != null) {
+      labelTag.setRendered(rendered);
+    }
+    if (labelWidth != null) {
+      labelTag.setColumns(createStringValueExpression(labelWidth.getExpressionString() + ";*"));
+    }
+    if (markup != null) {
+      labelTag.setMarkup(markup);
+    }
+    labelTag.setParent(getParent());
+    labelTag.setJspId(nextJspId());
+    labelTag.doStartTag();
+
+    outTag = new OutTag();
+    outTag.setPageContext(pageContext);
+    if (value != null) {
+      outTag.setValue(value);
+    }
+    if (binding != null) {
+      outTag.setBinding(binding);
+    }
+    if (converter != null) {
+      outTag.setConverter(converter);
+    }
+    if (fieldId != null) {
+      outTag.setId(fieldId);
+    }
+    if (markup != null) {
+      outTag.setMarkup(markup);
+    }
+    outTag.setParent(labelTag);
+    outTag.setJspId(nextJspId());
+    outTag.doStartTag();
+
+    return super.doStartTag();
+  }
+
+  @Override
+  public int doEndTag() throws JspException {
+    outTag.doEndTag();
+    labelTag.doEndTag();
+    return super.doEndTag();
+  }
+
+  @Override
+  public void release() {
+    super.release();
+    binding = null;
+    converter = null;
+    labelWidth = null;
+    label = null;
+    rendered = null;
+    tip = null;
+    value = null;
+    markup = null;
+    outTag = null;
+    labelTag = null;
+    fieldId = null;
+  }
 
   /**
    * Indicate markup of this component.
@@ -57,14 +146,18 @@ public interface OutExtensionTag  {
    */
   @TagAttribute
   @UIComponentTagAttribute(defaultValue = "none", type = "java.lang.String[]")
-  void setMarkup(final ValueExpression markup);
+  public void setMarkup(final ValueExpression markup) {
+    this.markup = markup;
+  }
 
   /**
    * The current value of this component.
    */
   @TagAttribute
   @UIComponentTagAttribute(type = "java.lang.Object")
-  void setValue(final ValueExpression value);
+  public void setValue(final ValueExpression value) {
+    this.value = value;
+  }
 
   /**
    * Text value to display as label.
@@ -72,7 +165,9 @@ public interface OutExtensionTag  {
    */
   @TagAttribute
   @UIComponentTagAttribute()
-  void setLabel(final ValueExpression label);
+  public void setLabel(final ValueExpression label) {
+    this.label = label;
+  }
 
   /**
    * The value binding expression linking this
@@ -80,7 +175,9 @@ public interface OutExtensionTag  {
    */
   @TagAttribute
   @UIComponentTagAttribute(type = "javax.faces.component.UIComponent")
-  void setBinding(final ValueExpression binding);
+  public void setBinding(final ValueExpression binding) {
+    this.binding = binding;
+  }
 
   /**
    * Flag indicating whether or not this component should be rendered
@@ -88,7 +185,9 @@ public interface OutExtensionTag  {
    */
   @TagAttribute
   @UIComponentTagAttribute(type = "boolean", defaultValue = "true")
-  void setRendered(final ValueExpression rendered);
+  public void setRendered(final ValueExpression rendered) {
+    this.rendered = rendered;
+  }
 
   /**
    * An expression that specifies the Converter for this component.
@@ -102,14 +201,18 @@ public interface OutExtensionTag  {
   @TagAttribute
   @UIComponentTagAttribute(type = "javax.faces.convert.Converter",
       expression = DynamicExpression.VALUE_EXPRESSION)
-  void setConverter(final ValueExpression converter);
+  public void setConverter(final ValueExpression converter) {
+    this.converter = converter;
+  }
 
   /**
    * Text value to display as tooltip.
    */
   @TagAttribute
   @UIComponentTagAttribute()
-  void setTip(final ValueExpression tip);
+  public void setTip(final ValueExpression tip) {
+    this.tip = tip;
+  }
 
   /**
    * The width for the label component. Default: 'auto'.
@@ -118,7 +221,9 @@ public interface OutExtensionTag  {
    */
   @TagAttribute
   @UIComponentTagAttribute()
-  void setLabelWidth(final ValueExpression labelWidth);
+  public void setLabelWidth(final ValueExpression labelWidth) {
+    this.labelWidth = labelWidth;
+  }
 
   /**
    * The component identifier for the input field component inside of the container.
@@ -126,7 +231,9 @@ public interface OutExtensionTag  {
    */
   @TagAttribute(rtexprvalue = true)
   @UIComponentTagAttribute
-  void setFieldId(final String fieldId);
+  public void setFieldId(final String fieldId) {
+    this.fieldId = fieldId;
+  }
 
   /**
    * The component identifier for this component.
@@ -136,5 +243,7 @@ public interface OutExtensionTag  {
    */
   @TagAttribute(rtexprvalue = true)
   @UIComponentTagAttribute
-  void setId(final String id);
+  public void setId(final String id) {
+    super.setId(id);
+  }
 }

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/01-basic/01/output.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/01-basic/01/output.xhtml?rev=1660721&r1=1660720&r2=1660721&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/01-basic/01/output.xhtml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/01-basic/01/output.xhtml Wed Feb 18 20:39:12 2015
@@ -25,7 +25,7 @@
                 xmlns:f="http://java.sun.com/jsf/core">
 <tc:box label="Output Controls">
       <f:facet name="layout">
-        <tc:gridLayout columns="150px;*" rows="auto;300px;auto;auto;90px;*" border="1"/>
+        <tc:gridLayout columns="*" rows="auto;auto;100px;auto;auto;90px;*" border="1"/>
       </f:facet>
 
       <!-- code-sniplet-start id="label" -->
@@ -33,6 +33,10 @@
       <!-- code-sniplet-end id="label" -->
       <tc:cell/>
 
+      <tx:out label="Phone Number" value="+1 234 567890">
+          <tc:gridLayoutConstraint columnSpan="2"/>
+      </tx:out>
+
       <tc:cell spanX="2">
         <!-- code-sniplet-start id="out" -->
         <tc:out value="Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Quisque consequat, libero eget porta mattis, risus velit congue magna, at posuere sem orci vitae turpis. Integer pulvinar. Cras libero. Proin vestibulum tempor urna. Nulla odio nisl, auctor vitae, faucibus pharetra, feugiat eget, justo. Suspendisse at tellus non justo dictum tincidunt. Aenean placerat nunc id tortor. Donec mollis ornare pede. Vestibulum ut arcu et dolor auctor varius. Praesent tincidunt, eros quis vulputate facilisis, orci turpis sollicitudin justo, id faucibus nunc orci sed purus. Proin ligula erat, sollicitudin id, rhoncus eget, nonummy sit amet, risus. Aenean arcu lorem, facilisis et, posuere sed, ultrices tincidunt, nunc. Sed ac massa. Quisque lacinia. Donec quis nibh.