Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 355352
Collapse All | Expand All

(-)js/org/eclipse/rwt/widgets/Tree.js (-2 / +8 lines)
Lines 29-34 Link Here
29
    this._renderQueue = {};
29
    this._renderQueue = {};
30
    this._resizeLine = null;
30
    this._resizeLine = null;
31
    this._selectionTimestamp = null;
31
    this._selectionTimestamp = null;
32
    this._selectionOffsetX = null;
32
    this._delayedSelection = false;
33
    this._delayedSelection = false;
33
    // Layout:
34
    // Layout:
34
    this._headerHeight = 0;
35
    this._headerHeight = 0;
Lines 856-868 Link Here
856
      var leftClick = event.getButton() === "left";
857
      var leftClick = event.getButton() === "left";
857
      if( leftClick && mousedown && this.isFocusItem( item ) && this._selectionTimestamp != null ) {
858
      if( leftClick && mousedown && this.isFocusItem( item ) && this._selectionTimestamp != null ) {
858
        var stamp = new Date();
859
        var stamp = new Date();
859
        var diff = org.eclipse.swt.EventUtil.DOUBLE_CLICK_TIME;
860
        var offset = event.getPageX();
860
        if( stamp.getTime() - this._selectionTimestamp.getTime() < diff ) {
861
        var timeDiff = org.eclipse.swt.EventUtil.DOUBLE_CLICK_TIME;
862
        var offsetDiff = 8;
863
        if (    stamp.getTime() - this._selectionTimestamp.getTime() < timeDiff 
864
             && Math.abs( this._selectionOffsetX - offset ) < offsetDiff ) 
865
        {
861
          result = true;
866
          result = true;
862
        }
867
        }
863
      }
868
      }
864
      if( mousedown && leftClick && !result ) {
869
      if( mousedown && leftClick && !result ) {
865
        this._selectionTimestamp = new Date();
870
        this._selectionTimestamp = new Date();
871
        this._selectionOffsetX = event.getPageX();
866
      } else if( mousedown ) {
872
      } else if( mousedown ) {
867
        this._selectionTimestamp = null;
873
        this._selectionTimestamp = null;
868
      }
874
      }
(-)js/org/eclipse/rwt/test/fixture/TestUtil.js (-7 / +7 lines)
Lines 153-163 Link Here
153
      return result;       
153
      return result;       
154
    },
154
    },
155
    
155
    
156
    clickDOM : function( node ) {
156
    clickDOM : function( node, left, top ) {
157
      var left = qx.event.type.MouseEvent.buttons.left;
157
      var button = qx.event.type.MouseEvent.buttons.left;
158
      this.fakeMouseEventDOM( node, "mousedown", left );
158
      this.fakeMouseEventDOM( node, "mousedown", button, left, top );
159
      this.fakeMouseEventDOM( node, "mouseup", left );
159
      this.fakeMouseEventDOM( node, "mouseup", button, left, top );
160
      this.fakeMouseEventDOM( node, "click", left );
160
      this.fakeMouseEventDOM( node, "click", button, left, top );
161
    },
161
    },
162
      
162
      
