|
Lines 135-140
Link Here
|
| 135 |
var widgetManager = org.eclipse.swt.WidgetManager.getInstance(); |
135 |
var widgetManager = org.eclipse.swt.WidgetManager.getInstance(); |
| 136 |
widgetManager.add( this._clientArea, id + "_clientArea", false ); |
136 |
widgetManager.add( this._clientArea, id + "_clientArea", false ); |
| 137 |
this.add( this._clientArea ); |
137 |
this.add( this._clientArea ); |
|
|
138 |
// Cell tooltip |
| 139 |
this._cellToolTip = null; |
| 140 |
if( qx.lang.String.contains( style, "enableCellToolTip" ) ) { |
| 141 |
this._cellToolTip = new org.eclipse.swt.widgets.TableCellToolTip(); |
| 142 |
this._cellToolTip.setTableId( id ); |
| 143 |
this._clientArea.addEventListener( "mousemove", this._onClientAreaMouseMove, this ); |
| 144 |
this._clientArea.setToolTip( this._cellToolTip ); |
| 145 |
} |
| 138 |
}, |
146 |
}, |
| 139 |
|
147 |
|
| 140 |
destruct : function() { |
148 |
destruct : function() { |
|
Lines 183-192
Link Here
|
| 183 |
if( this._clientArea ) { |
191 |
if( this._clientArea ) { |
| 184 |
this._clientArea.removeEventListener( "mousewheel", this._onClientAreaMouseWheel, this ); |
192 |
this._clientArea.removeEventListener( "mousewheel", this._onClientAreaMouseWheel, this ); |
| 185 |
this._clientArea.removeEventListener( "appear", this._onClientAppear, this ); |
193 |
this._clientArea.removeEventListener( "appear", this._onClientAppear, this ); |
|
|
194 |
if( this._cellToolTip ) { |
| 195 |
this._clientArea.removeEventListener( "mousemove", this._onClientAreaMouseMove, this ); |
| 196 |
} |
| 186 |
org.eclipse.swt.WidgetManager.getInstance().remove( this._clientArea ); |
197 |
org.eclipse.swt.WidgetManager.getInstance().remove( this._clientArea ); |
| 187 |
this._clientArea.dispose(); |
198 |
this._clientArea.dispose(); |
| 188 |
this._clientArea = null; |
199 |
this._clientArea = null; |
| 189 |
} |
200 |
} |
|
|
201 |
if( this._cellToolTip ) { |
| 202 |
this._cellToolTip.dispose(); |
| 203 |
this._cellToolTip = null; |
| 204 |
} |
| 190 |
if( this._columnArea ) { |
205 |
if( this._columnArea ) { |
| 191 |
this._columnArea.dispose(); |
206 |
this._columnArea.dispose(); |
| 192 |
this._columnArea = null; |
207 |
this._columnArea = null; |
|
Lines 528-534
Link Here
|
| 528 |
_onRowClick : function( evt ) { |
543 |
_onRowClick : function( evt ) { |
| 529 |
this._rowClicked( evt, evt.getTarget() ); |
544 |
this._rowClicked( evt, evt.getTarget() ); |
| 530 |
}, |
545 |
}, |
| 531 |
|
546 |
|
| 532 |
_rowClicked : function( evt, row ) { |
547 |
_rowClicked : function( evt, row ) { |
| 533 |
var itemIndex = this._topIndex + this._rows.indexOf( row ); |
548 |
var itemIndex = this._topIndex + this._rows.indexOf( row ); |
| 534 |
if( itemIndex >= 0 |
549 |
if( itemIndex >= 0 |
|
Lines 704-710
Link Here
|
| 704 |
// regardless which modifier-key(s) are held down |
719 |
// regardless which modifier-key(s) are held down |
| 705 |
var itemDefaultSelected = -1; |
720 |
var itemDefaultSelected = -1; |
| 706 |
var topSelectedItem = -1; |
721 |
var topSelectedItem = -1; |
| 707 |
for( var i = 0; i < this._selected.length; i++ ) { |
722 |
for( var i = 0; i < this._selected.length; i++ ) { |
| 708 |
if( this._focusIndex === this._selected[ i ] ) { |
723 |
if( this._focusIndex === this._selected[ i ] ) { |
| 709 |
itemDefaultSelected = this._selected[ i ]; |
724 |
itemDefaultSelected = this._selected[ i ]; |
| 710 |
} |
725 |
} |
|
Lines 716-722
Link Here
|
| 716 |
} |
731 |
} |
| 717 |
if( itemDefaultSelected === -1 ) { |
732 |
if( itemDefaultSelected === -1 ) { |
| 718 |
itemDefaultSelected = topSelectedItem; |
733 |
itemDefaultSelected = topSelectedItem; |
| 719 |
} |
734 |
} |
| 720 |
this.createDispatchDataEvent( "itemdefaultselected", |
735 |
this.createDispatchDataEvent( "itemdefaultselected", |
| 721 |
itemDefaultSelected ); |
736 |
itemDefaultSelected ); |
| 722 |
break; |
737 |
break; |
|
Lines 898-904
Link Here
|
| 898 |
this._deselectItem( this._selected[ 0 ], true ); |
913 |
this._deselectItem( this._selected[ 0 ], true ); |
| 899 |
} |
914 |
} |
| 900 |
}, |
915 |
}, |
| 901 |
|
916 |
|
| 902 |
_adjustSelectedIndices : function( itemIndex ) { |
917 |
_adjustSelectedIndices : function( itemIndex ) { |
| 903 |
if( this._isItemSelected( itemIndex ) ) { |
918 |
if( this._isItemSelected( itemIndex ) ) { |
| 904 |
for( var i = 0; i < this._selected.length; i++ ) { |
919 |
for( var i = 0; i < this._selected.length; i++ ) { |
|
Lines 1281-1287
Link Here
|
| 1281 |
} |
1296 |
} |
| 1282 |
} |
1297 |
} |
| 1283 |
}, |
1298 |
}, |
| 1284 |
|
1299 |
|
| 1285 |
_resolveItem : function( itemIndex ) { |
1300 |
_resolveItem : function( itemIndex ) { |
| 1286 |
if( !org_eclipse_rap_rwt_EventUtil_suspend ) { |
1301 |
if( !org_eclipse_rap_rwt_EventUtil_suspend ) { |
| 1287 |
if( this._unresolvedItems === null ) { |
1302 |
if( this._unresolvedItems === null ) { |
|
Lines 1366-1379
Link Here
|
| 1366 |
line.setStyleProperty( "visibility", "hidden" ); |
1381 |
line.setStyleProperty( "visibility", "hidden" ); |
| 1367 |
} |
1382 |
} |
| 1368 |
}, |
1383 |
}, |
| 1369 |
|
1384 |
|
| 1370 |
_onGridLinesMouseDown : function( evt ) { |
1385 |
_onGridLinesMouseDown : function( evt ) { |
| 1371 |
var row = this._getRowAtPoint( evt.getPageX(), evt.getPageY() ); |
1386 |
var row = this._getRowAtPoint( evt.getPageX(), evt.getPageY() ); |
| 1372 |
if( row != null ) { |
1387 |
if( row != null ) { |
| 1373 |
this._rowClicked( evt, row ); |
1388 |
this._rowClicked( evt, row ); |
| 1374 |
} |
1389 |
} |
| 1375 |
}, |
1390 |
}, |
| 1376 |
|
1391 |
|
| 1377 |
_getRowAtPoint : function( pageX, pageY ) { |
1392 |
_getRowAtPoint : function( pageX, pageY ) { |
| 1378 |
var result = null; |
1393 |
var result = null; |
| 1379 |
for( var i = 0; result === null && i < this._rows.length; i++ ) { |
1394 |
for( var i = 0; result === null && i < this._rows.length; i++ ) { |
|
Lines 1381-1389
Link Here
|
| 1381 |
var element = row.getElement(); |
1396 |
var element = row.getElement(); |
| 1382 |
var pageLeft = qx.html.Location.getPageBoxLeft( element ); |
1397 |
var pageLeft = qx.html.Location.getPageBoxLeft( element ); |
| 1383 |
var pageTop = qx.html.Location.getPageBoxTop( element ); |
1398 |
var pageTop = qx.html.Location.getPageBoxTop( element ); |
| 1384 |
if( pageX >= pageLeft |
1399 |
if( pageX >= pageLeft |
| 1385 |
&& pageX < pageLeft + row.getWidth() |
1400 |
&& pageX < pageLeft + row.getWidth() |
| 1386 |
&& pageY >= pageTop |
1401 |
&& pageY >= pageTop |
| 1387 |
&& pageY < pageTop + row.getHeight() ) |
1402 |
&& pageY < pageTop + row.getHeight() ) |
| 1388 |
{ |
1403 |
{ |
| 1389 |
result = row; |
1404 |
result = row; |
|
Lines 1391-1397
Link Here
|
| 1391 |
} |
1406 |
} |
| 1392 |
return result; |
1407 |
return result; |
| 1393 |
}, |
1408 |
}, |
| 1394 |
|
1409 |
|
| 1395 |
////////////////////////////////////////////////////////// |
1410 |
////////////////////////////////////////////////////////// |
| 1396 |
// Focus tracking - may change appearance of selected row |
1411 |
// Focus tracking - may change appearance of selected row |
| 1397 |
|
1412 |
|
|
Lines 1402-1408
Link Here
|
| 1402 |
_onFocusOut : function( evt ) { |
1417 |
_onFocusOut : function( evt ) { |
| 1403 |
this._updateFocusState() |
1418 |
this._updateFocusState() |
| 1404 |
}, |
1419 |
}, |
| 1405 |
|
1420 |
|
| 1406 |
//////////////////////////////////////////////////////////// |
1421 |
//////////////////////////////////////////////////////////// |
| 1407 |
// Event handling methods - added and removed by server-side |
1422 |
// Event handling methods - added and removed by server-side |
| 1408 |
|
1423 |
|
|
Lines 1452-1458
Link Here
|
| 1452 |
this._leftOffsetChanged = false; |
1467 |
this._leftOffsetChanged = false; |
| 1453 |
} |
1468 |
} |
| 1454 |
} |
1469 |
} |
|
|
1470 |
}, |
| 1471 |
|
| 1472 |
//////////////////////// |
| 1473 |
// Cell tooltip handling |
| 1474 |
|
| 1475 |
_onClientAreaMouseMove : function( evt ) { |
| 1476 |
if( this._cellToolTip != null ) { |
| 1477 |
var pageX = evt.getPageX(); |
| 1478 |
var pageY = evt.getPageY(); |
| 1479 |
var row = this._getRowAtPoint( pageX, pageY ); |
| 1480 |
var rowIndex = this._rows.indexOf( row ); |
| 1481 |
var itemIndex = this._getItemIndexFromRowIndex( rowIndex ); |
| 1482 |
var columnIndex = -1; |
| 1483 |
var columns = this.getColumns(); |
| 1484 |
for( var i = 0; columnIndex == -1 && i < columns.length; i++ ) { |
| 1485 |
var element = columns[ i ].getElement(); |
| 1486 |
var pageLeft = qx.html.Location.getPageBoxLeft( element ); |
| 1487 |
if( pageX >= pageLeft |
| 1488 |
&& pageX < pageLeft + columns[ i ].getWidth() ) |
| 1489 |
{ |
| 1490 |
columnIndex = i; |
| 1491 |
} |
| 1492 |
} |
| 1493 |
this._cellToolTip.setCell( itemIndex, columnIndex ); |
| 1494 |
} |
| 1495 |
}, |
| 1496 |
|
| 1497 |
/** Only called by server-side */ |
| 1498 |
setCellToolTipText : function( text ) { |
| 1499 |
if( this._cellToolTip != null ) { |
| 1500 |
this._cellToolTip.setText( text ); |
| 1501 |
} |
| 1455 |
} |
1502 |
} |
| 1456 |
|
1503 |
|
| 1457 |
} |
1504 |
} |
| 1458 |
}); |
1505 |
}); |