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 2012/03/06 17:48:18 UTC

svn commit: r1297570 - in /myfaces/tobago/branches/tobago-tree-table: tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/ tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ tobago-core/src/main/java/org/a...

Author: lofwyr
Date: Tue Mar  6 16:48:17 2012
New Revision: 1297570

URL: http://svn.apache.org/viewvc?rev=1297570&view=rev
Log:
TOBAGO-1049: Tree inside of the Sheet (aka TreeTable)
 - adding "showRootJunction" to the sheet
 - using icons (close/open) without lines for the tree inside of the sheet

Added:
    myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/declaration/IsShowRootJunction.java
      - copied, changed from r1297474, myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/declaration/IsShowRoot.java
    myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-richmond/src/main/resources/org/apache/myfaces/tobago/renderkit/html/richmond/standard/image/minus.gif   (with props)
    myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-richmond/src/main/resources/org/apache/myfaces/tobago/renderkit/html/richmond/standard/image/plus.gif
      - copied unchanged from r1297474, myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-richmond/src/main/resources/org/apache/myfaces/tobago/renderkit/html/richmond/standard/image/Lplus.gif
    myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/image/minus.gif   (with props)
    myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/image/plus.gif   (with props)
    myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/image/minus.gif   (with props)
    myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/image/plus.gif   (with props)
Modified:
    myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIData.java
    myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SheetTagDeclaration.java
    myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeTagDeclaration.java
    myfaces/tobago/branches/tobago-tree-table/tobago-example/tobago-example-test/src/main/webapp/tc/sheet/sheet-tree.xhtml
    myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeIndentRenderer.java
    myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/style.css
    myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/style/style.css

Modified: myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIData.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIData.java?rev=1297570&r1=1297569&r2=1297570&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIData.java (original)
+++ myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIData.java Tue Mar  6 16:48:17 2012
@@ -104,6 +104,10 @@ public abstract class AbstractUIData ext
 
   public abstract boolean isShowRoot();
 
+  public boolean isShowRootJunction() {
+    return false;
+  }
+
   /**
    * The value describes, if the UIData renderer creates container elements to hold the row information.
    * This information is important for the TreeNodeRenderer to set the visible state in the output or not.

Modified: myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SheetTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SheetTagDeclaration.java?rev=1297570&r1=1297569&r2=1297570&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SheetTagDeclaration.java (original)
+++ myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SheetTagDeclaration.java Tue Mar  6 16:48:17 2012
@@ -33,6 +33,7 @@ import org.apache.myfaces.tobago.interna
 import org.apache.myfaces.tobago.internal.taglib.declaration.IsGridLayoutComponent;
 import org.apache.myfaces.tobago.internal.taglib.declaration.IsGridLayoutContainer;
 import org.apache.myfaces.tobago.internal.taglib.declaration.IsShowRoot;
+import org.apache.myfaces.tobago.internal.taglib.declaration.IsShowRootJunction;
 
 /**
  * Render a sheet element.
@@ -51,7 +52,7 @@ import org.apache.myfaces.tobago.interna
                      allowedChildComponenents = "org.apache.myfaces.tobago.Reload")})
 public interface SheetTagDeclaration 
     extends HasIdBindingAndRendered, IsGridLayoutComponent, IsGridLayoutContainer, HasMarkup, HasCurrentMarkup,
-    HasRenderedPartially, IsShowRoot {
+    HasRenderedPartially, IsShowRoot, IsShowRootJunction {
   /**
    * LayoutConstraints for column layout.
    * Semicolon separated list of layout tokens ('<x>*', '<x>px' or '<x>%').

Modified: myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeTagDeclaration.java?rev=1297570&r1=1297569&r2=1297570&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeTagDeclaration.java (original)
+++ myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeTagDeclaration.java Tue Mar  6 16:48:17 2012
@@ -32,6 +32,7 @@ import org.apache.myfaces.tobago.interna
 import org.apache.myfaces.tobago.internal.taglib.declaration.IsGridLayoutComponent;
 import org.apache.myfaces.tobago.internal.taglib.declaration.IsRequired;
 import org.apache.myfaces.tobago.internal.taglib.declaration.IsShowRoot;
+import org.apache.myfaces.tobago.internal.taglib.declaration.IsShowRootJunction;
 
 /**
  * A tree with classical look. 
@@ -49,7 +50,7 @@ import org.apache.myfaces.tobago.interna
         })
 public interface TreeTagDeclaration
     extends HasIdBindingAndRendered, HasValue, HasVar, IsRequired, IsGridLayoutComponent, HasMarkup, HasCurrentMarkup,
-    IsShowRoot {
+    IsShowRoot, IsShowRootJunction {
 
   /**
    * Flag indicating whether or not this component should be render selectable items.
@@ -69,10 +70,6 @@ public interface TreeTagDeclaration
       allowedValues = {"multi", "single", "multiLeafOnly", "singleLeafOnly", "off"})
   void setSelectable(String selectable);
 
-  @TagAttribute
-  @UIComponentTagAttribute(type = "boolean", defaultValue = "false")
-  void setShowRootJunction(String showRootJunction);
-
   /**
    *
    * <strong>ValueBindingExpression</strong> pointing to a object to save the

Copied: myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/declaration/IsShowRootJunction.java (from r1297474, myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/declaration/IsShowRoot.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/declaration/IsShowRootJunction.java?p2=myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/declaration/IsShowRootJunction.java&p1=myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/declaration/IsShowRoot.java&r1=1297474&r2=1297570&rev=1297570&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/declaration/IsShowRoot.java (original)
+++ myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/declaration/IsShowRootJunction.java Tue Mar  6 16:48:17 2012
@@ -20,15 +20,14 @@ package org.apache.myfaces.tobago.intern
 import org.apache.myfaces.tobago.apt.annotation.TagAttribute;
 import org.apache.myfaces.tobago.apt.annotation.UIComponentTagAttribute;
 
-public interface IsShowRoot {
+public interface IsShowRootJunction {
 
   /**
    * Only applicable in the case that the data model is a tree.
-   * This flag indicates that the root node should be displayed.
-   * Often in tree structures the root node is special and should not be displayed.
+   * This flag indicates that the root node should be displayed with an open-close-switch.
    */
   @TagAttribute
   @UIComponentTagAttribute(type = "boolean", defaultValue = "false")
