]> source.dussan.org Git - vaadin-framework.git/commitdiff
Reverted accidental uncommented commit. Proper commit coming next.
authorJouni Koivuviita <jouni.koivuviita@itmill.com>
Thu, 19 May 2011 08:27:28 +0000 (08:27 +0000)
committerJouni Koivuviita <jouni.koivuviita@itmill.com>
Thu, 19 May 2011 08:27:28 +0000 (08:27 +0000)
svn changeset:18906/svn branch:6.6

src/com/vaadin/terminal/gwt/client/ui/VTree.java

index ef08e81e10ee29ac20179787cd7cedf793326919..11db29cbf6b32d47e286120402a399f32f645d48 100644 (file)
@@ -263,7 +263,6 @@ public class VTree extends FocusElementPanel implements Paintable,
         }
 
         body.clear();
-        TreeNode childTree = null;
         for (final Iterator<?> i = uidl.getChildIterator(); i.hasNext();) {
             final UIDL childUidl = (UIDL) i.next();
             if ("actions".equals(childUidl.getTag())) {
@@ -273,7 +272,7 @@ public class VTree extends FocusElementPanel implements Paintable,
                 updateDropHandler(childUidl);
                 continue;
             }
-            childTree = new TreeNode();
+            final TreeNode childTree = new TreeNode();
             if (childTree.ie6compatnode != null) {
                 body.add(childTree);
             }
@@ -281,12 +280,6 @@ public class VTree extends FocusElementPanel implements Paintable,
             if (childTree.ie6compatnode == null) {
                 body.add(childTree);
             }
-            childTree.addStyleDependentName("root");
-            childTree.childNodeContainer.addStyleDependentName("root");
-        }
-        if (childTree != null) {
-            childTree.addStyleDependentName("last");
-            childTree.childNodeContainer.addStyleDependentName("last");
         }
         final String selectMode = uidl.getStringAttribute("selectmode");
         selectable = !"none".equals(selectMode);
@@ -417,8 +410,7 @@ public class VTree extends FocusElementPanel implements Paintable,
                                     VerticalDropLocation curDetail = (VerticalDropLocation) event
                                             .getDropDetails().get("detail");
                                     if (curDetail == detail
-                                            && newKey
-                                                    .equals(currentMouseOverKey)) {
+                                            && newKey.equals(currentMouseOverKey)) {
                                         keyToNode.get(newKey).emphasis(detail);
                                     }
                                     /*
@@ -511,8 +503,8 @@ public class VTree extends FocusElementPanel implements Paintable,
      * Sends the selection to the server
      */
     private void sendSelectionToServer() {
-        client.updateVariable(paintableId, "selected", selectedIds
-                .toArray(new String[selectedIds.size()]), immediate);
+        client.updateVariable(paintableId, "selected",
+                selectedIds.toArray(new String[selectedIds.size()]), immediate);
         selectionHasChanged = false;
     }
 
@@ -760,8 +752,9 @@ public class VTree extends FocusElementPanel implements Paintable,
                     if (selectable) {
                         // caption click = selection change && possible click
                         // event
-                        if (handleClickSelection(event.getCtrlKey()
-                                || event.getMetaKey(), event.getShiftKey())) {
+                        if (handleClickSelection(
+                                event.getCtrlKey() || event.getMetaKey(),
+                                event.getShiftKey())) {
                             event.preventDefault();
                         }
                     } else {
@@ -782,10 +775,10 @@ public class VTree extends FocusElementPanel implements Paintable,
                                 && (type == Event.ONTOUCHSTART || event
                                         .getButton() == NativeEvent.BUTTON_LEFT)) {
                             mouseDownEvent = event; // save event for possible
-                            // dd operation
+                                                    // dd operation
                             if (type == Event.ONMOUSEDOWN) {
                                 event.preventDefault(); // prevent text
-                                // selection
+                                                        // selection
                             } else {
                                 /*
                                  * FIXME We prevent touch start event to be used
@@ -857,11 +850,9 @@ public class VTree extends FocusElementPanel implements Paintable,
                             || !selectable
                             || (!isNullSelectionAllowed && isSelected() && selectedIds
                                     .size() == 1);
-                    client
-                            .updateVariable(paintableId, "clickedKey", key,
-                                    false);
-                    client.updateVariable(paintableId, "clickEvent", details
-                            .toString(), imm);
+                    client.updateVariable(paintableId, "clickedKey", key, false);
+                    client.updateVariable(paintableId, "clickEvent",
+                            details.toString(), imm);
                 }
             };
             if (treeHasFocus) {
@@ -885,7 +876,6 @@ public class VTree extends FocusElementPanel implements Paintable,
         }
 
         protected void constructDom() {
-            addStyleName(CLASSNAME);
             // workaround for a very weird IE6 issue #1245
             if (BrowserInfo.get().isIE6()) {
                 ie6compatnode = DOM.createDiv();
@@ -938,6 +928,7 @@ public class VTree extends FocusElementPanel implements Paintable,
             } else {
                 addStyleName(CLASSNAME + "-leaf");
             }
+            addStyleName(CLASSNAME);
             if (uidl.hasAttribute("style")) {
                 addStyleName(CLASSNAME + "-" + uidl.getStringAttribute("style"));
                 Widget.setStyleName(nodeCaptionDiv, CLASSNAME + "-caption-"
@@ -961,14 +952,14 @@ public class VTree extends FocusElementPanel implements Paintable,
                 if (icon == null) {
                     onloadHandled = false;
                     icon = new Icon(client);
-                    DOM.insertBefore(DOM.getFirstChild(nodeCaptionDiv), icon
-                            .getElement(), nodeCaptionSpan);
+                    DOM.insertBefore(DOM.getFirstChild(nodeCaptionDiv),
+                            icon.getElement(), nodeCaptionSpan);
                 }
                 icon.setUri(uidl.getStringAttribute("icon"));
             } else {
                 if (icon != null) {
-                    DOM.removeChild(DOM.getFirstChild(nodeCaptionDiv), icon
-                            .getElement());
+                    DOM.removeChild(DOM.getFirstChild(nodeCaptionDiv),
+                            icon.getElement());
                     icon = null;
                 }
             }
@@ -1040,11 +1031,6 @@ public class VTree extends FocusElementPanel implements Paintable,
                 if (ie6compatnode == null) {
                     childNodeContainer.add(childTree);
                 }
-                if (!i.hasNext()) {
-                    childTree.addStyleDependentName(childTree.isLeaf()
-                            ? "leaf-last" : "last");
-                    childTree.childNodeContainer.addStyleDependentName("last");
-                }
             }
             childrenLoaded = true;
         }
@@ -1706,8 +1692,9 @@ public class VTree extends FocusElementPanel implements Paintable,
             // keypress event
             keyCode = CHARCODE_SPACE;
         }
-        if (handleKeyNavigation(keyCode, event.isControlKeyDown()
-                || event.isMetaKeyDown(), event.isShiftKeyDown())) {
+        if (handleKeyNavigation(keyCode,
+                event.isControlKeyDown() || event.isMetaKeyDown(),
+                event.isShiftKeyDown())) {
             event.preventDefault();
             event.stopPropagation();
         }
@@ -1721,9 +1708,9 @@ public class VTree extends FocusElementPanel implements Paintable,
      * .event.dom.client.KeyDownEvent)
      */
     public void onKeyDown(KeyDownEvent event) {
-        if (handleKeyNavigation(event.getNativeEvent().getKeyCode(), event
-                .isControlKeyDown()
-                || event.isMetaKeyDown(), event.isShiftKeyDown())) {
+        if (handleKeyNavigation(event.getNativeEvent().getKeyCode(),
+                event.isControlKeyDown() || event.isMetaKeyDown(),
+                event.isShiftKeyDown())) {
             event.preventDefault();
             event.stopPropagation();
         }
@@ -2181,8 +2168,8 @@ public class VTree extends FocusElementPanel implements Paintable,
 
         ArrayList<Integer> positions = new ArrayList<Integer>();
         while (treeNode.getParentNode() != null) {
-            positions.add(0, treeNode.getParentNode().getChildren().indexOf(
-                    treeNode));
+            positions.add(0,
+                    treeNode.getParentNode().getChildren().indexOf(treeNode));
             treeNode = treeNode.getParentNode();
         }
         positions.add(0, getRootNodes().indexOf(treeNode));