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 2009/08/07 15:57:47 UTC

svn commit: r802009 - in /myfaces/tobago/trunk: core/src/main/java/org/apache/myfaces/tobago/taglib/component/ example/test/src/main/webapp/tc/separator/ theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard...

Author: lofwyr
Date: Fri Aug  7 13:57:46 2009
New Revision: 802009

URL: http://svn.apache.org/viewvc?rev=802009&view=rev
Log:
TOBAGO-779: Label attribute for tc:separator and cleaning up

Added:
    myfaces/tobago/trunk/example/test/src/main/webapp/tc/separator/
    myfaces/tobago/trunk/example/test/src/main/webapp/tc/separator/separator-with-label-facet.xhtml
    myfaces/tobago/trunk/example/test/src/main/webapp/tc/separator/separator-with-label.xhtml
    myfaces/tobago/trunk/example/test/src/main/webapp/tc/separator/separator-without-label.xhtml
Modified:
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/SeparatorTagDeclaration.java
    myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/style.css
    myfaces/tobago/trunk/theme/speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/style/style.css
    myfaces/tobago/trunk/theme/standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SeparatorRenderer.java
    myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/property/tobago-theme-config.properties

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/SeparatorTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/SeparatorTagDeclaration.java?rev=802009&r1=802008&r2=802009&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/SeparatorTagDeclaration.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/SeparatorTagDeclaration.java Fri Aug  7 13:57:46 2009
@@ -23,6 +23,7 @@
 import org.apache.myfaces.tobago.component.Facets;
 import org.apache.myfaces.tobago.component.RendererTypes;
 import org.apache.myfaces.tobago.taglib.decl.HasIdBindingAndRendered;
+import org.apache.myfaces.tobago.taglib.decl.HasLabel;
 import org.apache.myfaces.tobago.taglib.decl.IsGridLayoutComponent;
 
 /**
@@ -38,5 +39,5 @@
     facets = { @Facet(name= Facets.LABEL, description = "This facet contains a UILabel",
                       allowedChildComponenents = "org.apache.myfaces.tobago.Label") })
 
-public interface SeparatorTagDeclaration extends HasIdBindingAndRendered, IsGridLayoutComponent {
+public interface SeparatorTagDeclaration extends HasIdBindingAndRendered, IsGridLayoutComponent, HasLabel {
 }

Added: myfaces/tobago/trunk/example/test/src/main/webapp/tc/separator/separator-with-label-facet.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/test/src/main/webapp/tc/separator/separator-with-label-facet.xhtml?rev=802009&view=auto
==============================================================================
--- myfaces/tobago/trunk/example/test/src/main/webapp/tc/separator/separator-with-label-facet.xhtml (added)
+++ myfaces/tobago/trunk/example/test/src/main/webapp/tc/separator/separator-with-label-facet.xhtml Fri Aug  7 13:57:46 2009
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<f:view
+    xmlns:jsp="http://java.sun.com/JSP/Page"
+    xmlns:tc="http://myfaces.apache.org/tobago/component"
+    xmlns:tx="http://myfaces.apache.org/tobago/extension"
+    xmlns:ui="http://java.sun.com/jsf/facelets"
+    xmlns:f="http://java.sun.com/jsf/core">
+
+  <tc:page>
+    <tc:gridLayoutConstraint width="600px" height="300px"/>
+    <f:facet name="layout">
+      <tc:gridLayout rows="auto;*"/>
+    </f:facet>
+
+    <tc:separator>
+      <f:facet name="label">
+        <tc:label value="Label (Ög) is deprecated"/>
+      </f:facet>
+    </tc:separator>
+    <tc:panel/>
+
+  </tc:page>
+</f:view>

Added: myfaces/tobago/trunk/example/test/src/main/webapp/tc/separator/separator-with-label.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/test/src/main/webapp/tc/separator/separator-with-label.xhtml?rev=802009&view=auto
==============================================================================
--- myfaces/tobago/trunk/example/test/src/main/webapp/tc/separator/separator-with-label.xhtml (added)
+++ myfaces/tobago/trunk/example/test/src/main/webapp/tc/separator/separator-with-label.xhtml Fri Aug  7 13:57:46 2009
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<f:view
+    xmlns:jsp="http://java.sun.com/JSP/Page"
+    xmlns:tc="http://myfaces.apache.org/tobago/component"
+    xmlns:tx="http://myfaces.apache.org/tobago/extension"
+    xmlns:ui="http://java.sun.com/jsf/facelets"
+    xmlns:f="http://java.sun.com/jsf/core">
+
+  <tc:page>
+    <tc:gridLayoutConstraint width="600px" height="300px"/>
+    <f:facet name="layout">
+      <tc:gridLayout rows="auto;*"/>
+    </f:facet>
+
+    <tc:separator label="Label (Ög)"/>
+    <tc:panel/>
+
+  </tc:page>
+</f:view>

Added: myfaces/tobago/trunk/example/test/src/main/webapp/tc/separator/separator-without-label.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/test/src/main/webapp/tc/separator/separator-without-label.xhtml?rev=802009&view=auto
==============================================================================
--- myfaces/tobago/trunk/example/test/src/main/webapp/tc/separator/separator-without-label.xhtml (added)
+++ myfaces/tobago/trunk/example/test/src/main/webapp/tc/separator/separator-without-label.xhtml Fri Aug  7 13:57:46 2009
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<f:view
+    xmlns:jsp="http://java.sun.com/JSP/Page"
+    xmlns:tc="http://myfaces.apache.org/tobago/component"
+    xmlns:tx="http://myfaces.apache.org/tobago/extension"
+    xmlns:ui="http://java.sun.com/jsf/facelets"
+    xmlns:f="http://java.sun.com/jsf/core">
+
+  <tc:page>
+    <tc:gridLayoutConstraint width="600px" height="300px"/>
+    <f:facet name="layout">
+      <tc:gridLayout rows="auto;*"/>
+    </f:facet>
+
+    <tc:separator/>
+    <tc:panel/>
+
+  </tc:page>
+</f:view>

Modified: myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/style.css
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/style.css?rev=802009&r1=802008&r2=802009&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/style.css (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/style.css Fri Aug  7 13:57:46 2009
@@ -784,34 +784,31 @@
 
 /* separator ------------------------------------------------------------------- */
 
