Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 195971 Details for
Bug 346222
[Table] Selection does not shift after adding items
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Proposed patch
Bug-346222.patch (text/plain), 3.09 KB, created by
Ivan Furnadjiev
on 2011-05-18 09:19:53 EDT
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Ivan Furnadjiev
Created:
2011-05-18 09:19:53 EDT
Size:
3.09 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.rap.rwt.q07 >Index: js/org/eclipse/swt/widgets/Table.js >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.rwt/org.eclipse.rap.rwt.q07/js/org/eclipse/swt/widgets/Table.js,v >retrieving revision 1.93 >diff -u -r1.93 Table.js >--- js/org/eclipse/swt/widgets/Table.js 17 May 2011 15:46:20 -0000 1.93 >+++ js/org/eclipse/swt/widgets/Table.js 18 May 2011 13:10:07 -0000 >@@ -1059,6 +1059,7 @@ > } else { > this._items[ index ] = item; > } >+ this._adjustSelectedIndices( index, true ); > this._updateScrollHeight(); > }, > >@@ -1070,7 +1071,7 @@ > } > // Order is crucial here: first deselect item then adjust indices > this._deselectItem( itemIndex, false ); >- this._adjustSelectedIndices( itemIndex ); >+ this._adjustSelectedIndices( itemIndex, false ); > this._updateScrollHeight(); > }, > >@@ -1105,11 +1106,17 @@ > } > }, > >- _adjustSelectedIndices : function( itemIndex ) { >+ _adjustSelectedIndices : function( itemIndex, increment ) { > for( var i = 0; i < this._selected.length; i++ ) { > var index = this._selected[ i ]; >- if( itemIndex < index ) { >- this._selected[ i ] = index - 1; >+ if( increment ) { >+ if( itemIndex <= index ) { >+ this._selected[ i ] = index + 1; >+ } >+ } else { >+ if( itemIndex < index ) { >+ this._selected[ i ] = index - 1; >+ } > } > } > }, >#P org.eclipse.rap.rwt.q07.jstest >Index: js/org/eclipse/rwt/test/tests/TableTest.js >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.rwt.test/org.eclipse.rap.rwt.q07.jstest/js/org/eclipse/rwt/test/tests/TableTest.js,v >retrieving revision 1.7 >diff -u -r1.7 TableTest.js >--- js/org/eclipse/rwt/test/tests/TableTest.js 17 May 2011 15:46:19 -0000 1.7 >+++ js/org/eclipse/rwt/test/tests/TableTest.js 18 May 2011 13:10:08 -0000 >@@ -175,6 +175,35 @@ > table.destroy(); > }, > >+ testAdjustSelectedIndicesAfterAddingAnItem : function() { >+ var testUtil = org.eclipse.rwt.test.fixture.TestUtil; >+ var table = this._createDefaultTable(); >+ for( var i = 0; i < 5; i++ ) { >+ new org.eclipse.swt.widgets.TableItem( table, i ); >+ } >+ table.selectItem( 1 ); >+ table.selectItem( 2 ); >+ table.selectItem( 4 ); >+ new org.eclipse.swt.widgets.TableItem( table, 2 ); >+ assertEquals( [ 1, 3, 5 ], table._selected ); >+ table.destroy(); >+ }, >+ >+ testAdjustSelectedIndicesAfterRemovingAnItem : function() { >+ var testUtil = org.eclipse.rwt.test.fixture.TestUtil; >+ var table = this._createDefaultTable(); >+ var items = []; >+ for( var i = 0; i < 5; i++ ) { >+ items[ i ] = new org.eclipse.swt.widgets.TableItem( table, i ); >+ } >+ table.selectItem( 1 ); >+ table.selectItem( 2 ); >+ table.selectItem( 4 ); >+ items[ 1 ].dispose(); >+ assertEquals( [ 1, 3 ], table._selected ); >+ table.destroy(); >+ }, >+ > ///////// > // Helper >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
tbuschto
:
review+
tbuschto
:
review+
Actions:
View
|
Diff
Attachments on
bug 346222
: 195971