|
a/tool/src/GUI/swingUtils.java |
|
b/tool/src/GUI/swingUtils.java |
|
... |
|
... |
212 |
node.nodeType = nodeType;
|
212 |
node.nodeType = nodeType;
|
213 |
node.id = title;
|
213 |
node.id = title;
|
214 |
return node;
|
214 |
return node;
|
215 |
}
|
215 |
}
|
216 |
|
216 |
|
|
|
217 |
|
|
|
218 |
|
|
|
219 |
/**
|
|
|
220 |
* Add the basic root node to a treeview
|
|
|
221 |
* @param tree The treeview that we want to target
|
|
|
222 |
*/
|
|
|
223 |
public static void nodeAddRoot(JTree tree){
|
|
|
224 |
// tree hook
|
|
|
225 |
tree.setCellRenderer(new TreeRenderer());
|
|
|
226 |
//Create the nodes.
|
|
|
227 |
TreeNodeSPDX nodeRoot =
|
|
|
228 |
new TreeNodeSPDX("root");
|
|
|
229 |
nodeRoot.id = "Root";
|
|
|
230 |
DefaultTreeModel treeModel = new DefaultTreeModel(nodeRoot);
|
|
|
231 |
tree.setModel(treeModel);
|
|
|
232 |
}
|
|
|
233 |
|
|
|
234 |
|
217 |
/**
|
235 |
/**
|
218 |
* List all the indexed SPDX documents on the tree view
|
236 |
* List all the indexed SPDX documents on the tree view
|
219 |
* @param tree where all items are listed
|
237 |
* @param tree where all items are listed
|
220 |
* @param spdxList Array with all SPDXfile objects to be listed
|
|
|
221 |
*/
|
238 |
*/
|
222 |
public static void populateTree(JTree tree){
|
239 |
public static void populateTree(JTree tree){
|
223 |
// tree hook
|
240 |
// tree hook
|
224 |
tree.setCellRenderer(new TreeRenderer());
|
241 |
tree.setCellRenderer(new TreeRenderer());
|
225 |
//Create the nodes.
|
242 |
//Create the nodes.
|
|
... |
|
... |
469 |
* @param tree
|
486 |
* @param tree
|
470 |
*/
|
487 |
*/
|
471 |
public static void refreshAll(JTree tree, String UID){
|
488 |
public static void refreshAll(JTree tree, String UID){
|
472 |
// find all components inside our common library
|
489 |
// find all components inside our common library
|
473 |
File baseFolder = new File(".");
|
490 |
File baseFolder = new File(".");
|
474 |
core.components = actions.findSPDX(new File(baseFolder,
|
491 |
// core.components = actions.findSPDX(new File(baseFolder,
|
475 |
is.library));
|
492 |
// is.library));
|
476 |
// now find our products
|
493 |
// now find our products
|
477 |
core.products = actions.findSPDX(new File(baseFolder,
|
494 |
core.products = actions.findSPDX(new File(baseFolder,
|
478 |
is.products));
|
495 |
is.products));
|
479 |
|
496 |
|
480 |
// get the current UID of the selected node
|
497 |
// get the current UID of the selected node
|
|
... |
|
... |
512 |
return;
|
529 |
return;
|
513 |
}
|
530 |
}
|
514 |
// All done, let's leave
|
531 |
// All done, let's leave
|
515 |
log.write(is.INFO, Messages.TreeNodeChanged, node.getUID());
|
532 |
log.write(is.INFO, Messages.TreeNodeChanged, node.getUID());
|
516 |
}
|
533 |
}
|
|
|
534 |
|
|
|
535 |
|
517 |
|
536 |
|
518 |
/////////////////////////////////////////////////////////////////////////
|
537 |
/////////////////////////////////////////////////////////////////////////
|
519 |
// Things related to show the SPDX text on the text area
|
538 |
// Things related to show the SPDX text on the text area
|
520 |
|
539 |
|
521 |
/**
|
540 |
/**
|
|
... |
|
... |
715 |
System.err.println("META error: Nothing was done");
|
734 |
System.err.println("META error: Nothing was done");
|
716 |
//System.err.println(textHTML);
|
735 |
//System.err.println(textHTML);
|
717 |
return null;
|
736 |
return null;
|
718 |
}
|
737 |
}
|
719 |
|
738 |
|
|
|
739 |
/**
|
|
|
740 |
* Returns the node that is the root of a given treeview
|
|
|
741 |
* @param tree JTree object where all nodes are placed
|
|
|
742 |
* @return the root node or null if it does not exist
|
|
|
743 |
*/
|
|
|
744 |
public static TreeNodeSPDX getRootNode(JTree tree){
|
|
|
745 |
// avoid empty null objects when there is nothing on the tree
|
|
|
746 |
if(tree.getModel().getRoot()==null){
|
|
|
747 |
return null;
|
|
|
748 |
}
|
|
|
749 |
TreeNodeSPDX nodeRoot = (TreeNodeSPDX) tree.getModel().getRoot();
|
|
|
750 |
return nodeRoot;
|
|
|
751 |
}
|
720 |
|
752 |
|
721 |
}
|
753 |
}
|