You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Sergey Plevko (JIRA)" <ji...@apache.org> on 2011/01/13 15:36:47 UTC
[jira] Created: (WICKET-3328) Selection remains after removing
collapsed node in the tree.
Selection remains after removing collapsed node in the tree.
------------------------------------------------------------
Key: WICKET-3328
URL: https://issues.apache.org/jira/browse/WICKET-3328
Project: Wicket
Issue Type: Bug
Components: wicket
Affects Versions: 1.4.14
Environment: tomcat 6.0.26, win 7
Reporter: Sergey Plevko
If we fire 'node removed event' in the tree, it deselects only node which is currently shown (not under collapsed parent).
There are two use cases which show correct and incorrect behavior.
Step 1: expand ROOT
Step 2: expand SUBTREE
Step 3: select LEAF
Step 4: press 'Print Selection'
Result 4: 'Selected Node: LEAF'
Step 5: press 'Delete SUBTREE'
Step 6: press 'Print Selection'
Result 6: 'Selected Node: --NO SELECTION--'
This behavior is correct.
Step 1: expand ROOT
Step 2: expand SUBTREE
Step 3: select LEAF
Step 4: press 'Print Selection'
Result 4: 'Selected Node: LEAF'
-------------------------------------
Step 5: collapse SUBTREE
-------------------------------------
Step 6: press 'Delete SUBTREE'
Step 7: press 'Print Selection'
Result 7: 'Selected Node: LEAF'
'LEAF' is still selected, but there is no such node in the tree model.
Use the code below to reproduce the bug.
Test.html
<html>
<body>
<div wicket:id="tree"></div>
<input type="button" wicket:id="printSelection" value="Print Selection">
<input type="button" wicket:id="delete" value="Delete 'SUBTREE'">
<br>Selected Node:
<b><span wicket:id="selection"></span></b>
</body>
</html>
Test.java
public class Test extends WebPage {
private DefaultMutableTreeNode subTree;
public Test() {
final LinkTree tree = new LinkTree("tree", createTreeModel());
add(tree);
final Label selection = new Label("selection");
add(new AjaxLink("printSelection") {
@Override
public void onClick(AjaxRequestTarget target) {
Collection<Object> selectedNodes = tree.getTreeState().getSelectedNodes();
String selectionString = "--NO SELECTION--";
if (selectedNodes.size() > 0) {
selectionString = selectedNodes.iterator().next().toString();
}
selection.setDefaultModel(new Model<String>(selectionString));
target.addComponent(selection);
}
});
add(new AjaxLink("delete") {
@Override
public void onClick(AjaxRequestTarget target) {
DefaultTreeModel treeModel = (DefaultTreeModel) tree.getModelObject();
if(subTree != null) {
treeModel.removeNodeFromParent(subTree);
subTree = null;
}
tree.updateTree();
}
});
selection.setOutputMarkupId(true);
add(selection);
}
protected TreeModel createTreeModel() {
DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode("ROOT");
subTree = new DefaultMutableTreeNode("SUBTREE");
DefaultMutableTreeNode leaf = new DefaultMutableTreeNode("LEAF");
rootNode.add(subTree);
subTree.add(leaf);
return new DefaultTreeModel(rootNode);
}
}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] [Reopened] (WICKET-3328) Selection remains after removing
collapsed node in the tree.
Posted by "Martin Grigorov (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WICKET-3328?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Martin Grigorov reopened WICKET-3328:
-------------------------------------
> Selection remains after removing collapsed node in the tree.
> ------------------------------------------------------------
>
> Key: WICKET-3328
> URL: https://issues.apache.org/jira/browse/WICKET-3328
> Project: Wicket
> Issue Type: Bug
> Components: wicket-core
> Affects Versions: 1.4.14
> Environment: tomcat 6.0.26, win 7
> Reporter: Sergey Plevko
> Assignee: Martin Grigorov
> Attachments: quickStart.ZIP
>
>
> If we fire 'node removed event' in the tree, it deselects only node which is currently shown (not under collapsed parent).
> There are two use cases which show correct and incorrect behavior.
> Step 1: expand ROOT
> Step 2: expand SUBTREE
> Step 3: select LEAF
> Step 4: press 'Print Selection'
> Result 4: 'Selected Node: LEAF'
> Step 5: press 'Delete SUBTREE'
> Step 6: press 'Print Selection'
> Result 6: 'Selected Node: --NO SELECTION--'
> This behavior is correct.
> Step 1: expand ROOT
> Step 2: expand SUBTREE
> Step 3: select LEAF
> Step 4: press 'Print Selection'
> Result 4: 'Selected Node: LEAF'
> -------------------------------------
> Step 5: collapse SUBTREE
> -------------------------------------
> Step 6: press 'Delete SUBTREE'
> Step 7: press 'Print Selection'
> Result 7: 'Selected Node: LEAF'
> 'LEAF' is still selected, but there is no such node in the tree model.
> Use the code below to reproduce the bug.
> Test.html
> <html>
> <body>
> <div wicket:id="tree"></div>
> <input type="button" wicket:id="printSelection" value="Print Selection">
> <input type="button" wicket:id="delete" value="Delete 'SUBTREE'">
> <br>Selected Node:
> <b><span wicket:id="selection"></span></b>
> </body>
> </html>
> Test.java
> public class Test extends WebPage {
> private DefaultMutableTreeNode subTree;
> public Test() {
> final LinkTree tree = new LinkTree("tree", createTreeModel());
> add(tree);
> final Label selection = new Label("selection");
> add(new AjaxLink("printSelection") {
> @Override
> public void onClick(AjaxRequestTarget target) {
> Collection<Object> selectedNodes = tree.getTreeState().getSelectedNodes();
> String selectionString = "--NO SELECTION--";
> if (selectedNodes.size() > 0) {
> selectionString = selectedNodes.iterator().next().toString();
> }
> selection.setDefaultModel(new Model<String>(selectionString));
> target.addComponent(selection);
> }
> });
> add(new AjaxLink("delete") {
> @Override
> public void onClick(AjaxRequestTarget target) {
> DefaultTreeModel treeModel = (DefaultTreeModel) tree.getModelObject();
> if(subTree != null) {
> treeModel.removeNodeFromParent(subTree);
> subTree = null;
> }
> tree.updateTree();
> }
> });
> selection.setOutputMarkupId(true);
> add(selection);
> }
> protected TreeModel createTreeModel() {
> DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode("ROOT");
> subTree = new DefaultMutableTreeNode("SUBTREE");
> DefaultMutableTreeNode leaf = new DefaultMutableTreeNode("LEAF");
> rootNode.add(subTree);
> subTree.add(leaf);
> return new DefaultTreeModel(rootNode);
> }
> }
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Assigned] (WICKET-3328) Selection remains after removing
collapsed node in the tree.
Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WICKET-3328?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Igor Vaynberg reassigned WICKET-3328:
-------------------------------------
Assignee: Igor Vaynberg
> Selection remains after removing collapsed node in the tree.
> ------------------------------------------------------------
>
> Key: WICKET-3328
> URL: https://issues.apache.org/jira/browse/WICKET-3328
> Project: Wicket
> Issue Type: Bug
> Components: wicket-core
> Affects Versions: 1.4.14
> Environment: tomcat 6.0.26, win 7
> Reporter: Sergey Plevko
> Assignee: Igor Vaynberg
> Attachments: 3328.flv, quickStart.ZIP
>
>
> If we fire 'node removed event' in the tree, it deselects only node which is currently shown (not under collapsed parent).
> There are two use cases which show correct and incorrect behavior.
> Step 1: expand ROOT
> Step 2: expand SUBTREE
> Step 3: select LEAF
> Step 4: press 'Print Selection'
> Result 4: 'Selected Node: LEAF'
> Step 5: press 'Delete SUBTREE'
> Step 6: press 'Print Selection'
> Result 6: 'Selected Node: --NO SELECTION--'
> This behavior is correct.
> Step 1: expand ROOT
> Step 2: expand SUBTREE
> Step 3: select LEAF
> Step 4: press 'Print Selection'
> Result 4: 'Selected Node: LEAF'
> -------------------------------------
> Step 5: collapse SUBTREE
> -------------------------------------
> Step 6: press 'Delete SUBTREE'
> Step 7: press 'Print Selection'
> Result 7: 'Selected Node: LEAF'
> 'LEAF' is still selected, but there is no such node in the tree model.
> Use the code below to reproduce the bug.
> Test.html
> <html>
> <body>
> <div wicket:id="tree"></div>
> <input type="button" wicket:id="printSelection" value="Print Selection">
> <input type="button" wicket:id="delete" value="Delete 'SUBTREE'">
> <br>Selected Node:
> <b><span wicket:id="selection"></span></b>
> </body>
> </html>
> Test.java
> public class Test extends WebPage {
> private DefaultMutableTreeNode subTree;
> public Test() {
> final LinkTree tree = new LinkTree("tree", createTreeModel());
> add(tree);
> final Label selection = new Label("selection");
> add(new AjaxLink("printSelection") {
> @Override
> public void onClick(AjaxRequestTarget target) {
> Collection<Object> selectedNodes = tree.getTreeState().getSelectedNodes();
> String selectionString = "--NO SELECTION--";
> if (selectedNodes.size() > 0) {
> selectionString = selectedNodes.iterator().next().toString();
> }
> selection.setDefaultModel(new Model<String>(selectionString));
> target.addComponent(selection);
> }
> });
> add(new AjaxLink("delete") {
> @Override
> public void onClick(AjaxRequestTarget target) {
> DefaultTreeModel treeModel = (DefaultTreeModel) tree.getModelObject();
> if(subTree != null) {
> treeModel.removeNodeFromParent(subTree);
> subTree = null;
> }
> tree.updateTree();
> }
> });
> selection.setOutputMarkupId(true);
> add(selection);
> }
> protected TreeModel createTreeModel() {
> DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode("ROOT");
> subTree = new DefaultMutableTreeNode("SUBTREE");
> DefaultMutableTreeNode leaf = new DefaultMutableTreeNode("LEAF");
> rootNode.add(subTree);
> subTree.add(leaf);
> return new DefaultTreeModel(rootNode);
> }
> }
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Resolved: (WICKET-3328) Selection remains after removing
collapsed node in the tree.
Posted by "Martin Grigorov (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WICKET-3328?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Martin Grigorov resolved WICKET-3328.
-------------------------------------
Resolution: Not A Problem
Assignee: Martin Grigorov (was: Pedro Santos)
All you need to do is to change
tree.updateTree();
to
tree.updateTree(target);
in delete link's onClick and the second scenario works too.
> Selection remains after removing collapsed node in the tree.
> ------------------------------------------------------------
>
> Key: WICKET-3328
> URL: https://issues.apache.org/jira/browse/WICKET-3328
> Project: Wicket
> Issue Type: Bug
> Components: wicket
> Affects Versions: 1.4.14
> Environment: tomcat 6.0.26, win 7
> Reporter: Sergey Plevko
> Assignee: Martin Grigorov
>
> If we fire 'node removed event' in the tree, it deselects only node which is currently shown (not under collapsed parent).
> There are two use cases which show correct and incorrect behavior.
> Step 1: expand ROOT
> Step 2: expand SUBTREE
> Step 3: select LEAF
> Step 4: press 'Print Selection'
> Result 4: 'Selected Node: LEAF'
> Step 5: press 'Delete SUBTREE'
> Step 6: press 'Print Selection'
> Result 6: 'Selected Node: --NO SELECTION--'
> This behavior is correct.
> Step 1: expand ROOT
> Step 2: expand SUBTREE
> Step 3: select LEAF
> Step 4: press 'Print Selection'
> Result 4: 'Selected Node: LEAF'
> -------------------------------------
> Step 5: collapse SUBTREE
> -------------------------------------
> Step 6: press 'Delete SUBTREE'
> Step 7: press 'Print Selection'
> Result 7: 'Selected Node: LEAF'
> 'LEAF' is still selected, but there is no such node in the tree model.
> Use the code below to reproduce the bug.
> Test.html
> <html>
> <body>
> <div wicket:id="tree"></div>
> <input type="button" wicket:id="printSelection" value="Print Selection">
> <input type="button" wicket:id="delete" value="Delete 'SUBTREE'">
> <br>Selected Node:
> <b><span wicket:id="selection"></span></b>
> </body>
> </html>
> Test.java
> public class Test extends WebPage {
> private DefaultMutableTreeNode subTree;
> public Test() {
> final LinkTree tree = new LinkTree("tree", createTreeModel());
> add(tree);
> final Label selection = new Label("selection");
> add(new AjaxLink("printSelection") {
> @Override
> public void onClick(AjaxRequestTarget target) {
> Collection<Object> selectedNodes = tree.getTreeState().getSelectedNodes();
> String selectionString = "--NO SELECTION--";
> if (selectedNodes.size() > 0) {
> selectionString = selectedNodes.iterator().next().toString();
> }
> selection.setDefaultModel(new Model<String>(selectionString));
> target.addComponent(selection);
> }
> });
> add(new AjaxLink("delete") {
> @Override
> public void onClick(AjaxRequestTarget target) {
> DefaultTreeModel treeModel = (DefaultTreeModel) tree.getModelObject();
> if(subTree != null) {
> treeModel.removeNodeFromParent(subTree);
> subTree = null;
> }
> tree.updateTree();
> }
> });
> selection.setOutputMarkupId(true);
> add(selection);
> }
> protected TreeModel createTreeModel() {
> DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode("ROOT");
> subTree = new DefaultMutableTreeNode("SUBTREE");
> DefaultMutableTreeNode leaf = new DefaultMutableTreeNode("LEAF");
> rootNode.add(subTree);
> subTree.add(leaf);
> return new DefaultTreeModel(rootNode);
> }
> }
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (WICKET-3328) Selection remains after removing
collapsed node in the tree.
Posted by "Sergey Plevko (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WICKET-3328?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Sergey Plevko updated WICKET-3328:
----------------------------------
Attachment: quickStart.ZIP
add quick start
> Selection remains after removing collapsed node in the tree.
> ------------------------------------------------------------
>
> Key: WICKET-3328
> URL: https://issues.apache.org/jira/browse/WICKET-3328
> Project: Wicket
> Issue Type: Bug
> Components: wicket-core
> Affects Versions: 1.4.14
> Environment: tomcat 6.0.26, win 7
> Reporter: Sergey Plevko
> Assignee: Martin Grigorov
> Attachments: quickStart.ZIP
>
>
> If we fire 'node removed event' in the tree, it deselects only node which is currently shown (not under collapsed parent).
> There are two use cases which show correct and incorrect behavior.
> Step 1: expand ROOT
> Step 2: expand SUBTREE
> Step 3: select LEAF
> Step 4: press 'Print Selection'
> Result 4: 'Selected Node: LEAF'
> Step 5: press 'Delete SUBTREE'
> Step 6: press 'Print Selection'
> Result 6: 'Selected Node: --NO SELECTION--'
> This behavior is correct.
> Step 1: expand ROOT
> Step 2: expand SUBTREE
> Step 3: select LEAF
> Step 4: press 'Print Selection'
> Result 4: 'Selected Node: LEAF'
> -------------------------------------
> Step 5: collapse SUBTREE
> -------------------------------------
> Step 6: press 'Delete SUBTREE'
> Step 7: press 'Print Selection'
> Result 7: 'Selected Node: LEAF'
> 'LEAF' is still selected, but there is no such node in the tree model.
> Use the code below to reproduce the bug.
> Test.html
> <html>
> <body>
> <div wicket:id="tree"></div>
> <input type="button" wicket:id="printSelection" value="Print Selection">
> <input type="button" wicket:id="delete" value="Delete 'SUBTREE'">
> <br>Selected Node:
> <b><span wicket:id="selection"></span></b>
> </body>
> </html>
> Test.java
> public class Test extends WebPage {
> private DefaultMutableTreeNode subTree;
> public Test() {
> final LinkTree tree = new LinkTree("tree", createTreeModel());
> add(tree);
> final Label selection = new Label("selection");
> add(new AjaxLink("printSelection") {
> @Override
> public void onClick(AjaxRequestTarget target) {
> Collection<Object> selectedNodes = tree.getTreeState().getSelectedNodes();
> String selectionString = "--NO SELECTION--";
> if (selectedNodes.size() > 0) {
> selectionString = selectedNodes.iterator().next().toString();
> }
> selection.setDefaultModel(new Model<String>(selectionString));
> target.addComponent(selection);
> }
> });
> add(new AjaxLink("delete") {
> @Override
> public void onClick(AjaxRequestTarget target) {
> DefaultTreeModel treeModel = (DefaultTreeModel) tree.getModelObject();
> if(subTree != null) {
> treeModel.removeNodeFromParent(subTree);
> subTree = null;
> }
> tree.updateTree();
> }
> });
> selection.setOutputMarkupId(true);
> add(selection);
> }
> protected TreeModel createTreeModel() {
> DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode("ROOT");
> subTree = new DefaultMutableTreeNode("SUBTREE");
> DefaultMutableTreeNode leaf = new DefaultMutableTreeNode("LEAF");
> rootNode.add(subTree);
> subTree.add(leaf);
> return new DefaultTreeModel(rootNode);
> }
> }
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (WICKET-3328) Selection remains after removing
collapsed node in the tree.
Posted by "Sergey Plevko (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WICKET-3328?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Sergey Plevko updated WICKET-3328:
----------------------------------
Attachment: 3328.flv
attach video
> Selection remains after removing collapsed node in the tree.
> ------------------------------------------------------------
>
> Key: WICKET-3328
> URL: https://issues.apache.org/jira/browse/WICKET-3328
> Project: Wicket
> Issue Type: Bug
> Components: wicket-core
> Affects Versions: 1.4.14
> Environment: tomcat 6.0.26, win 7
> Reporter: Sergey Plevko
> Attachments: 3328.flv, quickStart.ZIP
>
>
> If we fire 'node removed event' in the tree, it deselects only node which is currently shown (not under collapsed parent).
> There are two use cases which show correct and incorrect behavior.
> Step 1: expand ROOT
> Step 2: expand SUBTREE
> Step 3: select LEAF
> Step 4: press 'Print Selection'
> Result 4: 'Selected Node: LEAF'
> Step 5: press 'Delete SUBTREE'
> Step 6: press 'Print Selection'
> Result 6: 'Selected Node: --NO SELECTION--'
> This behavior is correct.
> Step 1: expand ROOT
> Step 2: expand SUBTREE
> Step 3: select LEAF
> Step 4: press 'Print Selection'
> Result 4: 'Selected Node: LEAF'
> -------------------------------------
> Step 5: collapse SUBTREE
> -------------------------------------
> Step 6: press 'Delete SUBTREE'
> Step 7: press 'Print Selection'
> Result 7: 'Selected Node: LEAF'
> 'LEAF' is still selected, but there is no such node in the tree model.
> Use the code below to reproduce the bug.
> Test.html
> <html>
> <body>
> <div wicket:id="tree"></div>
> <input type="button" wicket:id="printSelection" value="Print Selection">
> <input type="button" wicket:id="delete" value="Delete 'SUBTREE'">
> <br>Selected Node:
> <b><span wicket:id="selection"></span></b>
> </body>
> </html>
> Test.java
> public class Test extends WebPage {
> private DefaultMutableTreeNode subTree;
> public Test() {
> final LinkTree tree = new LinkTree("tree", createTreeModel());
> add(tree);
> final Label selection = new Label("selection");
> add(new AjaxLink("printSelection") {
> @Override
> public void onClick(AjaxRequestTarget target) {
> Collection<Object> selectedNodes = tree.getTreeState().getSelectedNodes();
> String selectionString = "--NO SELECTION--";
> if (selectedNodes.size() > 0) {
> selectionString = selectedNodes.iterator().next().toString();
> }
> selection.setDefaultModel(new Model<String>(selectionString));
> target.addComponent(selection);
> }
> });
> add(new AjaxLink("delete") {
> @Override
> public void onClick(AjaxRequestTarget target) {
> DefaultTreeModel treeModel = (DefaultTreeModel) tree.getModelObject();
> if(subTree != null) {
> treeModel.removeNodeFromParent(subTree);
> subTree = null;
> }
> tree.updateTree();
> }
> });
> selection.setOutputMarkupId(true);
> add(selection);
> }
> protected TreeModel createTreeModel() {
> DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode("ROOT");
> subTree = new DefaultMutableTreeNode("SUBTREE");
> DefaultMutableTreeNode leaf = new DefaultMutableTreeNode("LEAF");
> rootNode.add(subTree);
> subTree.add(leaf);
> return new DefaultTreeModel(rootNode);
> }
> }
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (WICKET-3328) Selection remains after removing
collapsed node in the tree.
Posted by "Martin Grigorov (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WICKET-3328?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13015431#comment-13015431 ]
Martin Grigorov commented on WICKET-3328:
-----------------------------------------
I just tried it again and the second scenario above works as expected. At step 7 I got : Selected Node: --NO SELECTION--
I would close the ticket again as "cannot reproduce" but I'll leave it to other devs to check it as well. Maybe it is something related to the system environment...
> Selection remains after removing collapsed node in the tree.
> ------------------------------------------------------------
>
> Key: WICKET-3328
> URL: https://issues.apache.org/jira/browse/WICKET-3328
> Project: Wicket
> Issue Type: Bug
> Components: wicket-core
> Affects Versions: 1.4.14
> Environment: tomcat 6.0.26, win 7
> Reporter: Sergey Plevko
> Assignee: Martin Grigorov
> Attachments: quickStart.ZIP
>
>
> If we fire 'node removed event' in the tree, it deselects only node which is currently shown (not under collapsed parent).
> There are two use cases which show correct and incorrect behavior.
> Step 1: expand ROOT
> Step 2: expand SUBTREE
> Step 3: select LEAF
> Step 4: press 'Print Selection'
> Result 4: 'Selected Node: LEAF'
> Step 5: press 'Delete SUBTREE'
> Step 6: press 'Print Selection'
> Result 6: 'Selected Node: --NO SELECTION--'
> This behavior is correct.
> Step 1: expand ROOT
> Step 2: expand SUBTREE
> Step 3: select LEAF
> Step 4: press 'Print Selection'
> Result 4: 'Selected Node: LEAF'
> -------------------------------------
> Step 5: collapse SUBTREE
> -------------------------------------
> Step 6: press 'Delete SUBTREE'
> Step 7: press 'Print Selection'
> Result 7: 'Selected Node: LEAF'
> 'LEAF' is still selected, but there is no such node in the tree model.
> Use the code below to reproduce the bug.
> Test.html
> <html>
> <body>
> <div wicket:id="tree"></div>
> <input type="button" wicket:id="printSelection" value="Print Selection">
> <input type="button" wicket:id="delete" value="Delete 'SUBTREE'">
> <br>Selected Node:
> <b><span wicket:id="selection"></span></b>
> </body>
> </html>
> Test.java
> public class Test extends WebPage {
> private DefaultMutableTreeNode subTree;
> public Test() {
> final LinkTree tree = new LinkTree("tree", createTreeModel());
> add(tree);
> final Label selection = new Label("selection");
> add(new AjaxLink("printSelection") {
> @Override
> public void onClick(AjaxRequestTarget target) {
> Collection<Object> selectedNodes = tree.getTreeState().getSelectedNodes();
> String selectionString = "--NO SELECTION--";
> if (selectedNodes.size() > 0) {
> selectionString = selectedNodes.iterator().next().toString();
> }
> selection.setDefaultModel(new Model<String>(selectionString));
> target.addComponent(selection);
> }
> });
> add(new AjaxLink("delete") {
> @Override
> public void onClick(AjaxRequestTarget target) {
> DefaultTreeModel treeModel = (DefaultTreeModel) tree.getModelObject();
> if(subTree != null) {
> treeModel.removeNodeFromParent(subTree);
> subTree = null;
> }
> tree.updateTree();
> }
> });
> selection.setOutputMarkupId(true);
> add(selection);
> }
> protected TreeModel createTreeModel() {
> DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode("ROOT");
> subTree = new DefaultMutableTreeNode("SUBTREE");
> DefaultMutableTreeNode leaf = new DefaultMutableTreeNode("LEAF");
> rootNode.add(subTree);
> subTree.add(leaf);
> return new DefaultTreeModel(rootNode);
> }
> }
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (WICKET-3328) Selection remains after removing
collapsed node in the tree.
Posted by "Sergey Plevko (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WICKET-3328?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13015416#comment-13015416 ]
Sergey Plevko commented on WICKET-3328:
---------------------------------------
Solutions with changing tree.updateTree() to tree.updateTree(target) doesn't work. Generally speaking i don't see a big difference between this methods.
Please, reopen the issue.
> Selection remains after removing collapsed node in the tree.
> ------------------------------------------------------------
>
> Key: WICKET-3328
> URL: https://issues.apache.org/jira/browse/WICKET-3328
> Project: Wicket
> Issue Type: Bug
> Components: wicket-core
> Affects Versions: 1.4.14
> Environment: tomcat 6.0.26, win 7
> Reporter: Sergey Plevko
> Assignee: Martin Grigorov
>
> If we fire 'node removed event' in the tree, it deselects only node which is currently shown (not under collapsed parent).
> There are two use cases which show correct and incorrect behavior.
> Step 1: expand ROOT
> Step 2: expand SUBTREE
> Step 3: select LEAF
> Step 4: press 'Print Selection'
> Result 4: 'Selected Node: LEAF'
> Step 5: press 'Delete SUBTREE'
> Step 6: press 'Print Selection'
> Result 6: 'Selected Node: --NO SELECTION--'
> This behavior is correct.
> Step 1: expand ROOT
> Step 2: expand SUBTREE
> Step 3: select LEAF
> Step 4: press 'Print Selection'
> Result 4: 'Selected Node: LEAF'
> -------------------------------------
> Step 5: collapse SUBTREE
> -------------------------------------
> Step 6: press 'Delete SUBTREE'
> Step 7: press 'Print Selection'
> Result 7: 'Selected Node: LEAF'
> 'LEAF' is still selected, but there is no such node in the tree model.
> Use the code below to reproduce the bug.
> Test.html
> <html>
> <body>
> <div wicket:id="tree"></div>
> <input type="button" wicket:id="printSelection" value="Print Selection">
> <input type="button" wicket:id="delete" value="Delete 'SUBTREE'">
> <br>Selected Node:
> <b><span wicket:id="selection"></span></b>
> </body>
> </html>
> Test.java
> public class Test extends WebPage {
> private DefaultMutableTreeNode subTree;
> public Test() {
> final LinkTree tree = new LinkTree("tree", createTreeModel());
> add(tree);
> final Label selection = new Label("selection");
> add(new AjaxLink("printSelection") {
> @Override
> public void onClick(AjaxRequestTarget target) {
> Collection<Object> selectedNodes = tree.getTreeState().getSelectedNodes();
> String selectionString = "--NO SELECTION--";
> if (selectedNodes.size() > 0) {
> selectionString = selectedNodes.iterator().next().toString();
> }
> selection.setDefaultModel(new Model<String>(selectionString));
> target.addComponent(selection);
> }
> });
> add(new AjaxLink("delete") {
> @Override
> public void onClick(AjaxRequestTarget target) {
> DefaultTreeModel treeModel = (DefaultTreeModel) tree.getModelObject();
> if(subTree != null) {
> treeModel.removeNodeFromParent(subTree);
> subTree = null;
> }
> tree.updateTree();
> }
> });
> selection.setOutputMarkupId(true);
> add(selection);
> }
> protected TreeModel createTreeModel() {
> DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode("ROOT");
> subTree = new DefaultMutableTreeNode("SUBTREE");
> DefaultMutableTreeNode leaf = new DefaultMutableTreeNode("LEAF");
> rootNode.add(subTree);
> subTree.add(leaf);
> return new DefaultTreeModel(rootNode);
> }
> }
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Resolved] (WICKET-3328) Selection remains after removing
collapsed node in the tree.
Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WICKET-3328?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Igor Vaynberg resolved WICKET-3328.
-----------------------------------
Resolution: Fixed
Fix Version/s: 1.5-RC4
1.4.18
> Selection remains after removing collapsed node in the tree.
> ------------------------------------------------------------
>
> Key: WICKET-3328
> URL: https://issues.apache.org/jira/browse/WICKET-3328
> Project: Wicket
> Issue Type: Bug
> Components: wicket-core
> Affects Versions: 1.4.14
> Environment: tomcat 6.0.26, win 7
> Reporter: Sergey Plevko
> Assignee: Igor Vaynberg
> Fix For: 1.4.18, 1.5-RC4
>
> Attachments: 3328.flv, quickStart.ZIP
>
>
> If we fire 'node removed event' in the tree, it deselects only node which is currently shown (not under collapsed parent).
> There are two use cases which show correct and incorrect behavior.
> Step 1: expand ROOT
> Step 2: expand SUBTREE
> Step 3: select LEAF
> Step 4: press 'Print Selection'
> Result 4: 'Selected Node: LEAF'
> Step 5: press 'Delete SUBTREE'
> Step 6: press 'Print Selection'
> Result 6: 'Selected Node: --NO SELECTION--'
> This behavior is correct.
> Step 1: expand ROOT
> Step 2: expand SUBTREE
> Step 3: select LEAF
> Step 4: press 'Print Selection'
> Result 4: 'Selected Node: LEAF'
> -------------------------------------
> Step 5: collapse SUBTREE
> -------------------------------------
> Step 6: press 'Delete SUBTREE'
> Step 7: press 'Print Selection'
> Result 7: 'Selected Node: LEAF'
> 'LEAF' is still selected, but there is no such node in the tree model.
> Use the code below to reproduce the bug.
> Test.html
> <html>
> <body>
> <div wicket:id="tree"></div>
> <input type="button" wicket:id="printSelection" value="Print Selection">
> <input type="button" wicket:id="delete" value="Delete 'SUBTREE'">
> <br>Selected Node:
> <b><span wicket:id="selection"></span></b>
> </body>
> </html>
> Test.java
> public class Test extends WebPage {
> private DefaultMutableTreeNode subTree;
> public Test() {
> final LinkTree tree = new LinkTree("tree", createTreeModel());
> add(tree);
> final Label selection = new Label("selection");
> add(new AjaxLink("printSelection") {
> @Override
> public void onClick(AjaxRequestTarget target) {
> Collection<Object> selectedNodes = tree.getTreeState().getSelectedNodes();
> String selectionString = "--NO SELECTION--";
> if (selectedNodes.size() > 0) {
> selectionString = selectedNodes.iterator().next().toString();
> }
> selection.setDefaultModel(new Model<String>(selectionString));
> target.addComponent(selection);
> }
> });
> add(new AjaxLink("delete") {
> @Override
> public void onClick(AjaxRequestTarget target) {
> DefaultTreeModel treeModel = (DefaultTreeModel) tree.getModelObject();
> if(subTree != null) {
> treeModel.removeNodeFromParent(subTree);
> subTree = null;
> }
> tree.updateTree();
> }
> });
> selection.setOutputMarkupId(true);
> add(selection);
> }
> protected TreeModel createTreeModel() {
> DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode("ROOT");
> subTree = new DefaultMutableTreeNode("SUBTREE");
> DefaultMutableTreeNode leaf = new DefaultMutableTreeNode("LEAF");
> rootNode.add(subTree);
> subTree.add(leaf);
> return new DefaultTreeModel(rootNode);
> }
> }
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Assigned] (WICKET-3328) Selection remains after removing
collapsed node in the tree.
Posted by "Martin Grigorov (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WICKET-3328?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Martin Grigorov reassigned WICKET-3328:
---------------------------------------
Assignee: (was: Martin Grigorov)
> Selection remains after removing collapsed node in the tree.
> ------------------------------------------------------------
>
> Key: WICKET-3328
> URL: https://issues.apache.org/jira/browse/WICKET-3328
> Project: Wicket
> Issue Type: Bug
> Components: wicket-core
> Affects Versions: 1.4.14
> Environment: tomcat 6.0.26, win 7
> Reporter: Sergey Plevko
> Attachments: quickStart.ZIP
>
>
> If we fire 'node removed event' in the tree, it deselects only node which is currently shown (not under collapsed parent).
> There are two use cases which show correct and incorrect behavior.
> Step 1: expand ROOT
> Step 2: expand SUBTREE
> Step 3: select LEAF
> Step 4: press 'Print Selection'
> Result 4: 'Selected Node: LEAF'
> Step 5: press 'Delete SUBTREE'
> Step 6: press 'Print Selection'
> Result 6: 'Selected Node: --NO SELECTION--'
> This behavior is correct.
> Step 1: expand ROOT
> Step 2: expand SUBTREE
> Step 3: select LEAF
> Step 4: press 'Print Selection'
> Result 4: 'Selected Node: LEAF'
> -------------------------------------
> Step 5: collapse SUBTREE
> -------------------------------------
> Step 6: press 'Delete SUBTREE'
> Step 7: press 'Print Selection'
> Result 7: 'Selected Node: LEAF'
> 'LEAF' is still selected, but there is no such node in the tree model.
> Use the code below to reproduce the bug.
> Test.html
> <html>
> <body>
> <div wicket:id="tree"></div>
> <input type="button" wicket:id="printSelection" value="Print Selection">
> <input type="button" wicket:id="delete" value="Delete 'SUBTREE'">
> <br>Selected Node:
> <b><span wicket:id="selection"></span></b>
> </body>
> </html>
> Test.java
> public class Test extends WebPage {
> private DefaultMutableTreeNode subTree;
> public Test() {
> final LinkTree tree = new LinkTree("tree", createTreeModel());
> add(tree);
> final Label selection = new Label("selection");
> add(new AjaxLink("printSelection") {
> @Override
> public void onClick(AjaxRequestTarget target) {
> Collection<Object> selectedNodes = tree.getTreeState().getSelectedNodes();
> String selectionString = "--NO SELECTION--";
> if (selectedNodes.size() > 0) {
> selectionString = selectedNodes.iterator().next().toString();
> }
> selection.setDefaultModel(new Model<String>(selectionString));
> target.addComponent(selection);
> }
> });
> add(new AjaxLink("delete") {
> @Override
> public void onClick(AjaxRequestTarget target) {
> DefaultTreeModel treeModel = (DefaultTreeModel) tree.getModelObject();
> if(subTree != null) {
> treeModel.removeNodeFromParent(subTree);
> subTree = null;
> }
> tree.updateTree();
> }
> });
> selection.setOutputMarkupId(true);
> add(selection);
> }
> protected TreeModel createTreeModel() {
> DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode("ROOT");
> subTree = new DefaultMutableTreeNode("SUBTREE");
> DefaultMutableTreeNode leaf = new DefaultMutableTreeNode("LEAF");
> rootNode.add(subTree);
> subTree.add(leaf);
> return new DefaultTreeModel(rootNode);
> }
> }
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Assigned: (WICKET-3328) Selection remains after removing
collapsed node in the tree.
Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WICKET-3328?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Igor Vaynberg reassigned WICKET-3328:
-------------------------------------
Assignee: Pedro Santos
> Selection remains after removing collapsed node in the tree.
> ------------------------------------------------------------
>
> Key: WICKET-3328
> URL: https://issues.apache.org/jira/browse/WICKET-3328
> Project: Wicket
> Issue Type: Bug
> Components: wicket
> Affects Versions: 1.4.14
> Environment: tomcat 6.0.26, win 7
> Reporter: Sergey Plevko
> Assignee: Pedro Santos
>
> If we fire 'node removed event' in the tree, it deselects only node which is currently shown (not under collapsed parent).
> There are two use cases which show correct and incorrect behavior.
> Step 1: expand ROOT
> Step 2: expand SUBTREE
> Step 3: select LEAF
> Step 4: press 'Print Selection'
> Result 4: 'Selected Node: LEAF'
> Step 5: press 'Delete SUBTREE'
> Step 6: press 'Print Selection'
> Result 6: 'Selected Node: --NO SELECTION--'
> This behavior is correct.
> Step 1: expand ROOT
> Step 2: expand SUBTREE
> Step 3: select LEAF
> Step 4: press 'Print Selection'
> Result 4: 'Selected Node: LEAF'
> -------------------------------------
> Step 5: collapse SUBTREE
> -------------------------------------
> Step 6: press 'Delete SUBTREE'
> Step 7: press 'Print Selection'
> Result 7: 'Selected Node: LEAF'
> 'LEAF' is still selected, but there is no such node in the tree model.
> Use the code below to reproduce the bug.
> Test.html
> <html>
> <body>
> <div wicket:id="tree"></div>
> <input type="button" wicket:id="printSelection" value="Print Selection">
> <input type="button" wicket:id="delete" value="Delete 'SUBTREE'">
> <br>Selected Node:
> <b><span wicket:id="selection"></span></b>
> </body>
> </html>
> Test.java
> public class Test extends WebPage {
> private DefaultMutableTreeNode subTree;
> public Test() {
> final LinkTree tree = new LinkTree("tree", createTreeModel());
> add(tree);
> final Label selection = new Label("selection");
> add(new AjaxLink("printSelection") {
> @Override
> public void onClick(AjaxRequestTarget target) {
> Collection<Object> selectedNodes = tree.getTreeState().getSelectedNodes();
> String selectionString = "--NO SELECTION--";
> if (selectedNodes.size() > 0) {
> selectionString = selectedNodes.iterator().next().toString();
> }
> selection.setDefaultModel(new Model<String>(selectionString));
> target.addComponent(selection);
> }
> });
> add(new AjaxLink("delete") {
> @Override
> public void onClick(AjaxRequestTarget target) {
> DefaultTreeModel treeModel = (DefaultTreeModel) tree.getModelObject();
> if(subTree != null) {
> treeModel.removeNodeFromParent(subTree);
> subTree = null;
> }
> tree.updateTree();
> }
> });
> selection.setOutputMarkupId(true);
> add(selection);
> }
> protected TreeModel createTreeModel() {
> DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode("ROOT");
> subTree = new DefaultMutableTreeNode("SUBTREE");
> DefaultMutableTreeNode leaf = new DefaultMutableTreeNode("LEAF");
> rootNode.add(subTree);
> subTree.add(leaf);
> return new DefaultTreeModel(rootNode);
> }
> }
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira