|
a/tool/src/GUI/swingUtils.java |
|
b/tool/src/GUI/swingUtils.java |
|
... |
|
... |
18 |
import java.util.Enumeration;
|
18 |
import java.util.Enumeration;
|
19 |
import java.util.List;
|
19 |
import java.util.List;
|
20 |
import javax.swing.*;
|
20 |
import javax.swing.*;
|
21 |
import javax.swing.text.Element;
|
21 |
import javax.swing.text.Element;
|
22 |
import javax.swing.tree.DefaultTreeModel;
|
22 |
import javax.swing.tree.DefaultTreeModel;
|
|
|
23 |
import javax.swing.tree.TreeNode;
|
23 |
import javax.swing.tree.TreePath;
|
24 |
import javax.swing.tree.TreePath;
|
24 |
import javax.swing.tree.TreeSelectionModel;
|
25 |
import javax.swing.tree.TreeSelectionModel;
|
25 |
import script.RunPlugins;
|
26 |
import script.RunPlugins;
|
26 |
import script.log;
|
27 |
import script.log;
|
27 |
import spdxlib.FileInfo;
|
28 |
import spdxlib.FileInfo;
|
|
... |
|
... |
123 |
/**
|
124 |
/**
|
124 |
* Creates a new under under a given root node.
|
125 |
* Creates a new under under a given root node.
|
125 |
* The new node contains the details about a person
|
126 |
* The new node contains the details about a person
|
126 |
* @param root the parent of the new node
|
127 |
* @param root the parent of the new node
|
127 |
* @param person the object that will be used to populate the new node
|
128 |
* @param person the object that will be used to populate the new node
|
|
|
129 |
* @return The node with the person details
|
128 |
*/
|
130 |
*/
|
129 |
static public void addNodePerson(TreeNodeSPDX root, Person person){
|
131 |
static public TreeNodeSPDX addNodePerson(TreeNodeSPDX root, Person person){
|
130 |
TreeNodeSPDX nodePerson =
|
132 |
TreeNodeSPDX nodePerson =
|
131 |
createNodeChild(person.getTitle(),root);
|
133 |
createNodeChild(person.getTitle(),root);
|
132 |
// add the object
|
134 |
// add the object
|
133 |
nodePerson.nodeType = NodeType.person;
|
135 |
nodePerson.nodeType = NodeType.person;
|
134 |
nodePerson.id = person.getTitle();
|
136 |
nodePerson.id = person.getTitle();
|
135 |
nodePerson.setUserObject(person);
|
137 |
nodePerson.setUserObject(person);
|
|
|
138 |
return nodePerson;
|
136 |
}
|
139 |
}
|
137 |
|
140 |
|
138 |
|
141 |
|
139 |
/**
|
142 |
/**
|
140 |
* Method to ease the creation of new nodes on the tree list
|
143 |
* Method to ease the creation of new nodes on the tree list
|
|
... |
|
... |
465 |
if(selectedNode != null){
|
468 |
if(selectedNode != null){
|
466 |
// make the node visible again on the tree
|
469 |
// make the node visible again on the tree
|
467 |
JTree m_tree = core.studio.getTree();
|
470 |
JTree m_tree = core.studio.getTree();
|
468 |
TreeSelectionModel model = m_tree.getSelectionModel();
|
471 |
TreeSelectionModel model = m_tree.getSelectionModel();
|
469 |
TreePath path;
|
472 |
TreePath path;
|
470 |
// if(selectedNode.getChildCount()==0){
|
473 |
|
471 |
path = new TreePath(selectedNode.getPath());
|
474 |
// we first select one of the children to ensure it gets expanded
|
472 |
// } else{
|
|
|
473 |
// TreeNodeSPDX childNode = (TreeNodeSPDX) selectedNode.getChildAt(0);
|
475 |
TreeNodeSPDX child = (TreeNodeSPDX) selectedNode.getFirstChild();
|
|
|
476 |
if(child != null){
|
474 |
// path = new TreePath(childNode.getPath());
|
477 |
path = new TreePath(child.getPath());
|
475 |
// }
|
478 |
// now out tree will expand the first child
|
476 |
|
|
|
477 |
model.addSelectionPath(path);
|
479 |
model.addSelectionPath(path);
|
478 |
m_tree.setExpandsSelectedPaths(true);
|
480 |
m_tree.setExpandsSelectedPaths(true);
|
479 |
m_tree.setSelectionPath(path);
|
481 |
m_tree.setSelectionPath(path);
|
|
|
482 |
m_tree.scrollPathToVisible(path);
|
|
|
483 |
}
|
|
|
484 |
|
|
|
485 |
// second wave
|
|
|
486 |
path = new TreePath(selectedNode.getPath());
|
|
|
487 |
// what we really wanted is to highligh the father, so, go back!
|
|
|
488 |
model.addSelectionPath(path);
|
|
|
489 |
m_tree.setExpandsSelectedPaths(true);
|
|
|
490 |
m_tree.setSelectionPath(path);
|
480 |
m_tree.scrollPathToVisible(path);
|
491 |
m_tree.scrollPathToVisible(path);
|
|
|
492 |
}
|
481 |
}
|
493 |
}
|
482 |
}
|
494 |
|
|
|
495 |
|
|
|
496 |
|
483 |
|
497 |
|
484 |
/**
|
498 |
/**
|
485 |
* Something changed on the disk, reload everything from start
|
499 |
* Something changed on the disk, reload everything from start
|
486 |
* @param tree
|
500 |
* @param tree
|
487 |
*/
|
501 |
*/
|