Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[nebula-dev] [compositetable] sorting looses row-changes

Hi Dave

I hope that you're back up on your feets!
I just found another arrive/depart related bug and I wanted to discuss the
solution I suggest:

The bug occours when the model gets sorted. I have a snippet
(CompositeTableSnippetDebug changed to native headers) and I could post it
together with a bugzilla entry. Sorting a model does not trigger an
appropriate requestDepartEvent so that changes in a column widget gets
written back to the model before sorting it.
Your sorting code in Snippet5 has a table.refreshAllRows() after executing
Arrays.sort(). I thought firing fireRequestRowChangeEvent() in
refreshTable(). But this does not help as this is too late (topRow does
not reflect the proper state as the model is already sorted). Changes are
written at the wrong model offset.
Another issue here is that currentRow (aka the currently selected row in
the model) does either match the changed model and should be cleared & set
back in user code.
I therefore suggest having a clearSelection()-method in compositeTable and
InternalCompositeTable a user programmer should call before sorting and
setting selection after sorting. My solution looks like that:

snippet5:
private static class Header extends AbstractNativeHeader {
...
protected boolean sortOnColumn(int column, int sortDirection) {
    table.clearSelection();
    ...
    Arrays.sort(swtCommitters, comparator);
    table.refreshAllRows();
    table.setSelection();
}

CompositeTable:
  public void clearSelection() {
    if (contentPane == null) {
      return;
    }
    contentPane.clearSelection();
  }

InternalCompositeTable:
  public void clearSelection() {
    Control toFocus = getControl(currentColumn, currentRow);
    if (fireRequestRowChangeEvent()) {
      if (toFocus != null) {
        toFocus.notifyListeners(SWT.FocusOut, new Event());
      }
    }
  }

For proper bug-handling I could post all this to bugzilla together with my
patch.
I'd love to get your feedback!

Regards
André


> Hi Dave
>
> Wish you good recovery! Have a good rest (we all stressed IT workers
> need it from time to time :-(
>
> Greetings
> André
>
>> Hi Andre
>>
>> Thanks for your concern and thanks for the bug report!
>>
>> Doctor gave antibiotics and said it would be four days before I really
>> start feeling better. :-(
>>
>>
>> Dave
>> ----------------------------------------------------------------------
>>
>> Message: 1
>> Date: Mon, 5 Feb 2007 10:29:15 +0100 (CET)
>> From: " Andr? Dietisheim " <dietisheim@xxxxxxxxx>
>> Subject: Re: [nebula-dev] [compositetable] bug: changes in topRow == 0
>> To: <nebula-dev@xxxxxxxxxxx>
>> Message-ID:
>> <21035.194.150.244.67.1170667755.squirrel@xxxxxxxxxxxxxxxxxxxxx>
>> Content-Type: text/plain; charset=iso-8859-1
>>
>> Hi Dave!
>>
>> hope you're back up on feets again!
>> You're welcome! :-)) I'd really like to use it in my client (I am
>> coding
>>  sort of highly extended database browser for the swiss railways) to
>> replace the current tableViewer so I'll have to code until its bugfree
>> and  has all features I need. But I admit your table is very
>> intersting stuff!
>>
>> I posted the next bug + patch I found when testing on my gtk-box @
>> home. I  hope you don't mind me refactoring a bit, it helped me best
>> to understand  the code and I think its valuable for anybody trying to
>> understand the  code.
>>
>> Greetings
>> Andr�
>>
>>
>>
>>
>>
>
>
> --
> André Dietisheim
> Stv-Bereichsleiter Products
>
> Puzzle ITC GmbH
> Eigerplatz 4
> CH-3007 Bern
> Telefon +41 31 370 22 00
> Mobile  +41 76 423 03 02
> Fax     +41 31 370 22 01
>
> Puzzle ist Mitglied der ODF Alliance:
> <http://www.puzzle.ch/odfalliance/>
>
>
> _______________________________________________
> nebula-dev mailing list
> nebula-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/nebula-dev
>
>
> !DSPAM:45c8a5f6134643936241041!


-- 
André Dietisheim
Stv-Bereichsleiter Products

Puzzle ITC GmbH
Eigerplatz 4
CH-3007 Bern
Telefon +41 31 370 22 00
Mobile  +41 76 423 03 02
Fax     +41 31 370 22 01

Puzzle ist Mitglied der ODF Alliance:
<http://www.puzzle.ch/odfalliance/>




Back to the top