Skip to content
Snippets Groups Projects
Commit 14fd0c91 authored by Gwenaelle ABEILLE's avatar Gwenaelle ABEILLE
Browse files

Merge branch 'TANGOARCH-729' into 'master'

TANGOARCH-729

See merge request !1
parents ba6ac644 6e193c01
No related branches found
No related tags found
1 merge request!1TANGOARCH-729
/target/
.project
.classpath
.settings
...@@ -59,17 +59,17 @@ public class AttributesTree extends BensikinTree { ...@@ -59,17 +59,17 @@ public class AttributesTree extends BensikinTree {
/** /**
* Standard tree building from a model, plus sets the following options: * Standard tree building from a model, plus sets the following options:
* -setExpandsSelectedPaths ( true ) -->expands selected paths * <ul>
* -setScrollsOnExpand ( true ) -->scrolls if necessary on expansion * <li><code>setExpandsSelectedPaths(true)</code> --> expands selected paths</li>
* -setShowsRootHandles ( true ) --> shows the root handle even if empty * <li><code>setScrollsOnExpand(true)</code> --> scrolls if necessary on expansion</li>
* -setToggleClickCount ( 1 ) -->one click tree expansion/collapse * <li><code>setShowsRootHandles(true)</code> --> shows the root handle even if empty</li>
* <li><code>setToggleClickCount(1)</code> --> one click tree expansion/collapse</li>
* </ul>
* *
* @param newModel * @param newModel The model
* The model
*/ */
protected AttributesTree(TreeModel newModel) { protected AttributesTree(TreeModel newModel) {
super(newModel); super(newModel);
this.setExpandsSelectedPaths(true); this.setExpandsSelectedPaths(true);
this.setScrollsOnExpand(true); this.setScrollsOnExpand(true);
this.setShowsRootHandles(true); this.setShowsRootHandles(true);
...@@ -78,22 +78,18 @@ public class AttributesTree extends BensikinTree { ...@@ -78,22 +78,18 @@ public class AttributesTree extends BensikinTree {
} }
/** /**
* Returns a list of all the tree attributes that are under a currently * Returns a list of all the tree attributes that are under a currently selected node. Warning, since attributes
* selected node. Warning, since attributes trees are only loaded up to * trees are only loaded up to member level until each member is clicked, the list will be empty if no member's
* member level until each member is clicked, the list will be empty if no * attributes list has been loaded yet.
* member's attributes list has been loaded yet.
* *
* @param remove * @param remove If true, removes each of the found nodes from the tree
* If true, removes each of the found nodes from the tree * @return A List containing TreePath objects, each representing the path to one of the attributes under one of the
* @return A List containing TreePath objects, each representing the path to * selected nodes.
* one of the attributes under one of the selected nodes.
*/ */
public List<TreePath> getListOfAttributesTreePathUnderSelectedNodes(boolean remove) { public List<TreePath> getListOfAttributesTreePathUnderSelectedNodes(boolean remove) {
List<TreePath> attributes = new ArrayList<>();
TreePath[] selectedPath = this.getSelectionPaths(); TreePath[] selectedPath = this.getSelectionPaths();
if (selectedPath == null || selectedPath.length == 0) { if ((selectedPath != null) && (selectedPath.length > 0)) {
return null;
}
List<TreePath> attributes = new ArrayList<TreePath>();
// as many loops as there are selected nodes // as many loops as there are selected nodes
for (int i = 0; i < selectedPath.length; i++) { for (int i = 0; i < selectedPath.length; i++) {
TreePath currentSelectedTreePath = selectedPath[i]; TreePath currentSelectedTreePath = selectedPath[i];
...@@ -114,6 +110,7 @@ public class AttributesTree extends BensikinTree { ...@@ -114,6 +110,7 @@ public class AttributesTree extends BensikinTree {
currentSelectedNode.removeFromParent(); currentSelectedNode.removeFromParent();
} }
} }
}
return attributes; return attributes;
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment