|
View:
New views
13 Messages
—
Rating Filter:
Alert me
|
|
|
Fix for IndexOutOfBoundsException and wrong selection in SWT tablesHi
I just found out what is causing the IndexOutOfBoundsException and wrong selection I reported here http://www.nabble.com/IndexOutOfBoundsException-in-ThreadProxyEventList-tf4256276.html#a12739728 and here http://www.nabble.com/Wrong-selection-in-EventTableViewer--tf4198547.html#a12856240 The solution is in fact here: https://glazedlists.dev.java.net/issues/show_bug.cgi?id=413. Using getTopIndex() in EventTableViewer.VirtualTableHandler.handleEvent(..) seems to be wrong. If you replace getTopIndex() with event.index everything works perfectly. You do not have to drop support for SWT pre-3.2 where event.index is not available, cause it's also possible to use table.indexOf(item) (though I don't know how fast this is). greetings fabian |
|
|
Re: Fix for IndexOutOfBoundsException and wrong selection in SWT tablesMaybe this applies to these issues too?
https://glazedlists.dev.java.net/issues/show_bug.cgi?id=249 https://glazedlists.dev.java.net/issues/show_bug.cgi?id=247 fabian
|
|
|
Re: Fix for IndexOutOfBoundsException and wrong selection in SWT tablesIn a very old version of EventTableViewer
https://glazedlists.dev.java.net/source/browse/glazedlists/source/ca/odell/glazedlists/swt/EventTableViewer.java?hideattic=0&rev=1.30&view=markup table.indexOf(item) was used in the virtaul table handler, but caused some problems at that time. So it was changed in the next revision to use table.getTopIndex() and some index calculation: https://glazedlists.dev.java.net/source/browse/glazedlists/source/ca/odell/glazedlists/swt/EventTableViewer.java?hideattic=0&rev=1.31&view=markup It could be that recent SWT versions fixed these issues and now report the correct index in the event. We could do something like this in method handleEvent: ... int index; // I think there is a method like this somewhere: int swtVersion = SWT.getVersion(); if (swtVersion < 3200) // for old SWT versions < 3.2 use our current solution index = table.getTopIndex(); else // for SWT versions >= 3.2 use the index of the event index = e.index int whiteIndex = requested.getWhiteIndex(index, false); index = requested.getIndex(whiteIndex, Barcode.WHITE); .... James, Jesse, should we give it a try? Holger > > > Hi > > I just found out what is causing the IndexOutOfBoundsException and wrong > selection I reported here > http://www.nabble.com/IndexOutOfBoundsException-in-ThreadProxyEventList-tf4256276.html#a12739728 > and here > http://www.nabble.com/Wrong-selection-in-EventTableViewer--tf4198547.html#a12856240 > > The solution is in fact here: > https://glazedlists.dev.java.net/issues/show_bug.cgi?id=413. > Using getTopIndex() in EventTableViewer.VirtualTableHandler.handleEvent(..) > seems to be wrong. > If you replace getTopIndex() with event.index everything works perfectly. > You do not have to drop support for SWT pre-3.2 where event.index is not > available, cause it's also possible to use table.indexOf(item) (though I > don't know how fast this is). > > greetings > fabian > > -- > View this message in context: http://www.nabble.com/Fix-for-IndexOutOfBoundsException-and-wrong-selection-in-SWT-tables-tf4692918.html#a13413659 > Sent from the GlazedLists - Dev mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscribe@... > For additional commands, e-mail: dev-help@... > > _________________________________________________________________________ In 5 Schritten zur eigenen Homepage. Jetzt Domain sichern und gestalten! Nur 3,99 EUR/Monat! http://www.maildomain.web.de/?mc=021114 --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@... For additional commands, e-mail: dev-help@... |
|
|
Re: Fix for IndexOutOfBoundsException and wrong selection in SWT tablesVersion specific code <grabs stomach and moans weakly in agony>. If there is no other way, I guess we'll need to...
Version-specific test cases should be created I guess... partially to help document *why* we had to do it this way... James On 10/26/07, Holger Brands <hbrands@...> wrote: In a very old version of EventTableViewer |
|
|
Re: Fix for IndexOutOfBoundsException and wrong selection in SWT tablesI tested the issue under win32 and linux/gtk now, with SWT versions 3.3, 3.2.2, 3.1.2, 3.0.2, so every latest bugfix-release.
getTopIndex() indexOf(TableItem) win32/3.0.2 works works win32/3.1.2 works works win32/3.2.2 works works win32/3.3 works works linux/3.0.2 doesn't work works linux/3.1.2 doesn't work works linux/3.2.2 doesn't work works linux/3.3 doesn't work works So if there have been troubles with indexOf I guess they've been fixed. Do you know whether it was really indexOf that caused the problems, because in https://glazedlists.dev.java.net/issues/show_bug.cgi?id=197 the barcode was introduced to setData too. In this SWT-bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=146799 somebody says that using getTopIndex is always a bad idea, cause SetData events can also occur for non-visible items. Here are some considerations about indexOf - speed: https://bugs.eclipse.org/bugs/show_bug.cgi?id=129703 fabian
|
|
|
Re: Fix for IndexOutOfBoundsException and wrong selection in SWT tablesThanks for the info, Fabian.
So we could do something like this in handleEvent: ... // First try index from event int index = e.index; if (index == -1) { // if not set because of older SWT version, get index from table index = table.indexOf(item); } int whiteIndex = requested.getWhiteIndex(index, false); index = requested.getIndex(whiteIndex, Barcode.WHITE); ... But I guess we should add more tests over time. In particular, did you test sorting and filtering/unfiltering with this change, too? If you have some unit tests to share, let us know. Thanks, Holger > > > I tested the issue under win32 and linux/gtk now, with SWT versions 3.3, > 3.2.2, 3.1.2, 3.0.2, so every latest bugfix-release. > > getTopIndex() indexOf(TableItem) > win32/3.0.2 works works > win32/3.1.2 works works > win32/3.2.2 works works > win32/3.3 works works > linux/3.0.2 doesn't work works > linux/3.1.2 doesn't work works > linux/3.2.2 doesn't work works > linux/3.3 doesn't work works > > So if there have been troubles with indexOf I guess they've been fixed. Do > you know whether it was really indexOf that caused the problems, because in > https://glazedlists.dev.java.net/issues/show_bug.cgi?id=197 the barcode was > introduced to setData too. > > In this SWT-bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=146799 > somebody says that using getTopIndex is always a bad idea, cause SetData > events can also occur for non-visible items. > > Here are some considerations about indexOf - speed: > https://bugs.eclipse.org/bugs/show_bug.cgi?id=129703 > > fabian > > > James Lemieux wrote: > > > > Version specific code <grabs stomach and moans weakly in agony>. If there > > is > > no other way, I guess we'll need to... > > > > Version-specific test cases should be created I guess... partially to help > > document *why* we had to do it this way... > > > > James > > > > On 10/26/07, Holger Brands <hbrands@...> wrote: > >> > >> In a very old version of EventTableViewer > >> > >> https://glazedlists.dev.java.net/source/browse/glazedlists/source/ca/odell/glazedlists/swt/EventTableViewer.java?hideattic=0&rev=1.30&view=markup > >> table.indexOf(item) was used in the virtaul table handler, > >> but caused some problems at that time. > >> So it was changed in the next revision to > >> use table.getTopIndex() and some index calculation: > >> > >> https://glazedlists.dev.java.net/source/browse/glazedlists/source/ca/odell/glazedlists/swt/EventTableViewer.java?hideattic=0&rev=1.31&view=markup > >> > >> It could be that recent SWT versions fixed these issues and now report > >> the correct index in the event. > >> > >> We could do something like this in method handleEvent: > >> ... > >> int index; > >> // I think there is a method like this somewhere: > >> int swtVersion = SWT.getVersion(); > >> if (swtVersion < 3200) > >> // for old SWT versions < 3.2 use our current solution > >> index = table.getTopIndex(); > >> else > >> // for SWT versions >= 3.2 use the index of the event > >> index = e.index > >> int whiteIndex = requested.getWhiteIndex(index, false); > >> index = requested.getIndex(whiteIndex, Barcode.WHITE); > >> .... > >> > >> > >> James, Jesse, should we give it a try? > >> > >> Holger > >> > >> > > >> > > >> > Hi > >> > > >> > I just found out what is causing the IndexOutOfBoundsException and > >> wrong > >> > selection I reported here > >> > > >> http://www.nabble.com/IndexOutOfBoundsException-in-ThreadProxyEventList-tf4256276.html#a12739728 > >> > and here > >> > > >> http://www.nabble.com/Wrong-selection-in-EventTableViewer--tf4198547.html#a12856240 > >> > > >> > The solution is in fact here: > >> > https://glazedlists.dev.java.net/issues/show_bug.cgi?id=413. > >> > Using getTopIndex() in EventTableViewer.VirtualTableHandler.handleEvent > >> (..) > >> > seems to be wrong. > >> > If you replace getTopIndex() with event.index everything works > >> perfectly. > >> > You do not have to drop support for SWT pre-3.2 where event.index is > >> not > >> > available, cause it's also possible to use table.indexOf(item) (though > >> I > >> > don't know how fast this is). > >> > > >> > greetings > >> > fabian > >> > > >> > -- > >> > View this message in context: > >> http://www.nabble.com/Fix-for-IndexOutOfBoundsException-and-wrong-selection-in-SWT-tables-tf4692918.html#a13413659 > >> > Sent from the GlazedLists - Dev mailing list archive at Nabble.com. > >> > > >> > --------------------------------------------------------------------- > >> > To unsubscribe, e-mail: dev-unsubscribe@... > >> > For additional commands, e-mail: dev-help@... > >> > > >> > > >> > >> > >> _________________________________________________________________________ > >> In 5 Schritten zur eigenen Homepage. Jetzt Domain sichern und gestalten! > >> Nur 3,99 EUR/Monat! http://www.maildomain.web.de/?mc=021114 > >> > >> --------------------------------------------------------------------- > >> To unsubscribe, e-mail: dev-unsubscribe@... > >> For additional commands, e-mail: dev-help@... > >> > >> > > > > > > -- > View this message in context: http://www.nabble.com/Fix-for-IndexOutOfBoundsException-and-wrong-selection-in-SWT-tables-tf4692918.html#a13440978 > Sent from the GlazedLists - Dev mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscribe@... > For additional commands, e-mail: dev-help@... > > _____________________________________________________________________ Der WEB.DE SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! http://smartsurfer.web.de/?mc=100071&distributionid=000000000066 --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@... For additional commands, e-mail: dev-help@... |
|
|
Re: Fix for IndexOutOfBoundsException and wrong selection in SWT tablesAccessing e.index when it doesn't exist throws a NoSuchFieldError-Exception. I just tested in my application and the crashes are gone. Textfiltering, Matcher-Filtering, Selection etc. works fine without any crashes. I don't have any unit tests, sorry. I have never used JUnit etc. so far. fabian > > > I tested the issue under win32 and linux/gtk now, with SWT versions 3.3, > 3.2.2, 3.1.2, 3.0.2, so every latest bugfix-release. > > getTopIndex() indexOf(TableItem) > win32/3.0.2 works works > win32/3.1.2 works works > win32/3.2.2 works works > win32/3.3 works works > linux/3.0.2 doesn't work works > linux/3.1.2 doesn't work works > linux/3.2.2 doesn't work works > linux/3.3 doesn't work works > > So if there have been troubles with indexOf I guess they've been fixed. Do > you know whether it was really indexOf that caused the problems, because in > https://glazedlists.dev.java.net/issues/show_bug.cgi?id=197 the barcode was > introduced to setData too. > > In this SWT-bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=146799 > somebody says that using getTopIndex is always a bad idea, cause SetData > events can also occur for non-visible items. > > Here are some considerations about indexOf - speed: > https://bugs.eclipse.org/bugs/show_bug.cgi?id=129703 > > fabian > > > James Lemieux wrote: > > > > Version specific code <grabs stomach and moans weakly in agony>. If there > > is > > no other way, I guess we'll need to... > > > > Version-specific test cases should be created I guess... partially to help > > document *why* we had to do it this way... > > > > James > > > > On 10/26/07, Holger Brands <hbrands@web.de> wrote: > >> > >> In a very old version of EventTableViewer > >> > >> https://glazedlists.dev.java.net/source/browse/glazedlists/source/ca/odell/glazedlists/swt/EventTableViewer.java?hideattic=0&rev=1.30&view=markup > >> table.indexOf(item) was used in the virtaul table handler, > >> but caused some problems at that time. > >> So it was changed in the next revision to > >> use table.getTopIndex() and some index calculation: > >> > >> https://glazedlists.dev.java.net/source/browse/glazedlists/source/ca/odell/glazedlists/swt/EventTableViewer.java?hideattic=0&rev=1.31&view=markup > >> > >> It could be that recent SWT versions fixed these issues and now report > >> the correct index in the event. > >> > >> We could do something like this in method handleEvent: > >> ... > >> int index; > >> // I think there is a method like this somewhere: > >> int swtVersion = SWT.getVersion(); > >> if (swtVersion < 3200) > >> // for old SWT versions < 3.2 use our current solution > >> index = table.getTopIndex(); > >> else > >> // for SWT versions >= 3.2 use the index of the event > >> index = e.index > >> int whiteIndex = requested.getWhiteIndex(index, false); > >> index = requested.getIndex(whiteIndex, Barcode.WHITE); > >> .... > >> > >> > >> James, Jesse, should we give it a try? > >> > >> Holger > >> > >> > > >> > > >> > Hi > >> > > >> > I just found out what is causing the IndexOutOfBoundsException and > >> wrong > >> > selection I reported here > >> > > >> http://www.nabble.com/IndexOutOfBoundsException-in-ThreadProxyEventList-tf4256276.html#a12739728 > >> > and here > >> > > >> http://www.nabble.com/Wrong-selection-in-EventTableViewer--tf4198547.html#a12856240 > >> > > >> > The solution is in fact here: > >> > https://glazedlists.dev.java.net/issues/show_bug.cgi?id=413. > >> > Using getTopIndex() in EventTableViewer.VirtualTableHandler.handleEvent > >> (..) > >> > seems to be wrong. > >> > If you replace getTopIndex() with event.index everything works > >> perfectly. > >> > You do not have to drop support for SWT pre-3.2 where event.index is > >> not > >> > available, cause it's also possible to use table.indexOf(item) (though > >> I > >> > don't know how fast this is). > >> > > >> > greetings > >> > fabian > >> > > >> > -- > >> > View this message in context: > >> http://www.nabble.com/Fix-for-IndexOutOfBoundsException-and-wrong-selection-in-SWT-tables-tf4692918.html#a13413659 > >> > Sent from the GlazedLists - Dev mailing list archive at Nabble.com. > >> > > >> > --------------------------------------------------------------------- > >> > To unsubscribe, e-mail: dev-unsubscribe@glazedlists.dev.java.net > >> > For additional commands, e-mail: dev-help@glazedlists.dev.java.net > >> > > >> > > >> > >> > >> _________________________________________________________________________ > >> In 5 Schritten zur eigenen Homepage. Jetzt Domain sichern und gestalten! > >> Nur 3,99 EUR/Monat! http://www.maildomain.web.de/?mc=021114 > >> > >> --------------------------------------------------------------------- > >> To unsubscribe, e-mail: dev-unsubscribe@glazedlists.dev.java.net > >> For additional commands, e-mail: dev-help@glazedlists.dev.java.net > >> > >> > > > > > > -- > View this message in context: http://www.nabble.com/Fix-for-IndexOutOfBoundsException-and-wrong-selection-in-SWT-tables-tf4692918.html#a13440978 > Sent from the GlazedLists - Dev mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscribe@glazedlists.dev.java.net > For additional commands, e-mail: dev-help@glazedlists.dev.java.net > > _____________________________________________________________________ Der WEB.DE SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! http://smartsurfer.web.de/?mc=100071&distributionid=000000000066 --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@glazedlists.dev.java.net For additional commands, e-mail: dev-help@glazedlists.dev.java.net |
|
|
Re: Fix for IndexOutOfBoundsException and wrong selection in SWT tables>
> Accessing e.index when it doesn't exist throws a NoSuchFieldError-Exception. > > You're right. The index field doesn't *exist* in the Event class prior to SWT 3.2, I assumed the field existed but wasn't *filled* with a meaningful value. Holger _______________________________________________________________________ Jetzt neu! Schützen Sie Ihren PC mit McAfee und WEB.DE. 3 Monate kostenlos testen. http://www.pc-sicherheit.web.de/startseite/?mc=022220 --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@... For additional commands, e-mail: dev-help@... |
|
|
Re: Fix for IndexOutOfBoundsException and wrong selection in SWT tablesHi,
will this be integrated in cvs? fabian
|
|
|
Re: Fix for IndexOutOfBoundsException and wrong selection in SWT tablesI intend to do so, but I didn't have time to write tests for it, yet.
Maybe we should include it in the latest build and users could try with their real world apps... Holger > > > Hi, > > will this be integrated in cvs? > > fabian > > > fab|an wrote: > > > > Hi > > > > I just found out what is causing the IndexOutOfBoundsException and wrong > > selection I reported here > > http://www.nabble.com/IndexOutOfBoundsException-in-ThreadProxyEventList-tf4256276.html#a12739728 > > and here > > http://www.nabble.com/Wrong-selection-in-EventTableViewer--tf4198547.html#a12856240 > > > > The solution is in fact here: > > https://glazedlists.dev.java.net/issues/show_bug.cgi?id=413. > > Using getTopIndex() in > > EventTableViewer.VirtualTableHandler.handleEvent(..) seems to be wrong. > > If you replace getTopIndex() with event.index everything works perfectly. > > You do not have to drop support for SWT pre-3.2 where event.index is not > > available, cause it's also possible to use table.indexOf(item) (though I > > don't know how fast this is). > > > > greetings > > fabian > > > > > > -- > View this message in context: http://www.nabble.com/Fix-for-IndexOutOfBoundsException-and-wrong-selection-in-SWT-tables-tf4692918.html#a14149418 > Sent from the GlazedLists - Dev mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscribe@... > For additional commands, e-mail: dev-help@... > > _____________________________________________________________________ Der WEB.DE SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! http://smartsurfer.web.de/?mc=100071&distributionid=000000000066 --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@... For additional commands, e-mail: dev-help@... |
|
|
Re: Fix for IndexOutOfBoundsException and wrong selection in SWT tablesHi again,
I just wanted to say that I use my patch now in Windows and Linux real world application and had no problems so far... greetings fabian
|
|
|
|
|
|
Re: Fix for IndexOutOfBoundsException and wrong selection in SWT tablesThank you.
The old problem I reported seems to be fixed, I never got the problem again. fabian
|
| Free embeddable forum powered by Nabble | Forum Help |