-  void setShowRoot(String showRoot);
+  void setShowRootJunction(String showRootJunction);
 
 }

Modified: myfaces/tobago/branches/tobago-tree-table/tobago-example/tobago-example-test/src/main/webapp/tc/sheet/sheet-tree.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-tree-table/tobago-example/tobago-example-test/src/main/webapp/tc/sheet/sheet-tree.xhtml?rev=1297570&r1=1297569&r2=1297570&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-tree-table/tobago-example/tobago-example-test/src/main/webapp/tc/sheet/sheet-tree.xhtml (original)
+++ myfaces/tobago/branches/tobago-tree-table/tobago-example/tobago-example-test/src/main/webapp/tc/sheet/sheet-tree.xhtml Tue Mar  6 16:48:17 2012
@@ -28,7 +28,7 @@
       <tc:gridLayout rows="*;auto"/>
     </f:facet>
 
-    <tc:sheet value="#{tree.tree}" id="sheet" columns="*;*" var="row">
+    <tc:sheet value="#{tree.tree}" id="sheet" columns="*;*" var="row" showRoot="true" showRootJunction="true">
 
       <tc:column label="Tree" id="tree">
         <tc:treeNode expanded="#{row.level le 1}">

Added: myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-richmond/src/main/resources/org/apache/myfaces/tobago/renderkit/html/richmond/standard/image/minus.gif
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-richmond/src/main/resources/org/apache/myfaces/tobago/renderkit/html/richmond/standard/image/minus.gif?rev=1297570&view=auto
==============================================================================
Binary file - no diff available.

Propchange: myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-richmond/src/main/resources/org/apache/myfaces/tobago/renderkit/html/richmond/standard/image/minus.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Modified: myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeIndentRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeIndentRenderer.java?rev=1297570&r1=1297569&r2=1297570&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeIndentRenderer.java (original)
+++ myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeIndentRenderer.java Tue Mar  6 16:48:17 2012
@@ -52,26 +52,27 @@ public class TreeIndentRenderer extends 
 
     final boolean showRoot = data.isShowRoot();
     final boolean showJunctions = indent.isShowJunctions();
-    // todo: sheet
-    final boolean showRootJunction = data instanceof UITree && ((UITree) data).isShowRootJunction();
+    final boolean showRootJunction = data.isShowRootJunction();
     final boolean expanded = folder && node.isExpandedWithTemporaryState();
