Author: [EMAIL PROTECTED]
Date: Thu Oct  9 08:44:15 2008
New Revision: 3729

Modified:
    releases/1.5/user/src/com/google/gwt/user/client/ui/Tree.java
    releases/1.5/user/src/com/google/gwt/user/client/ui/TreeItem.java

Log:
Fixes a couple of alignment bugs in the Tree.  One occurs when you remove  
all of the TreeItems in a parent, the other occurs because leaf TreeItems  
do not line up with their non-leaf siblings.

Patch by: jlabanca
Review by: ecc
Issue: 2853, 2491



Modified: releases/1.5/user/src/com/google/gwt/user/client/ui/Tree.java
==============================================================================
--- releases/1.5/user/src/com/google/gwt/user/client/ui/Tree.java       
(original)
+++ releases/1.5/user/src/com/google/gwt/user/client/ui/Tree.java       Thu Oct 
  
9 08:44:15 2008
@@ -777,7 +777,7 @@
     * @param treeItem the tree item
     */
    void showLeafImage(TreeItem treeItem) {
-    if (useLeafImages) {
+    if (useLeafImages || treeItem.isFullNode()) {
        showImage(treeItem, images.treeLeaf());
      } else {
        DOM.setStyleAttribute(treeItem.getElement(), "paddingLeft",  
indentValue);

Modified: releases/1.5/user/src/com/google/gwt/user/client/ui/TreeItem.java
==============================================================================
--- releases/1.5/user/src/com/google/gwt/user/client/ui/TreeItem.java    
(original)
+++ releases/1.5/user/src/com/google/gwt/user/client/ui/TreeItem.java   Thu  
Oct  9 08:44:15 2008
@@ -107,11 +107,6 @@
      void initializeClonableElements() {
        super.initializeClonableElements();
        if (GWT.isClient()) {
-        // Remove the padding from the cells and re-add it to the table  
element
-        DOM.setElementPropertyInt(BASE_INTERNAL_ELEM, "cellPadding", 0);
-        DOM.setElementPropertyInt(BASE_INTERNAL_ELEM, "cellSpacing", 0);
-        BASE_INTERNAL_ELEM.getStyle().setPropertyPx("paddingBottom", 3);
-
          // We can't use a 3px padding all around because IE will wrap the
          // childSpan to the next line, so we need to add a 3px margin on  
the top
          // and bottom instead. However, margins overlap, so we need a 6px  
bottom
@@ -688,7 +683,7 @@
    }

    Element getImageHolderElement() {
-    if (imageHolder == null) {
+    if (!isFullNode()) {
        convertToFullNode();
      }
      return imageHolder;
@@ -700,6 +695,10 @@
      DOM.appendChild(getElement(), childSpanElem);
      DOM.setStyleAttribute(childSpanElem, "whiteSpace", "nowrap");
      children = new ArrayList<TreeItem>();
+  }
+
+  boolean isFullNode() {
+    return imageHolder != null;
    }

    void setParentItem(TreeItem parent) {

--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/Google-Web-Toolkit-Contributors
-~----------~----~----~----~------~----~------~--~---

Reply via email to