You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pivot.apache.org by "laurent Gebus (JIRA)" <ji...@apache.org> on 2011/03/18 18:12:29 UTC

[jira] Created: (PIVOT-718) TreeViewSelectionListener not invoked

TreeViewSelectionListener not invoked
-------------------------------------

                 Key: PIVOT-718
                 URL: https://issues.apache.org/jira/browse/PIVOT-718
             Project: Pivot
          Issue Type: Bug
          Components: wtk
    Affects Versions: 2.0
         Environment: jkd1.6,linux
            Reporter: laurent Gebus
             Fix For: 2.0.1


I have a TreeView with a TreeViewSelectionListener, but the listener doesn't get invoked when a item is removed from the tree.
I do : tree.getTreeData().remove( tree.getSelectedNode());
tree is refreshed : the removed node is no longer shown, no node is selected but the listener is not invoked. 
Looked at the code :
in TreeView#itemsRemoved(), clearAndDecrementPaths() is invoked and returns 0. But Listeners are only invoked when > 0 is returned. 
see attached example comparing a TreeView to a ListView

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] Updated: (PIVOT-718) TreeViewSelectionListener not invoked

Posted by "Sandro Martini (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/PIVOT-718?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sandro Martini updated PIVOT-718:
---------------------------------

    Assignee: Sandro Martini
    Priority: Minor  (was: Major)

> TreeViewSelectionListener not invoked
> -------------------------------------
>
>                 Key: PIVOT-718
>                 URL: https://issues.apache.org/jira/browse/PIVOT-718
>             Project: Pivot
>          Issue Type: Bug
>          Components: wtk
>    Affects Versions: 2.0
>         Environment: jkd1.6,linux
>            Reporter: laurent Gebus
>            Assignee: Sandro Martini
>            Priority: Minor
>             Fix For: 2.0.1
>
>         Attachments: TreeSelect.bxml, TreeSelect.java
>
>
> I have a TreeView with a TreeViewSelectionListener, but the listener doesn't get invoked when a item is removed from the tree.
> I do : tree.getTreeData().remove( tree.getSelectedNode());
> tree is refreshed : the removed node is no longer shown, no node is selected but the listener is not invoked. 
> Looked at the code :
> in TreeView#itemsRemoved(), clearAndDecrementPaths() is invoked and returns 0. But Listeners are only invoked when > 0 is returned. 
> see attached example comparing a TreeView to a ListView

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (PIVOT-718) TreeViewSelectionListener not invoked

Posted by "Chris Bartlett (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PIVOT-718?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13040215#comment-13040215 ] 

Chris Bartlett commented on PIVOT-718:
--------------------------------------

Sandro,

I am having a look at 718 & 734 now as well as other open tickets.
If I come up with anything and have time to implement fixes I will assign them to myself.

Chris

> TreeViewSelectionListener not invoked
> -------------------------------------
>
>                 Key: PIVOT-718
>                 URL: https://issues.apache.org/jira/browse/PIVOT-718
>             Project: Pivot
>          Issue Type: Bug
>          Components: wtk
>    Affects Versions: 2.0
>         Environment: jkd1.6,linux
>            Reporter: laurent Gebus
>            Priority: Minor
>             Fix For: 2.1
>
>         Attachments: TreeSelect.bxml, TreeSelect.java
>
>
> I have a TreeView with a TreeViewSelectionListener, but the listener doesn't get invoked when a item is removed from the tree.
> I do : tree.getTreeData().remove( tree.getSelectedNode());
> tree is refreshed : the removed node is no longer shown, no node is selected but the listener is not invoked. 
> Looked at the code :
> in TreeView#itemsRemoved(), clearAndDecrementPaths() is invoked and returns 0. But Listeners are only invoked when > 0 is returned. 
> see attached example comparing a TreeView to a ListView

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] Commented: (PIVOT-718) TreeViewSelectionListener not invoked

Posted by "Sandro Martini (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PIVOT-718?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13008667#comment-13008667 ] 

Sandro Martini commented on PIVOT-718:
--------------------------------------

Hi Laurent, thank you very much for the test case, but I'm sorry I have to ask you another small thing:
can you re-attach both files granting the usage in ASF work (or by Apache constraints we aren't able to use them) ?

I have already started to look at it, and seems a simple thing to fix :-) .

