no message
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
package TestingSystem.SAPFOR.SapforTasksPackage.UI;
|
||||
import Common.Current;
|
||||
import Common.UI.Trees.DataTree;
|
||||
import Common.UI.Trees.TreeRenderers;
|
||||
import Common.UI.UI;
|
||||
import TestingSystem.SAPFOR.Json.SapforVersion_json;
|
||||
|
||||
import javax.swing.tree.DefaultMutableTreeNode;
|
||||
import javax.swing.tree.TreePath;
|
||||
import java.util.Vector;
|
||||
public class SapforTasksPackageTree extends DataTree {
|
||||
Current current;
|
||||
SapforTasksPackageTree slave_tree = null;
|
||||
public void setSlaveTree(SapforTasksPackageTree slave_tree_in) {
|
||||
slave_tree = slave_tree_in;
|
||||
}
|
||||
public SapforTasksPackageTree(DefaultMutableTreeNode root_in, Current current_in) {
|
||||
super(root_in);
|
||||
current = current_in;
|
||||
}
|
||||
@Override
|
||||
protected int getStartLine() {
|
||||
return 1;
|
||||
}
|
||||
@Override
|
||||
public TreeRenderers getRenderer() {
|
||||
return TreeRenderers.RendererSapforVersion;
|
||||
}
|
||||
@Override
|
||||
public Current getCurrent() {
|
||||
return current;
|
||||
}
|
||||
public void selectSamePath_r(TreePath example, int index, DefaultMutableTreeNode node, Vector<DefaultMutableTreeNode> res) {
|
||||
if (index < example.getPathCount()) {
|
||||
DefaultMutableTreeNode exampleNode = (DefaultMutableTreeNode) example.getPathComponent(index);
|
||||
if (exampleNode.toString().equals(node.toString())) {
|
||||
res.add(node);
|
||||
for (int i = 0; i < node.getChildCount(); ++i)
|
||||
selectSamePath_r(example, index + 1, (DefaultMutableTreeNode) node.getChildAt(i), res);
|
||||
}
|
||||
}
|
||||
}
|
||||
public void selectSamePath(TreePath path_in) {
|
||||
Vector<DefaultMutableTreeNode> pathNodes = new Vector<>();
|
||||
selectSamePath_r(path_in, 0, root, pathNodes);
|
||||
if (!pathNodes.isEmpty()) {
|
||||
TreePath path = new TreePath(pathNodes.toArray());
|
||||
setSelectionPath(path);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void SelectionAction(TreePath e) {
|
||||
DefaultMutableTreeNode node = (DefaultMutableTreeNode) e.getLastPathComponent();
|
||||
Object o = node.getUserObject();
|
||||
//---
|
||||
if (slave_tree != null) {
|
||||
slave_tree.selectSamePath(e);
|
||||
}
|
||||
//---
|
||||
if (o instanceof SapforVersion_json) {
|
||||
SapforVersion_json version = (SapforVersion_json) o;
|
||||
Current.set(current, version);
|
||||
if (current.equals(Current.SapforEtalonVersion))
|
||||
UI.getMainWindow().getTestingWindow().ShowCurrentSapforPackageVersionEtalon();
|
||||
else
|
||||
UI.getMainWindow().getTestingWindow().ShowCurrentSapforPackageVersion();
|
||||
//--
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user