163
    shiftClickDOM : function( node ) {
163
    shiftClickDOM : function( node ) {
Lines 479-486 Link Here
479
    /////////////////////////////
479
    /////////////////////////////
480
    // Event handling - Qooxdoo
480
    // Event handling - Qooxdoo
481
481
482
    click : function( widget ) {
482
    click : function( widget, left, top ) {
483
      this.clickDOM( widget._getTargetNode() );      
483
      this.clickDOM( widget._getTargetNode(), left, top );      
484
    },
484
    },
485
    
485
    
486
    doubleClick : function( widget ) {
486
    doubleClick : function( widget ) {
(-)js/org/eclipse/rwt/test/tests/TreeTest.js (-5 / +35 lines)
Lines 3062-3068 Link Here
3062
      tree.destroy();    
3062
      tree.destroy();    
3063
    },
3063
    },
3064
    
3064
    
3065
    testNoDoubleClickDetection : function() {
3065
    testNoDoubleClickOnDifferentItems : function() {
3066
      var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
3066
      var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
3067
      var wm = org.eclipse.swt.WidgetManager.getInstance();
3067
      var wm = org.eclipse.swt.WidgetManager.getInstance();
3068
      var tree = this._createDefaultTree();
3068
      var tree = this._createDefaultTree();
Lines 3075-3082 Link Here
3075
      wm.add( child1, "w3", false );
3075
      wm.add( child1, "w3", false );
3076
      testUtil.flush();
3076
      testUtil.flush();
3077
      testUtil.initRequestLog();
3077
      testUtil.initRequestLog();
3078
      testUtil.click( tree._rowContainer._children[ 0 ] );
3078
3079
      testUtil.click( tree._rowContainer._children[ 1 ] );
3079
      testUtil.click( tree._rowContainer._children[ 0 ], 10, 10 );
3080
      testUtil.click( tree._rowContainer._children[ 1 ], 20, 20 );
3081
3080
      assertEquals( 2, testUtil.getRequestsSend() );
3082
      assertEquals( 2, testUtil.getRequestsSend() );
3081
      var log = testUtil.getRequestLog();
3083
      var log = testUtil.getRequestLog();
3082
      var expected = "org.eclipse.swt.events.widgetSelected";
3084
      var expected = "org.eclipse.swt.events.widgetSelected";
Lines 3087-3093 Link Here
3087
      assertTrue( log[ 1 ].indexOf( expected ) != -1 );            
3089
      assertTrue( log[ 1 ].indexOf( expected ) != -1 );            
3088
      tree.destroy();
3090
      tree.destroy();
3089
    },
3091
    },
3090
    
3092
3093
    testNoDoubleClickOnSameItem : function() {
3094
      var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
3095
      var wm = org.eclipse.swt.WidgetManager.getInstance();
3096
      var tree = this._createDefaultTree();
3097
      tree.setHasSelectionListeners( true );
3098
      tree.setItemCount( 2 );
3099
      var child0 = new org.eclipse.rwt.widgets.TreeItem( tree.getRootItem(), 0 );
3100
      var child1 = new org.eclipse.rwt.widgets.TreeItem( tree.getRootItem(), 1 );
3101
      wm.add( tree, "w1", true );
3102
      wm.add( child0, "w2", false );
3103
      wm.add( child1, "w3", false );
3104
      testUtil.flush();
3105
      testUtil.initRequestLog();
3106
3107
      testUtil.click( tree._rowContainer._children[ 0 ], 10, 10 );
3108
      testUtil.click( tree._rowContainer._children[ 0 ], 20, 10 );
3109
3110
      assertEquals( 2, testUtil.getRequestsSend() );
3111
      var log = testUtil.getRequestLog();
3112
      var expected = "org.eclipse.swt.events.widgetSelected";
3113
      var notExpected = "org.eclipse.swt.events.widgetDefaultSelected";
3114
      assertTrue( log[ 0 ].indexOf( notExpected ) == -1 );            
3115
      assertTrue( log[ 1 ].indexOf( notExpected ) == -1 );            
3116
      assertTrue( log[ 0 ].indexOf( expected ) != -1 );            
3117
      assertTrue( log[ 1 ].indexOf( expected ) != -1 );            
3118
      tree.destroy();
3119
    },
3120
3091
    testNoDefaultSelectionWithCtrlSpace : function() {
3121
    testNoDefaultSelectionWithCtrlSpace : function() {
3092
      var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
3122
      var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
3093
      var wm = org.eclipse.swt.WidgetManager.getInstance();
3123
      var wm = org.eclipse.swt.WidgetManager.getInstance();
Lines 3110-3116 Link Here
3110
      assertTrue( log.join().indexOf( notExpected ) == -1 );            
3140
      assertTrue( log.join().indexOf( notExpected ) == -1 );            
3111
      tree.destroy();
3141
      tree.destroy();
3112
    },
3142
    },
3113
    
3143
3114
    testKeyEventBeforeFlush : function() {
3144
    testKeyEventBeforeFlush : function() {
3115
      var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
3145
      var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
3116
      var wm = org.eclipse.swt.WidgetManager.getInstance();
3146
      var wm = org.eclipse.swt.WidgetManager.getInstance();

Return to bug 355352