I wait your re-attach of files (and probably should be better to delete currently attached files, to avoid confusion).

Thank you again,
Sandro


> TreeViewSelectionListener not invoked
> -------------------------------------
>
>                 Key: PIVOT-718
>                 URL: https://issues.apache.org/jira/browse/PIVOT-718
>             Project: Pivot
>          Issue Type: Bug
>          Components: wtk
>    Affects Versions: 2.0
>         Environment: jkd1.6,linux
>            Reporter: laurent Gebus
>             Fix For: 2.0.1
>
>         Attachments: TreeSelect.bxml, TreeSelect.java
>
>
> I have a TreeView with a TreeViewSelectionListener, but the listener doesn't get invoked when a item is removed from the tree.
> I do : tree.getTreeData().remove( tree.getSelectedNode());
> tree is refreshed : the removed node is no longer shown, no node is selected but the listener is not invoked. 
> Looked at the code :
> in TreeView#itemsRemoved(), clearAndDecrementPaths() is invoked and returns 0. But Listeners are only invoked when > 0 is returned. 
> see attached example comparing a TreeView to a ListView

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (PIVOT-718) TreeViewSelectionListener not invoked

Posted by "Sandro Martini (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PIVOT-718?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13040229#comment-13040229 ] 

Sandro Martini commented on PIVOT-718:
--------------------------------------

Ok all your help is welcome, and don't worry, reassign them to you if you think to work on them, I'm not jealous :-) .

Bye


> TreeViewSelectionListener not invoked
> -------------------------------------
>
>                 Key: PIVOT-718
>                 URL: https://issues.apache.org/jira/browse/PIVOT-718
>             Project: Pivot
>          Issue Type: Bug
>          Components: wtk
>    Affects Versions: 2.0
>         Environment: jkd1.6,linux
>            Reporter: laurent Gebus
>            Priority: Minor
>             Fix For: 2.1
>
>         Attachments: TreeSelect.bxml, TreeSelect.java
>
>
> I have a TreeView with a TreeViewSelectionListener, but the listener doesn't get invoked when a item is removed from the tree.
> I do : tree.getTreeData().remove( tree.getSelectedNode());
> tree is refreshed : the removed node is no longer shown, no node is selected but the listener is not invoked. 
> Looked at the code :
> in TreeView#itemsRemoved(), clearAndDecrementPaths() is invoked and returns 0. But Listeners are only invoked when > 0 is returned. 
> see attached example comparing a TreeView to a ListView

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] Updated: (PIVOT-718) TreeViewSelectionListener not invoked

Posted by "laurent Gebus (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/PIVOT-718?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

laurent Gebus updated PIVOT-718:
--------------------------------

    Attachment:     (was: TreeSelect.java)

> TreeViewSelectionListener not invoked
> -------------------------------------
>
>                 Key: PIVOT-718
>                 URL: https://issues.apache.org/jira/browse/PIVOT-718
>             Project: Pivot
>          Issue Type: Bug
>          Components: wtk
>    Affects Versions: 2.0
>         Environment: jkd1.6,linux
>            Reporter: laurent Gebus
>            Assignee: Sandro Martini
>            Priority: Minor
>             Fix For: 2.0.1
>
>         Attachments: TreeSelect.bxml, TreeSelect.java
>
>
> I have a TreeView with a TreeViewSelectionListener, but the listener doesn't get invoked when a item is removed from the tree.
> I do : tree.getTreeData().remove( tree.getSelectedNode());
> tree is refreshed : the removed node is no longer shown, no node is selected but the listener is not invoked. 
> Looked at the code :
> in TreeView#itemsRemoved(), clearAndDecrementPaths() is invoked and returns 0. But Listeners are only invoked when > 0 is returned. 
> see attached example comparing a TreeView to a ListView

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (PIVOT-718) TreeViewSelectionListener not invoked

Posted by "Sandro Martini (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PIVOT-718?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13027508#comment-13027508 ] 

Sandro Martini commented on PIVOT-718:
--------------------------------------

Hi and sorry for the delay ... I've started to look at the problem: 
it seems that any time I try to delete a Tree node that's not in the first level, something wrong happens and the node (or the leaf) is not deleted.
For example, running the Pivot718.java (derived from this test) if I delete a first level Node like "Activity", or "Occasion" all is Ok, but trying to delete a child element (could be a child of "Occasion", like the Node "Holidays", or a leaf one level under like "Independence Day") the element is not deleted.

I've seen that the indexOf() in TreeBranch, doesn't compare the nodes on the same level of the element selected for deletion (it loops only on first level nodes), so in this case it's not found and not deleted.

At this point I'm not sure that this is the cause of the problem seen by Laurent ... or if it is another.
Comments ?


> TreeViewSelectionListener not invoked
> -------------------------------------
>
>                 Key: PIVOT-718
>                 URL: https://issues.apache.org/jira/browse/PIVOT-718
>             Project: Pivot
>          Issue Type: Bug
>          Components: wtk
>    Affects Versions: 2.0
>         Environment: jkd1.6,linux
>            Reporter: laurent Gebus
>            Assignee: Sandro Martini
>            Priority: Minor
>             Fix For: 2.0.1
>
>         Attachments: TreeSelect.bxml, TreeSelect.java
>
>
> I have a TreeView with a TreeViewSelectionListener, but the listener doesn't get invoked when a item is removed from the tree.
> I do : tree.getTreeData().remove( tree.getSelectedNode());
> tree is refreshed : the removed node is no longer shown, no node is selected but the listener is not invoked. 
> Looked at the code :
> in TreeView#itemsRemoved(), clearAndDecrementPaths() is invoked and returns 0. But Listeners are only invoked when > 0 is returned. 
> see attached example comparing a TreeView to a ListView

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (PIVOT-718) TreeViewSelectionListener not invoked

Posted by "Raffaele Borrelli (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PIVOT-718?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13028081#comment-13028081 ] 

Raffaele Borrelli commented on PIVOT-718:
-----------------------------------------

Sandro,
I know nothing of the internal implementation of a Tree in pivot, but in a recent topic we found a problem when updating a tree when there was no TreeComparator, maybe it might help you to see if the two problems are correlated.
This is the reference:
http://apache-pivot-users.399431.n3.nabble.com/TreeNodeEditor-issue-td2815778.html

> TreeViewSelectionListener not invoked
> -------------------------------------
>
>                 Key: PIVOT-718
>                 URL: https://issues.apache.org/jira/browse/PIVOT-718
>             Project: Pivot
>          Issue Type: Bug
>          Components: wtk
>    Affects Versions: 2.0
>         Environment: jkd1.6,linux
>            Reporter: laurent Gebus
>            Assignee: Sandro Martini
>            Priority: Minor
>             Fix For: 2.0.1
>
>         Attachments: TreeSelect.bxml, TreeSelect.java
>
>
> I have a TreeView with a TreeViewSelectionListener, but the listener doesn't get invoked when a item is removed from the tree.
> I do : tree.getTreeData().remove( tree.getSelectedNode());
> tree is refreshed : the removed node is no longer shown, no node is selected but the listener is not invoked. 
> Looked at the code :
> in TreeView#itemsRemoved(), clearAndDecrementPaths() is invoked and returns 0. But Listeners are only invoked when > 0 is returned. 
> see attached example comparing a TreeView to a ListView

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (PIVOT-718) TreeViewSelectionListener not invoked

Posted by "Sandro Martini (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PIVOT-718?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13031619#comment-13031619 ] 

Sandro Martini commented on PIVOT-718:
--------------------------------------

Waiting for some feedback from Chris (and maybe others) ...

Note that some test could even be done from the Test application Pivot734, some info here:
https://issues.apache.org/jira/browse/PIVOT-734
both on the add to a Tree, and the remove.


> TreeViewSelectionListener not invoked
> -------------------------------------
>
>                 Key: PIVOT-718
>                 URL: https://issues.apache.org/jira/browse/PIVOT-718
>             Project: Pivot
>          Issue Type: Bug
>          Components: wtk
>    Affects Versions: 2.0
>         Environment: jkd1.6,linux
>            Reporter: laurent Gebus
>            Assignee: Sandro Martini
>            Priority: Minor
>             Fix For: 2.0.1
>
>         Attachments: TreeSelect.bxml, TreeSelect.java
>
>
> I have a TreeView with a TreeViewSelectionListener, but the listener doesn't get invoked when a item is removed from the tree.
> I do : tree.getTreeData().remove( tree.getSelectedNode());
> tree is refreshed : the removed node is no longer shown, no node is selected but the listener is not invoked. 
> Looked at the code :
> in TreeView#itemsRemoved(), clearAndDecrementPaths() is invoked and returns 0. But Listeners are only invoked when > 0 is returned. 
> see attached example comparing a TreeView to a ListView

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (PIVOT-718) TreeViewSelectionListener not invoked

Posted by "Sandro Martini (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PIVOT-718?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13009061#comment-13009061 ] 

Sandro Martini commented on PIVOT-718:
--------------------------------------

Hi Laurent, thank you very much, tomorrow I'll try and say something.


> TreeViewSelectionListener not invoked
> -------------------------------------
>
>                 Key: PIVOT-718
>                 URL: https://issues.apache.org/jira/browse/PIVOT-718
>             Project: Pivot
>          Issue Type: Bug
>          Components: wtk
>    Affects Versions: 2.0
>         Environment: jkd1.6,linux
>            Reporter: laurent Gebus
>            Assignee: Sandro Martini
>            Priority: Minor
>             Fix For: 2.0.1
>
>         Attachments: TreeSelect.bxml, TreeSelect.java
>
>
> I have a TreeView with a TreeViewSelectionListener, but the listener doesn't get invoked when a item is removed from the tree.
> I do : tree.getTreeData().remove( tree.getSelectedNode());
> tree is refreshed : the removed node is no longer shown, no node is selected but the listener is not invoked. 
> Looked at the code :
> in TreeView#itemsRemoved(), clearAndDecrementPaths() is invoked and returns 0. But Listeners are only invoked when > 0 is returned. 
> see attached example comparing a TreeView to a ListView

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] Updated: (PIVOT-718) TreeViewSelectionListener not invoked

Posted by "laurent Gebus (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/PIVOT-718?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

laurent Gebus updated PIVOT-718:
--------------------------------

    Attachment: TreeSelect.java

replaces previously uploaded file (didn't find out how to remove the old one)

> TreeViewSelectionListener not invoked
> -------------------------------------
>
>                 Key: PIVOT-718
>                 URL: https://issues.apache.org/jira/browse/PIVOT-718
>             Project: Pivot
>          Issue Type: Bug
>          Components: wtk
>    Affects Versions: 2.0
>         Environment: jkd1.6,linux
>            Reporter: laurent Gebus
>            Assignee: Sandro Martini
>            Priority: Minor
>             Fix For: 2.0.1
>
>         Attachments: TreeSelect.bxml, TreeSelect.bxml, TreeSelect.java, TreeSelect.java
>
>
> I have a TreeView with a TreeViewSelectionListener, but the listener doesn't get invoked when a item is removed from the tree.
> I do : tree.getTreeData().remove( tree.getSelectedNode());
> tree is refreshed : the removed node is no longer shown, no node is selected but the listener is not invoked. 
> Looked at the code :
> in TreeView#itemsRemoved(), clearAndDecrementPaths() is invoked and returns 0. But Listeners are only invoked when > 0 is returned. 
> see attached example comparing a TreeView to a ListView

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] Updated: (PIVOT-718) TreeViewSelectionListener not invoked

Posted by "laurent Gebus (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/PIVOT-718?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

laurent Gebus updated PIVOT-718:
--------------------------------

    Attachment:     (was: TreeSelect.bxml)

> TreeViewSelectionListener not invoked
> -------------------------------------
>
>                 Key: PIVOT-718
>                 URL: https://issues.apache.org/jira/browse/PIVOT-718
>             Project: Pivot
>          Issue Type: Bug
>          Components: wtk
>    Affects Versions: 2.0
>         Environment: jkd1.6,linux
>            Reporter: laurent Gebus
>            Assignee: Sandro Martini
>            Priority: Minor
>             Fix For: 2.0.1
>
>         Attachments: TreeSelect.bxml, TreeSelect.java
>
>
> I have a TreeView with a TreeViewSelectionListener, but the listener doesn't get invoked when a item is removed from the tree.
> I do : tree.getTreeData().remove( tree.getSelectedNode());
> tree is refreshed : the removed node is no longer shown, no node is selected but the listener is not invoked. 
> Looked at the code :
> in TreeView#itemsRemoved(), clearAndDecrementPaths() is invoked and returns 0. But Listeners are only invoked when > 0 is returned. 
> see attached example comparing a TreeView to a ListView

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (PIVOT-718) TreeViewSelectionListener not invoked

Posted by "Sandro Martini (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/PIVOT-718?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sandro Martini updated PIVOT-718:
---------------------------------

    Fix Version/s:     (was: 2.0.1)
                   2.1
         Assignee:     (was: Sandro Martini)

Needs further investigation

> TreeViewSelectionListener not invoked
> -------------------------------------
>
>                 Key: PIVOT-718
>                 URL: https://issues.apache.org/jira/browse/PIVOT-718
>             Project: Pivot
>          Issue Type: Bug
>          Components: wtk
>    Affects Versions: 2.0
>         Environment: jkd1.6,linux
>            Reporter: laurent Gebus
>            Priority: Minor
>             Fix For: 2.1
>
>         Attachments: TreeSelect.bxml, TreeSelect.java
>
>
> I have a TreeView with a TreeViewSelectionListener, but the listener doesn't get invoked when a item is removed from the tree.
> I do : tree.getTreeData().remove( tree.getSelectedNode());
> tree is refreshed : the removed node is no longer shown, no node is selected but the listener is not invoked. 
> Looked at the code :
> in TreeView#itemsRemoved(), clearAndDecrementPaths() is invoked and returns 0. But Listeners are only invoked when > 0 is returned. 
> see attached example comparing a TreeView to a ListView

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (PIVOT-718) TreeViewSelectionListener not invoked

Posted by "Raffaele Borrelli (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PIVOT-718?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13028082#comment-13028082 ] 

Raffaele Borrelli commented on PIVOT-718:
-----------------------------------------

Sandro,
I know nothing of the internal implementation of a Tree in pivot, but in a recent topic we found a problem when updating a tree when there was no TreeComparator, maybe it might help you to see if the two problems are correlated.
This is the reference:
http://apache-pivot-users.399431.n3.nabble.com/TreeNodeEditor-issue-td2815778.html

> TreeViewSelectionListener not invoked
> -------------------------------------
>
>                 Key: PIVOT-718
>                 URL: https://issues.apache.org/jira/browse/PIVOT-718
>             Project: Pivot
>          Issue Type: Bug
>          Components: wtk
>    Affects Versions: 2.0
>         Environment: jkd1.6,linux
>            Reporter: laurent Gebus
>            Assignee: Sandro Martini
>            Priority: Minor
>             Fix For: 2.0.1
>
>         Attachments: TreeSelect.bxml, TreeSelect.java
>
>
> I have a TreeView with a TreeViewSelectionListener, but the listener doesn't get invoked when a item is removed from the tree.
> I do : tree.getTreeData().remove( tree.getSelectedNode());
> tree is refreshed : the removed node is no longer shown, no node is selected but the listener is not invoked. 
> Looked at the code :
> in TreeView#itemsRemoved(), clearAndDecrementPaths() is invoked and returns 0. But Listeners are only invoked when > 0 is returned. 
> see attached example comparing a TreeView to a ListView

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (PIVOT-718) TreeViewSelectionListener not invoked

Posted by "Sandro Martini (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PIVOT-718?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13040207#comment-13040207 ] 

Sandro Martini commented on PIVOT-718:
--------------------------------------

Hi Chris,
thanks for the useful info.

I've found some strange things in Pivot Trees (but could be my little knowledge on them), like:
- removing an element that's some levels under
- adding elements (sometimes) after the tree has been fully loaded
for example you can see them running the Pivot734.java class.

All those things needs more time to investigate/etc, this is the reason I moved the ticket the 2.1 release.

Bye


