[JIRA] (GLAZEDLISTS-572) while changing the element value in a group, getting wrong ListEvent and wrong index value of element

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[JIRA] (GLAZEDLISTS-572) while changing the element value in a group, getting wrong ListEvent and wrong index value of element

JIRA jira-no-reply@java.net
deepak_patwal5998 created GLAZEDLISTS-572:
---------------------------------------------

             Summary: while changing the element value in a group, getting wrong ListEvent and wrong index value of element
                 Key: GLAZEDLISTS-572
                 URL: https://java.net/jira/browse/GLAZEDLISTS-572
             Project: glazedlists
          Issue Type: Bug
          Components: swt
    Affects Versions: 1.8.0
         Environment: Solaris
            Reporter: deepak_patwal5998
            Assignee: jessewilson


Hi,

I am using Grouper for managing the groups as applied via filterView.

SortedList has elements and each of which has some attributes which filterView is using for creating the groups accordingly.

Suppose I have 3 elements in sorted list and one of the attribute of element is "State" which has values as "OFF" and ON".

And all the 3 elements have currently value as "OFF".

When I apply a "group by" in a filterview with selected value as "State", then a group with name "OFF(3)" gets created and the 3 elements in the table (org.eclipse.swt.widgets.Table) comes under that group.

usecase 1 : when only 1 group is present - "OFF(3)"

In my code, I am implementing Grouper.Client public void groupChanged(int index, int groupIndex, int groupChangeType, boolean primary, int elementChangeType, E oldValue, E newValue);
now I am changing the value of 1 element from "OFF" to "ON".

Here comes the problem :
As the glazedlist is using 2 pass approach.
In first values are correct for the paramter in groupChanged()

like index=1 groupIndex=0 groupChangeType=2 primary=true elementChangeType=1 oldValue=unknown newValue=(say element1)

and in second pass all the values are index=0 groupIndex=1 groupChangeType=1 primary=false elementChangeType=1 oldValue=unknown newValue=(say element1)


Here, new group "ON(1)" is created as expected.
But the problem is "OFF(3)" still has the same three elements and now in new group "ON(1)" element is inserted whose "STATE" value is changed from "OFF" to "ON".
So, there are 2 groups having the same element, so duplicacy is their, which is wrong, this element should be removed from the first group.

usecase 2 : now two groups are theirafter usecase1.

group 1 "OFF(3)" still has the same three values and group 2 "ON(1)" which has 1 element.
Now I am again changing the value of element 2 in group 1 "OFF(3)" to "ON"
in this case ListEvent is "ListEvent: _+_X"

now values for groupChanged() method are :

index=1 groupIndex=0 groupChangeType=1 primary=true elementChangeType=2 oldValue=(elemet 1) // here old value is the element 1, whose state was changed in usecase1 newValue=(element1) //here new value is the element 1, whose state was changed in usecase1

and in second pass all the values are index=3 groupIndex=1 groupChangeType=1 primary=false elementChangeType=0 oldValue=element 2 newValue=element 2


In this case also, group "ON(1)" has 2 values and group renamed to group "ON(2)", and "OFF(3)" still has the same 3 elements.
Didn't get why everytime unexpected events are coming.
Please do the needful.

Regards,
Deepak Patwal



--
This message was sent by Atlassian JIRA
(v6.2.3#6260)