+    final boolean showLines = showJunctions && data instanceof UITree; // sheet should not show lines
+    final boolean showIcons = showJunctions;
 
     final TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);
 
     encodeIndent(
-        facesContext, writer, node, showJunctions, showRootJunction, showRoot, junctions);
+        facesContext, writer, node, showLines, showIcons, showRootJunction, showRoot, junctions);
 
     encodeTreeJunction(
-        facesContext, writer, node, showJunctions, showRootJunction, junctions, expanded, folder, level == 0);
+        facesContext, writer, node, showLines, showIcons, showRootJunction, junctions, expanded, folder, level == 0);
   }
 
   private void encodeIndent(
       final FacesContext facesContext, final TobagoResponseWriter writer, final UITreeNode node,
-      final boolean showJunctions, final boolean showRootJunction, final boolean showRoot,
+      final boolean showLines, final boolean showIcons, final boolean showRootJunction, final boolean showRoot,
       final List<Boolean> junctions)
       throws IOException {
 
-    final boolean dropFirst = !showRoot || !showRootJunction && showJunctions;
+    final boolean dropFirst = !showRoot || !showRootJunction && (showLines || showIcons);
     final String blank = ResourceManagerUtils.getImageWithPath(facesContext, "image/blank.gif");
     final String perpendicular = ResourceManagerUtils.getImageWithPath(facesContext, "image/I.gif");
 
@@ -80,7 +81,7 @@ public class TreeIndentRenderer extends 
       writer.startElement(HtmlElements.IMG, null);
       writer.writeClassAttribute(Classes.create(node, "junction"));
       writer.writeAttribute(HtmlAttributes.ALT, "", false);
-      if (junction && showJunctions) {
+      if (junction && showLines) {
         writer.writeAttribute("src", perpendicular, true);
       } else {
         writer.writeAttribute("src", blank, true);
@@ -91,10 +92,10 @@ public class TreeIndentRenderer extends 
 
   private void encodeTreeJunction(
       final FacesContext facesContext, final TobagoResponseWriter writer, final UITreeNode node,
-      final boolean showJunctions, final boolean showRootJunction, final List<Boolean> junctions,
+      final boolean showLines, final boolean showIcons, final boolean showRootJunction, final List<Boolean> junctions,
       final boolean expanded, final boolean folder, final boolean root)
       throws IOException {
-    if (!showJunctions || !showRootJunction && root) {
+    if (!showIcons || !showRootJunction && root) {
       return;
     }
     final boolean hasNextSibling = junctions.get(junctions.size() - 1); // last element
@@ -103,27 +104,37 @@ public class TreeIndentRenderer extends 
 
     final String open;
     final String close;
-    if (root) {
-      open = "Rminus.gif";
-      close = "Rplus.gif";
-    } else {
-      if (hasNextSibling) {
-        if (folder) {
-          open = "Tminus.gif";
-          close = "Tplus.gif";
-        } else {
-          open = "T.gif";
-          close = "T.gif";
-        }
+    if (showLines) {
+      if (root) {
+        open = "Rminus.gif";
+        close = "Rplus.gif";
       } else {
-        if (folder) {
-          open = "Lminus.gif";
-          close = "Lplus.gif";
+        if (hasNextSibling) {
+          if (folder) {
+            open = "Tminus.gif";
+            close = "Tplus.gif";
+          } else {
+            open = "T.gif";
+            close = "T.gif";
+          }
         } else {
-          open = "L.gif";
-          close = "L.gif";
+          if (folder) {
+            open = "Lminus.gif";
+            close = "Lplus.gif";
+          } else {
+            open = "L.gif";
+            close = "L.gif";
+          }
         }
       }
+    } else {
+      if (folder) {
+        open = "minus.gif";
+        close = "plus.gif";
+      } else {
+        open = "blank.gif";
+        close = "blank.gif";
+      }
     }
 
     final String srcOpen = ResourceManagerUtils.getImageWithPath(facesContext, "image/" + open);

Added: myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/image/minus.gif
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/image/minus.gif?rev=1297570&view=auto
==============================================================================
Binary file - no diff available.

Propchange: myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/image/minus.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/image/plus.gif
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/image/plus.gif?rev=1297570&view=auto
==============================================================================
Binary file - no diff available.

Propchange: myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/image/plus.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Modified: myfaces/tobago/branches/tobago-tree-table/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/branches/tobago-tree-table/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/style.css?rev=1297570&r1=1297569&r2=1297570&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/style.css (original)
+++ myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/style.css Tue Mar  6 16:48:17 2012
@@ -1429,7 +1429,7 @@ div.tobago-richTextEditor-body {
 }
 
 .tobago-treeNode img {
-  vertical-align: middle;
+  vertical-align: bottom;
   border: 0;
 }
 

Added: myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/image/minus.gif
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/image/minus.gif?rev=1297570&view=auto
==============================================================================
Binary file - no diff available.

Propchange: myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/image/minus.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/image/plus.gif
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/image/plus.gif?rev=1297570&view=auto
==============================================================================
Binary file - no diff available.

Propchange: myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/image/plus.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Modified: myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/style/style.css
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/style/style.css?rev=1297570&r1=1297569&r2=1297570&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/style/style.css (original)
+++ myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/style/style.css Tue Mar  6 16:48:17 2012
@@ -783,18 +783,6 @@ div.tobago-tabGroup-toolBar {
   float: right;
 }
 
-.tobago-treeNode img {
-  vertical-align: top;
-	border: 0px;
-}
-
-/*
-.tobago-treeNode a {
-  font-size: 12px;
-  font-family: arial, helvetica, sans-serif;
-}
-
-*/
 .tobago-treeNode-disabled a {
   color: #888888;
   text-decoration: none;