« Return to Thread: I don't understand how SortedList and TableComparatorChooser work together
James Lemieux wrote:Kevin is correct.
SortedList is a transformation used to create an ordered *view* of any
EventList.
TableComparatorChooser is simply a big fancy way to interpret mouse clicks
on a column header as a change in the Comparator of a SortedList.
If the original question posed in this Thread is essentially "why don't you
just sort data in place, why do you have sorted "views" at all?" that's a
really long winded explanation. Some quick but obvious reasons include:
a) what if I want 2 different sorted views of the same data?
b) what if the original order has special meaning to my app, and shouldn't
be disturbed?
c) how can I return to the original order after it has been disturbed?
etc.
James
On Thu, Apr 30, 2009 at 11:00 AM, Kevin Day <kevin@trumpetinc.com> wrote:
> I'm pretty sure that TableComparitorChooser is actually swapping out the
> comparator on your sorted list.
>
> - K
>
>
> ----------------------- *Original Message* -----------------------
>
> *From:* Boomah <nickdarcy@gmail.com> <nickdarcy@gmail.com>
> *To:* users@glazedlists.dev.java.net
> *Cc:*
> *Date:* Thu, 30 Apr 2009 10:41:56 -0700 (PDT)
> *Subject: I don't understand how SortedList and TableComparatorChooser
> work together*
>
>
> Hi people. I don't understand how SortedList and TableComparatorChooser
> work
> together.
>
> I have objects that get added to a SortedList that represent (via my
> TableFormat) a row in a table. The SortedList uses this object to sort, and
> if I just use a standard JTable, whenever an object is added to my list, it
> gets added to my table in the appropriate position. Everything works
> exactly
> as I would expect.
>
> Now I install a TableComparatorChooser on my JTable. If I start my
> application, I see items being added to the table in the correct position
> given my SortedList as before. However, if I now click on one of the
> columns, it sorts not using my SortedList but by using the objects in the
> column I clicked on. In my case they are all strings and so get sorted
> using
> the standard string comparator.
>
> I don't understand why the TableComparatorChooser requires a SortedList if
> once the user clicks on a column, it gets sorted by th e objects it
> contains.
> Why isn't it possible to use an EventList?
>
> It feels like I'm missing something obvious, but I think that SortedList
> and
> TableComparatorChooser completely work against each other and should be
> separated.
>
> Have I completely missed the point?
>
> Thanks, Nick.
>
>
> --
> View this message in context:
> http://www.nabble.com/I-don%27t-understand-how-SortedList-and-TableComparatorChooser-work-together-tp23321078p23321078.html
> Sent from the GlazedLists - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@glazedlists.dev.java.net
> For additional commands, e-ma il: users-help@glazedlists.dev.java.net
>
>
> --------------------------------------------------------------------- To
> unsubscribe, e-mail: users-unsubscribe@glazedlists.dev.java.net For
> additional commands, e-mail: users-help@glazedlists.dev.java.net
« Return to Thread: I don't understand how SortedList and TableComparatorChooser work together
| Free embeddable forum powered by Nabble | Forum Help |