Hi,
I am using this method to have my users filter a list and the filtering is
working beautifully. However, I am running into a usability issue from my
user's point of view. The following contrived example will hopefully
illustrate the problem.
Let's say I have an ObservableElementList of Cars, and an EventTableModel
that displays them. The end goal is that the user will be able to sort the
table by Car Features. So I have a CollectionList that maps Car object to
their Features, and that is wrapped in a UniqueList that I display to the
user for filtering. The user is able to select a Feature from the displayed
UniqueList of Features, and the table of Cars displayed gets filtered
appropriately. Now let's also say that each Car has a Color attribute that
I allow the user to modify, and this Color attribute is completely
independent of Features. So far, so good.
This where the problem comes in. If the user is actively filtering on a
Feature that exists only in a single car, lets call it Car A, and if they
edit the Color of Car A, then the following problem occurs. Since Cars are
observable, the Car ObservableElementList auto-updates, which leads to
listChanged. The CollectionList responds to the listChanged event on its
parent list, but instead of doing an update like the parent list, it does a
remove and then an add of Car A. When this happens, Car A's Features are
temporarily removed and then put back to the Feature list. This in itself
is not a problem because the user cannot see the Features getting removed
and put back, but their selection of Features disappears, which they do
notice. When the selection disappears then of course that filter is removed
and the table of Cars then becomes completely unfiltered.
Am I doing something wrong here? Is there a way to work around this issue?
Thanks up front for any help!
Chad
wsnyder6 wrote:
>
> Yes. I see that it didn't work. But the CollectionList did. Sweet!
>
> Taking this one step further, what if User was a hierarchical object? Is
> it possible to have a JTree (instead of a JList) to hold a User hierarchy
> for filtering?
>
> Hmm, Maybe a 'Category' object would be a better example. So if I clicked
> on 'All Categories' I would see all Issues. If I clicked on Category A, I
> would see Category A and Category B issues, etc...
>
> All Categories
> +--Category A
> +--Category B
> +--Category C
>
> Does GlazedLists have a TreeModel/SelectionListener that would do
> something like this?
>
> Thanks for all your gracious help!
>
> --Bill
>
>
> Jesse Wilson wrote:
>>
>> On 8/15/06, wsnyder6
wsnyder6@... wrote:
>>> I also thought that I could use the TransformedList like such:
>>> class ItemsToLabelsList extends TransformedList {
>>> public IssuesToUsersList(EventList source) {
>>> super(source);
>>> for (Object elem : source) {
>>> addAll( ((Issue)elem).getUsers() );
>>> }
>>> source.addListEventListener(this);
>>> }
>>> public void listChanged(ListEvent listChanges) {
>>> updates.forwardEvent(listChanges);
>>> }
>>> }
>>
>> Unforunately, this won't work since the TransformedList needs
>> to map indices from one list to another. For example, the addAll()
>> method won't work - it will just call through to source.
>>
>> Regardless, CollectionList does what you want. Let us know
>> if you run into further problems!
>>
>> Cheers,
>> Jesse
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail:
users-unsubscribe@...>> For additional commands, e-mail:
users-help@...>>
>>
>>
>
>
--
View this message in context:
http://www.nabble.com/TransformedList-question-tp5818064p24227377.htmlSent from the GlazedLists - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail:
users-unsubscribe@...For additional commands, e-mail:
users-help@...