After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 109402 - Wrong object for object:state-changed:expanded event for tree items in java apps
Wrong object for object:state-changed:expanded event for tree items in java apps
Status: RESOLVED NOTGNOME
Product: at-spi
Classification: Platform
Component: javabridge
unspecified
Other Linux
: Normal normal
: ---
Assigned To: padraig.obriain
padraig.obriain
: 119852 (view as bug list)
Depends on:
Blocks: 109272
 
 
Reported: 2003-03-28 12:31 UTC by remus draica
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: 2.3/2.4



Description remus draica 2003-03-28 12:31:31 UTC
When using a java app and a tree node expands or collapses no
"object:state-changed:expanded" is emitted.

Steps to reproduce:
1. start SwingSet
2. open JTree demo page (last button from toolbar).
3. expand or collapse nodes from tree on opened page.
Comment 1 Darren Kenny 2003-03-31 10:53:23 UTC
Contrary to the comments above, the state changed events
are being emitted - though incorrectly.

Java emits a state-changed:collapsed when the tree is
expanded, and a state-changed:expanded when collapsed!

Though, this is not how GTK+ is behaving (even when I switch
the events). GTK+ is sending an:

state-changed:expanded with a detail1 set to 1 or 0 depending on
whether the tree is expanded or collapsed, respectively. I think
this is incorrect behaviour too, since there is the presence
of the COLLAPSED state, GTK+ should also send a notification
for this and that's what Gnopernicus should be relying on.

Comment 2 padraig.obriain 2003-03-31 11:52:16 UTC
The state ATK_STATE_COLLAPSED was removed from atk on 2001/11/20.
Comment 3 bill.haneman 2003-03-31 11:59:47 UTC
yes, the correct states of interest are ATK_STATE_EXPANDABLE and
ATK_STATE_EXPANDED.

at-spi has the corresponding states SPI_STATE_EXPANDABLE and
SPI_STATE_EXPANDED.
Comment 4 Darren Kenny 2003-03-31 12:07:51 UTC
So the correct behaviour is to send:

    object:state-changed:expanded 1

when the tree is expanded, and 

    object:state-changed:expanded 0 

when it's collapsed, is that correct?

Comment 5 padraig.obriain 2003-03-31 12:20:39 UTC
I believe so.
Comment 6 remus draica 2003-03-31 12:32:21 UTC
Yes, events are emitted, but for tree, not for node which is 
expanded or collapsed.
If user expands a node using arrows key, then event can be asociated 
with for focused object. But if user expands a node using mouse 
(pressing the sign which shows node state) then no chance to 
identify which node changes it state.

In my opinion, these events should be emitted for node which change 
it state.

Also emitting state-changed:collapsed and state-changed:expanded are 
redundant. A event like state-changed:expanded should be emitted 
when state is changing from expanded to collapsed or form collapsed 
to expanded, the event details should show the current state (1 if 
is expanded or 0 if it is not). In this scenarios, when a node 
becames EXPANDED are emitted events:
  - state-changed:expanded 	detail1=1
  - state-changed:collapsed 	detail1=0
When a node becames COLLAPSED are emitted events:
  - state-changed:expanded 	detail1=0
  - state-changed:collapsed 	detail1=1
So, emitting both events are redundant.

An event like state-changed:XXXX should be emitted when the object 
state XXXX is changing. I mean changed from contained in object 
state in not contained in object state or from contained to not 
contained. The event detail1 parameter should show the direction of 
this change.

Behaviour described above is the one observed by me. If it is not 
right, please correct me.

Comment 7 bill.haneman 2003-03-31 12:40:35 UTC
we don't (or shouldn't) emit 'collapsed' anymore, just 'expanded'
since as Adi says they are redundant.
I agree that it seems as though the expanded/collapsed node should
emit the state.  However, this can conflict with the
MANAGES_DESCENDANTS state; treeview cells are normally TRANSIENT
aren't they, and thus don't emit events?

Perhaps we should indeed make exception for transience in such cases,
so that the node/cell that expanded can be identified in the case of
GtkTreeView.
Comment 8 Darren Kenny 2003-03-31 13:07:29 UTC
It seem that the oldValue was being used in preference to the 
newValue, hence the mixup of COLLAPSED being sent in the case of
an expansion and vice versa - this I can fix in the bridge.

In Java though, the state-changed event is emitted by the TREE - not
the NODE - this is a problem in that there is no way to know which
of the NODEs has expanded/collapsed.

I think that if we're to allow MANAGES_DESCENDENTS objects to have
children have focus events fired, certain states (like EXPANDED)
should be able to be emitted too - the question is where to draw
the line. The problem is that you don't "need" to have focus on the
parent of the sub-tree to expand/collapse the sub-tree.



Comment 9 Darren Kenny 2003-03-31 14:20:29 UTC
Hmm, checking out the 1.4.2 pre-release builds, it seems that the
correct node is being sent in the state-changed:expanded events
now... Still a problem in all currently public Java releases though.

But, the parent seems to be the node itself, not the tree - ie.
for these type of events the parent is the object itself, ie
it's cyclic - I've logged a bug against the Java implementation for
JTree.

Comment 10 korn 2003-03-31 15:32:07 UTC
In Swing JTree, the nodes aren't TRANSIENT.  This is a potential 
problem if/when the TreeModel is generating something very large (e.g. 
your hard drive, or Internet nodes).  But as they aren't TRANSIENT at 
present, the nodes should emit the state change events.
Comment 11 Darren Kenny 2003-04-25 09:53:43 UTC
Remus,

Can you please verify that this is fixed in the latest build
of GNOME 2.2, with a JDK version of 1.4.1 or higher.

Comment 12 Darren Kenny 2003-05-01 10:31:25 UTC
Remus,

Can you please verify this fix?

Thanks,

Darren.
Comment 13 remus draica 2003-07-03 09:41:47 UTC
Now, expanded event is sent by parent.

To get the child who generated this event should I call
AccessibleChildChangedEvent_getChildAccessible?

I called it, but allway a NULL pointer is obtained.

Can somebody check this?
Thanks.
Comment 14 padraig.obriain 2003-07-03 16:13:43 UTC
I believe that the problem is that the object returned in
state-changed:expanded event is the JTree. If I understand Darren
correctly this is fixed in jdk 1.4.2. The Sun bugtraq bug is 4839971.

For GTK apps the object returned in the state-changed:expanded event
is the cell which was expanded or collapsed.



Comment 15 Calum Benson 2003-08-07 16:17:32 UTC
Apologies for spam... marking as GNOMEVER2.3 so it appears on the official GNOME
bug list :)
Comment 16 padraig.obriain 2003-08-18 13:41:50 UTC
*** Bug 119852 has been marked as a duplicate of this bug. ***
Comment 17 padraig.obriain 2004-03-25 10:37:49 UTC
I am closing this bug as NOTGNOME.

I have confirmed that the problem is fixed in java version "1.4.2_04".