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 2011/06/22 10:58:59 UTC

svn commit: r1138345 - in /myfaces/tobago/trunk: tobago-core/src/main/java/org/apache/myfaces/tobago/context/ tobago-example/tobago-example-test/src/main/webapp/tc/sheet/ tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/ren...

Author: lofwyr
Date: Wed Jun 22 08:58:58 2011
New Revision: 1138345

URL: http://svn.apache.org/viewvc?rev=1138345&view=rev
Log:
TOBAGO-828: Make Sheet work with new LayoutManager
 - differ between simple content and complex content
 - this fixes the missing padding of tc:out inside of a tc:sheet

Added:
    myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/tc/sheet/sheet-types.xhtml
      - copied, changed from r1138040, myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/tc/sheet/sheet-simple.xhtml
Modified:
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/context/Markup.java
    myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java
    myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/style.css
    myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/META-INF/tobago-config.xml

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/context/Markup.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/context/Markup.java?rev=1138345&r1=1138344&r2=1138345&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/context/Markup.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/context/Markup.java Wed Jun 22 08:58:58 2011
@@ -64,6 +64,7 @@ public final class Markup implements Ser
   public static final Markup MODAL = valueOf("modal");
   public static final Markup NUMBER = valueOf("number");
   public static final Markup ODD = valueOf("odd");
+  public static final Markup PURE = valueOf("pure");
   public static final Markup READONLY = valueOf("readonly");
   public static final Markup REQUIRED = valueOf("required");
   public static final Markup RESIZABLE = valueOf("resizable");

Copied: myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/tc/sheet/sheet-types.xhtml (from r1138040, myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/tc/sheet/sheet-simple.xhtml)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/tc/sheet/sheet-types.xhtml?p2=myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/tc/sheet/sheet-types.xhtml&p1=myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/tc/sheet/sheet-simple.xhtml&r1=1138040&r2=1138345&rev=1138345&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/tc/sheet/sheet-simple.xhtml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/tc/sheet/sheet-types.xhtml Wed Jun 22 08:58:58 2011
@@ -23,14 +23,43 @@
     xmlns:f="http://java.sun.com/jsf/core">
 
   <tc:page id="page">
-    <tc:gridLayoutConstraint width="600px" height="600px"/>
+    <tc:gridLayoutConstraint width="1000px" height="600px"/>
 
-    <tc:sheet value="#{sheet.solarArray}" id="sheet" columns="*;*" var="luminary" rows="5">
-      <tc:column label="Name" id="name" sortable="true">
+    <tc:sheet value="#{sheet.solarArray}" id="sheet" columns="*;*;*;*;*;*;*;2*" var="luminary" rows="20">
+      <tc:column label="&lt;tc:out>" id="out">
         <tc:out value="#{luminary.name}"/>
       </tc:column>
-      <tc:column label="Orbit Of" id="orbit">
-        <tc:out value="#{luminary.orbit}"/>
+      <tc:column label="&lt;tc:in>" id="in">
+        <tc:in value="#{luminary.name}"/>
+      </tc:column>
+      <tc:column label="&lt;tx:date>" id="date">
+        <tx:date/>
+      </tc:column>
+      <tc:column label="&lt;tc:button>" id="button">
+        <tc:button label="#{luminary.name}"/>
+      </tc:column>
+      <tc:column label="&lt;tc:link>" id="link">
+        <tc:link label="#{luminary.name}"/>
+      </tc:column>
+      <tc:column label="&lt;tc:selectOneChoice>" id="selectOneChoice">
+        <tc:selectOneChoice>
+          <tc:selectItem itemLabel="first"/>
+          <tc:selectItem itemLabel="second"/>
+          <tc:selectItem itemLabel="third"/>
+        </tc:selectOneChoice>
+      </tc:column>
+      <tc:column label="&lt;tc:image>" id="image">
+        <tc:image value="image/foo.gif" width="16px" height="16px"/>
+      </tc:column>
+      <tc:column label="&lt;tc:panel>" id="panel">
+        <f:facet name="layout">
+          <tc:gridLayout columns="*;10px;*"/>
+        </f:facet>
+        <tc:panel>
+          <tc:in value="first"/>
+          <tc:out value="/"/>
+          <tc:in value="second"/>
+        </tc:panel>
       </tc:column>
     </tc:sheet>
 

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java?rev=1138345&r1=1138344&r2=1138345&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java Wed Jun 22 08:58:58 2011
@@ -24,8 +24,10 @@ import org.apache.myfaces.tobago.compone
 import org.apache.myfaces.tobago.component.UIColumnEvent;
 import org.apache.myfaces.tobago.component.UIColumnSelector;
 import org.apache.myfaces.tobago.component.UICommand;
+import org.apache.myfaces.tobago.component.UILink;
 import org.apache.myfaces.tobago.component.UIMenu;
 import org.apache.myfaces.tobago.component.UIMenuCommand;
+import org.apache.myfaces.tobago.component.UIOut;
 import org.apache.myfaces.tobago.component.UIReload;
 import org.apache.myfaces.tobago.component.UISheet;
 import org.apache.myfaces.tobago.config.Configurable;
@@ -322,6 +324,9 @@ public class SheetRenderer extends Layou
         if (hasClickAction) {
           markup = markup.add(Markup.CLICKABLE);
         }
+        if (isPure(column)) {
+          markup = markup.add(Markup.PURE);
+        }
         writer.writeClassAttribute(Classes.create(sheet, "cell", markup));
         final TextAlign align = TextAlign.parse((String) column.getAttributes().get(Attributes.ALIGN));
         if (align != null) {
@@ -490,6 +495,23 @@ public class SheetRenderer extends Layou
     }
   }
 
+  /**
+   * Differ between simple content and complex content.
+   * Decide if the content of a cell needs usually the whole possible space or
+   * is the character of the content like flowing text.
+   * In the second case, the style usually sets a padding.<br/>
+   * Pure is needed for &lt;tc:panel>,  &lt;tc:in>, etc.<br/>
+   * Pure is not needed for  &lt;tc:out> and &lt;tc:link>
+   */
+  private boolean isPure(UIColumn column) {
+    for (UIComponent child : column.getChildren()) {
+      if (!(child instanceof UIOut) && !(child instanceof UILink)) {
+        return true;
+      }
+    }
+    return false;
+  }
+
   private String createSheetPagingInfo(UISheet sheet, FacesContext facesContext, String pagerCommandId, boolean row) {
     String sheetPagingInfo;
     if (sheet.getRowCount() > 0) {

Modified: myfaces/tobago/trunk/tobago-theme/tobago-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/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/style.css?rev=1138345&r1=1138344&r2=1138345&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/style.css (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/style.css Wed Jun 22 08:58:58 2011
@@ -844,8 +844,7 @@ hr.tobago-separator {
 }
 
 .tobago-sheet-cell {
-  padding-left: 0;
-  padding-right: 0;
+  padding: 2px;
   vertical-align: top;
   overflow: hidden;
 }
@@ -854,6 +853,10 @@ hr.tobago-separator {
    cursor: pointer;
 }
 
+.tobago-sheet-cell-markup-pure {
+  padding: 0;
+}
+
 .tobago-sheet-row-markup-odd {
   background: #ffffff;
 }

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/META-INF/tobago-config.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/META-INF/tobago-config.xml?rev=1138345&r1=1138344&r2=1138345&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/META-INF/tobago-config.xml (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/META-INF/tobago-config.xml Wed Jun 22 08:58:58 2011
@@ -230,6 +230,7 @@
             <!-- for the cells -->
             <markup>clickable</markup>
             <markup>first</markup>
+            <markup>pure</markup>
             <!-- internal: for the paging fields -->
             <markup>left</markup>
             <markup>center</markup>