-div.tobago-separator-default {
-  overflow: hidden;
+.tobago-separator-default {
+  position: absolute;
+}
+
+hr.tobago-separator-default {
+  border: 1px inset #000000;
 }
 
-fieldset.tobago-separator-default  {
-  border-left: 0px;
-  border-bottom: 0px;
-  border-right: 0px;
-  border-top: 1px solid #333;
+.tobago-separator-start-default {
+  width: 20px;
+  position: static;
 }
 
-legend.tobago-separator-default, .tobago-separator-label-default {
+.tobago-separator-label-default {
   font: bold 12px arial, helvetica, sans-serif;
   padding-left: 5px;
   padding-right: 5px;
   white-space: nowrap;
 }
 
-.tobago-separator-start-default {
-  width: 20px;
+.tobago-separator-end-default {
+  width: 100%;
+  position: static;
 }
 
-hr.tobago-separator-default {
-  border-top: 1px solid #E2E2E2;
-  border-right: 1px solid #E2E2E2;
-  border-bottom: 1px solid #000000;
-  border-left: 1px solid #E2E2E2;
-}
 
 /* time -------------------------------------------------------------------- */
 

Modified: myfaces/tobago/trunk/theme/speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/style/style.css
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/style/style.css?rev=802009&r1=802008&r2=802009&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/style/style.css (original)
+++ myfaces/tobago/trunk/theme/speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/style/style.css Fri Aug  7 13:57:46 2009
@@ -25,13 +25,6 @@
   color: #888888;
 }
 
-hr  {
-  border-top: 1px solid #E2E2E2;
-  border-right: 1px solid #E2E2E2;
-  border-bottom: 1px solid #000000;
-  border-left: 1px solid #E2E2E2;
-}
-
 h5  {
   font: bold 14px arial, helvetica, sans-serif;
   margin-top: 0px;
@@ -881,7 +874,15 @@
   border-left: 1px solid #E2E2E2;
 }
 
+/* separator ------------------------------------------------------------------- */
+
+hr.tobago-separator-default {
+  border: 0 solid #000000;
+  border-bottom-width: 1px;
+}
+
 /* Sheet -------------------------------------------------------- */
+
 .tobago-sheet-header-div {
   left: 1px;
   height: 20px;

Modified: myfaces/tobago/trunk/theme/standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SeparatorRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SeparatorRenderer.java?rev=802009&r1=802008&r2=802009&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SeparatorRenderer.java (original)
+++ myfaces/tobago/trunk/theme/standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SeparatorRenderer.java Fri Aug  7 13:57:46 2009
@@ -19,6 +19,7 @@
 
 import org.apache.myfaces.tobago.component.Facets;
 import org.apache.myfaces.tobago.component.UILabel;
+import org.apache.myfaces.tobago.component.UISeparator;
 import org.apache.myfaces.tobago.context.ClientProperties;
 import org.apache.myfaces.tobago.renderkit.HtmlUtils;
 import org.apache.myfaces.tobago.renderkit.LayoutableRendererBase;
@@ -26,6 +27,7 @@
 import org.apache.myfaces.tobago.renderkit.html.HtmlConstants;
 import org.apache.myfaces.tobago.renderkit.html.StyleClasses;
 import org.apache.myfaces.tobago.renderkit.html.util.HtmlRendererUtil;
+import org.apache.myfaces.tobago.util.Deprecation;
 import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
 
 import javax.faces.component.UIComponent;
@@ -34,66 +36,65 @@
 
 public class SeparatorRenderer extends LayoutableRendererBase {
 
-  public void encodeEnd(FacesContext facesContext,
-      UIComponent component) throws IOException {
+  public void encodeEnd(FacesContext facesContext, UIComponent component) throws IOException {
+
+    UISeparator separator = (UISeparator) component;
     TobagoResponseWriter writer = HtmlRendererUtil.getTobagoResponseWriter(facesContext);
-    writer.startElement(HtmlConstants.DIV, component);
-    writer.writeClassAttribute();
-    writer.writeStyleAttribute();
-    if (component.getFacet(Facets.LABEL) != null) {
+
+    String label = separator.getLabel();
+    if (label == null && separator.getFacet(Facets.LABEL) != null) {
+      // deprecated
+      Deprecation.LOG.warn("label facet in tc:separator is deprecated, use label attribute instead, please.");
+      label = String.valueOf(((UILabel) separator.getFacet(Facets.LABEL)).getValue());
+    }
+
+    if (label != null) {
+      if (ClientProperties.getInstance(facesContext.getViewRoot()).getUserAgent().isMsie()) {
+        label = label.replace(" ", HtmlUtils.CHAR_NON_BEAKING_SPACE);
+      }
+
       writer.startElement(HtmlConstants.TABLE, component);
       writer.writeClassAttribute();
+      writer.writeStyleAttribute();
 
-      writer.writeAttribute(HtmlAttributes.WIDTH, "100%", false);
       writer.writeAttribute(HtmlAttributes.CELLPADDING, "0", false);
       writer.writeAttribute(HtmlAttributes.CELLSPACING, "0", false);
       writer.startElement(HtmlConstants.TR, component);
 
       writer.startElement(HtmlConstants.TD, component);
       StyleClasses startClass = new StyleClasses();
+      startClass.addAspectClass("separator", StyleClasses.Aspect.DEFAULT);
       startClass.addAspectClass("separator", "start", StyleClasses.Aspect.DEFAULT);
       writer.writeClassAttribute(startClass);
       writer.startElement(HtmlConstants.HR , component);
-      writer.writeClassAttribute();
+      writer.writeClassAttribute(startClass);
       writer.endElement(HtmlConstants.HR);
       writer.endElement(HtmlConstants.TD);
 
       writer.startElement(HtmlConstants.TD, component);
-      writer.writeAttribute(HtmlAttributes.STYLE, "width: 1px", false);
       StyleClasses labelClass = new StyleClasses();
       labelClass.addAspectClass("separator", "label", StyleClasses.Aspect.DEFAULT);
       writer.writeClassAttribute(labelClass);
-      UILabel label = (UILabel) component.getFacet(Facets.LABEL);
-      String text = String.valueOf(label.getValue());
-      if (ClientProperties.getInstance(facesContext.getViewRoot()).getUserAgent().isMsie()) {
-        text = text.replace(" ", HtmlUtils.CHAR_NON_BEAKING_SPACE);
-      }
-      writer.writeText(text);
+      writer.writeText(label);
       writer.endElement(HtmlConstants.TD);
 
       writer.startElement(HtmlConstants.TD, component);
+      StyleClasses endClass = new StyleClasses();
+      endClass.addAspectClass("separator", StyleClasses.Aspect.DEFAULT);
+      endClass.addAspectClass("separator", "end", StyleClasses.Aspect.DEFAULT);
+      writer.writeClassAttribute(endClass);
       writer.startElement(HtmlConstants.HR , component);
-      writer.writeClassAttribute();
+      writer.writeClassAttribute(endClass);
       writer.endElement(HtmlConstants.HR);
       writer.endElement(HtmlConstants.TD);
 
       writer.endElement(HtmlConstants.TR);
       writer.endElement(HtmlConstants.TABLE);
-      /* field set variant for Scarborough 
-      writer.startElement(HtmlConstants.FIELDSET, component);
-      writer.writeComponentClass();
-      UILabel label =  (UILabel) component.getFacet("label");
-      writer.startElement(HtmlConstants.LEGEND, component);
-      writer.writeComponentClass();
-      writer.writeText(label.getValue(), null);
-      writer.endElement(HtmlConstants.LEGEND);
-      writer.endElement(HtmlConstants.FIELDSET);
-      */
     } else {
       writer.startElement(HtmlConstants.HR , component);
       writer.writeClassAttribute();
+      writer.writeStyleAttribute();
       writer.endElement(HtmlConstants.HR);
     }
-    writer.endElement(HtmlConstants.DIV);
   }
 }

Modified: myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/property/tobago-theme-config.properties
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/property/tobago-theme-config.properties?rev=802009&r1=802008&r2=802009&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/property/tobago-theme-config.properties (original)
+++ myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/property/tobago-theme-config.properties Fri Aug  7 13:57:46 2009
@@ -42,3 +42,14 @@
 Panel.topOffset=0
 Panel.rightOffset=0
 Panel.bottomOffset=0
+
+Separator.css.border-left-width=0
+Separator.css.border-top-width=0
+Separator.css.border-right-width=0
+Separator.css.border-bottom-width=0
+
+Separator.css.padding-left=0
+Separator.css.padding-top=0
+Separator.css.padding-right=0
+Separator.css.padding-bottom=0
+