> TreeViewSelectionListener not invoked
> -------------------------------------
>
>                 Key: PIVOT-718
>                 URL: https://issues.apache.org/jira/browse/PIVOT-718
>             Project: Pivot
>          Issue Type: Bug
>          Components: wtk
>    Affects Versions: 2.0
>         Environment: jkd1.6,linux
>            Reporter: laurent Gebus
>            Priority: Minor
>             Fix For: 2.1
>
>         Attachments: TreeSelect.bxml, TreeSelect.java
>
>
> I have a TreeView with a TreeViewSelectionListener, but the listener doesn't get invoked when a item is removed from the tree.
> I do : tree.getTreeData().remove( tree.getSelectedNode());
> tree is refreshed : the removed node is no longer shown, no node is selected but the listener is not invoked. 
> Looked at the code :
> in TreeView#itemsRemoved(), clearAndDecrementPaths() is invoked and returns 0. But Listeners are only invoked when > 0 is returned. 
> see attached example comparing a TreeView to a ListView

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (PIVOT-718) TreeViewSelectionListener not invoked

Posted by "Chris Bartlett (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PIVOT-718?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13040186#comment-13040186 ] 

Chris Bartlett commented on PIVOT-718:
--------------------------------------

Before going any further I will try to clarify what appears to be a misunderstanding of the data structure that backs a TreeView.

org.apache.pivot.wtk.TreeView will display any kind of object as a 'leaf', but it will only display objects as 'branches' if they implement org.apache.pivot.collections.List.

The following 2 classes are provided with Pivot for use with TreeViews, but custom implementations can also be used.
org.apache.pivot.wtk.content.TreeNode (leaf)
org.apache.pivot.wtk.content.TreeBranch (will be considered a branch as it implements List<TreeNode>)

Note that the remove(T) and indexOf(T) methods mentioned in earlier comments are defined in org.apache.pivot.collections.Sequence<T> which TreeBranch implements via List<T>.


A typical TreeView data structure will consist of a single TreeBranch (or any other instance of an org.apache.pivot.collections.List) which in turn will contain 0 or more TreeNodes or TreeBranches.  Each List (TreeBranch) will be displayed as a 'branch', while other objects (TreeNode) will be displayed as 'leaves'.  

In order to remove an item from a TreeView, you must determine which List (TreeBranch) it belongs to before calling the List#remove(T item) method.
The attached example code appears to expect any selected node to be removed by calling 
tree.getTreeData().remove(tree.getSelectedNode());
However this will only work if the selected node exists in the root List (TreeBranch) used to back the TreeView.


The following code snippet should work for any selected TreeNode or TreeBranch, but assumes that the TreeView will only ever contain TreeNode or TreeBranch objects (or subtypes)

// Get the selected node
TreeNode selectedNode = (TreeNode) treeView.getSelectedNode();
if (selectedNode != null) {
  // Get the parent List of the selected node
  org.apache.pivot.collections.List parent = selectedNode.getParent();
  if (parent != null) {
      // Remove the selected node from its parent
      parent.remove(selectedNode);
  }
}


> TreeViewSelectionListener not invoked
> -------------------------------------
>
>                 Key: PIVOT-718
>                 URL: https://issues.apache.org/jira/browse/PIVOT-718
>             Project: Pivot
>          Issue Type: Bug
>          Components: wtk
>    Affects Versions: 2.0
>         Environment: jkd1.6,linux
>            Reporter: laurent Gebus
>            Priority: Minor
>             Fix For: 2.1
>
>         Attachments: TreeSelect.bxml, TreeSelect.java
>
>
> I have a TreeView with a TreeViewSelectionListener, but the listener doesn't get invoked when a item is removed from the tree.
> I do : tree.getTreeData().remove( tree.getSelectedNode());
> tree is refreshed : the removed node is no longer shown, no node is selected but the listener is not invoked. 
> Looked at the code :
> in TreeView#itemsRemoved(), clearAndDecrementPaths() is invoked and returns 0. But Listeners are only invoked when > 0 is returned. 
> see attached example comparing a TreeView to a ListView

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] Updated: (PIVOT-718) TreeViewSelectionListener not invoked

Posted by "laurent Gebus (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/PIVOT-718?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

laurent Gebus updated PIVOT-718:
--------------------------------

    Attachment: TreeSelect.bxml
                TreeSelect.java

> TreeViewSelectionListener not invoked
> -------------------------------------
>
>                 Key: PIVOT-718
>                 URL: https://issues.apache.org/jira/browse/PIVOT-718
>             Project: Pivot
>          Issue Type: Bug
>          Components: wtk
>    Affects Versions: 2.0
>         Environment: jkd1.6,linux
>            Reporter: laurent Gebus
>             Fix For: 2.0.1
>
>         Attachments: TreeSelect.bxml, TreeSelect.java
>
>
> I have a TreeView with a TreeViewSelectionListener, but the listener doesn't get invoked when a item is removed from the tree.
> I do : tree.getTreeData().remove( tree.getSelectedNode());
> tree is refreshed : the removed node is no longer shown, no node is selected but the listener is not invoked. 
> Looked at the code :
> in TreeView#itemsRemoved(), clearAndDecrementPaths() is invoked and returns 0. But Listeners are only invoked when > 0 is returned. 
> see attached example comparing a TreeView to a ListView

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] Updated: (PIVOT-718) TreeViewSelectionListener not invoked

Posted by "laurent Gebus (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/PIVOT-718?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

laurent Gebus updated PIVOT-718:
--------------------------------

    Attachment: TreeSelect.bxml

replaces the previously uploaded file

> TreeViewSelectionListener not invoked
> -------------------------------------
>
>                 Key: PIVOT-718
>                 URL: https://issues.apache.org/jira/browse/PIVOT-718
>             Project: Pivot
>          Issue Type: Bug
>          Components: wtk
>    Affects Versions: 2.0
>         Environment: jkd1.6,linux
>            Reporter: laurent Gebus
>            Assignee: Sandro Martini
>            Priority: Minor
>             Fix For: 2.0.1
>
>         Attachments: TreeSelect.bxml, TreeSelect.bxml, TreeSelect.java, TreeSelect.java
>
>
> I have a TreeView with a TreeViewSelectionListener, but the listener doesn't get invoked when a item is removed from the tree.
> I do : tree.getTreeData().remove( tree.getSelectedNode());
> tree is refreshed : the removed node is no longer shown, no node is selected but the listener is not invoked. 
> Looked at the code :
> in TreeView#itemsRemoved(), clearAndDecrementPaths() is invoked and returns 0. But Listeners are only invoked when > 0 is returned. 
> see attached example comparing a TreeView to a ListView

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (PIVOT-718) TreeViewSelectionListener not invoked

Posted by "Sandro Martini (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PIVOT-718?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13028488#comment-13028488 ] 

Sandro Martini commented on PIVOT-718:
--------------------------------------

Raffaele, thanks for the info, I was thinking at something like this, ans I'll try to look even at it ... but on Trees I have to see what Greg and Todd say (they wrote the original version of it, and I know little this class, I fear to make some damage with a fix). 
So at the moment I have to freeze this issue until some info will come ... but at the moment I'll keep it for the 2.0.1, and see later if move to 2.1 (only if impossible to fix in next weeks).


> TreeViewSelectionListener not invoked
> -------------------------------------
>
>                 Key: PIVOT-718
>                 URL: https://issues.apache.org/jira/browse/PIVOT-718
>             Project: Pivot
>          Issue Type: Bug
>          Components: wtk
>    Affects Versions: 2.0
>         Environment: jkd1.6,linux
>            Reporter: laurent Gebus
>            Assignee: Sandro Martini
>            Priority: Minor
>             Fix For: 2.0.1
>
>         Attachments: TreeSelect.bxml, TreeSelect.java
>
>
> I have a TreeView with a TreeViewSelectionListener, but the listener doesn't get invoked when a item is removed from the tree.
> I do : tree.getTreeData().remove( tree.getSelectedNode());
> tree is refreshed : the removed node is no longer shown, no node is selected but the listener is not invoked. 
> Looked at the code :
> in TreeView#itemsRemoved(), clearAndDecrementPaths() is invoked and returns 0. But Listeners are only invoked when > 0 is returned. 
> see attached example comparing a TreeView to a ListView

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira