промежуточный. небольшой рефакторинг. наследие DBProjectFile от ProjectFile.
This commit is contained in:
@@ -2,81 +2,18 @@ package SapforTestingSystem.SapforTasksPackage;
|
||||
import Common.Constants;
|
||||
import Common.Global;
|
||||
import Common.Utils.Utils;
|
||||
import ProjectData.Files.DBProjectFile;
|
||||
import ProjectData.Files.FileType;
|
||||
import SapforTestingSystem.Json.SapforTasksResults_json;
|
||||
import SapforTestingSystem.Json.SapforVersion_json;
|
||||
import SapforTestingSystem.SapforTask.SapforTask;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
|
||||
import javax.swing.tree.DefaultMutableTreeNode;
|
||||
import java.io.File;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Vector;
|
||||
public class SapforTasksPackageInterface {
|
||||
public static File getPackageArchive(SapforTasksPackage package_in) {
|
||||
return new File(Global.SapforPackagesDirectory, package_in.id + ".zip");
|
||||
}
|
||||
public static Vector<DBProjectFile> getProjectFiles(String dir_in) {
|
||||
Vector<DBProjectFile> res = new Vector<>();
|
||||
//получить список файлов которые могут быть файлами проекта в заданной папке
|
||||
//гарантированно нет вложенных.
|
||||
File dir = new File(dir_in);
|
||||
File[] files = dir.listFiles();
|
||||
//-
|
||||
if (files != null) {
|
||||
for (File file : files) {
|
||||
if (file.isFile()) {
|
||||
DBProjectFile projectFile = new DBProjectFile();
|
||||
projectFile.file = file;
|
||||
projectFile.AutoDetectProperties();
|
||||
if (!projectFile.fileType.equals(FileType.forbidden)) {
|
||||
res.add(projectFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
public static Vector<DefaultMutableTreeNode> getTaskConfigurationDescription(SapforTask task) {
|
||||
Vector<DefaultMutableTreeNode> res = new Vector<>();
|
||||
DefaultMutableTreeNode codesNode = new DefaultMutableTreeNode("Проходы");
|
||||
Vector<String> codes = new Vector<>(Arrays.asList(task.codes.split(" ")));
|
||||
for (String code_s : codes)
|
||||
codesNode.add(new DefaultMutableTreeNode(PassCode_2021.valueOf(code_s).getDescription()));
|
||||
res.add(codesNode);
|
||||
DefaultMutableTreeNode flagsNode = new DefaultMutableTreeNode("Флаги");
|
||||
flagsNode.add(new DefaultMutableTreeNode(task.flags));
|
||||
res.add(flagsNode);
|
||||
return res;
|
||||
}
|
||||
public static DefaultMutableTreeNode getTaskVersionsTree(File configurationRoot, SapforTask task) {
|
||||
DefaultMutableTreeNode root = null;
|
||||
DefaultMutableTreeNode child = null;
|
||||
DefaultMutableTreeNode parent = null;
|
||||
//--
|
||||
for (SapforVersion_json version_json : task.versions) {
|
||||
version_json.initHome(configurationRoot);
|
||||
child = new DefaultMutableTreeNode(version_json);
|
||||
if (parent == null) {
|
||||
root = child;
|
||||
parent = child;
|
||||
} else {
|
||||
parent.add(child);
|
||||
parent = child;
|
||||
}
|
||||
}
|
||||
if (parent != null) {
|
||||
for (SapforVersion_json version_json : task.variants) {
|
||||
version_json.initHome(configurationRoot);
|
||||
parent.add(new DefaultMutableTreeNode(version_json));
|
||||
}
|
||||
}
|
||||
//--
|
||||
return root;
|
||||
}
|
||||
public static DefaultMutableTreeNode getTreeRoot(SapforTasksPackage package_in) {
|
||||
|
||||
SapforTasksResults_json results_json = getLocalResults(package_in);
|
||||
@@ -100,8 +37,7 @@ public class SapforTasksPackageInterface {
|
||||
*/
|
||||
DefaultMutableTreeNode taskNode = new DefaultMutableTreeNode(task.test_description);
|
||||
//--
|
||||
taskNode.add(getTaskVersionsTree(
|
||||
new File(getLocalWorkspace(package_in), configuration_id), task));
|
||||
taskNode.add(task.getVersionsTree(new File(getLocalWorkspace(package_in), configuration_id)));
|
||||
//--
|
||||
groupNode.add(taskNode);
|
||||
}
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
package SapforTestingSystem.SapforTasksPackage;
|
||||
import Common.Current;
|
||||
import Common.UI.Trees.DataTree;
|
||||
import Common.UI.UI;
|
||||
import ProjectData.Files.DBProjectFile;
|
||||
import SapforTestingSystem.Json.SapforVersion_json;
|
||||
|
||||
import javax.swing.tree.DefaultMutableTreeNode;
|
||||
import javax.swing.tree.TreePath;
|
||||
import java.io.File;
|
||||
public class SapforTasksPackageTree extends DataTree {
|
||||
Current current;
|
||||
public SapforTasksPackageTree(DefaultMutableTreeNode root_in, Current current_in) {
|
||||
@@ -30,18 +28,11 @@ public class SapforTasksPackageTree extends DataTree {
|
||||
public void SelectionAction(TreePath e) {
|
||||
System.out.println("Select");
|
||||
DefaultMutableTreeNode node = (DefaultMutableTreeNode) e.getLastPathComponent();
|
||||
Current.set(Current.ProjectNode, node);
|
||||
// Current.set(Current.ProjectNode, node);
|
||||
Object o = node.getUserObject();
|
||||
if (o instanceof File) {
|
||||
Current.set(Current.SelectedDirectory, o);
|
||||
Current.set(Current.SelectedFile, null);
|
||||
UI.getMainWindow().getProjectWindow().ShowNoSelectedFile();
|
||||
} else if (o instanceof DBProjectFile) {
|
||||
Current.set(Current.SelectedFile, o);
|
||||
File file = ((DBProjectFile) o).file;
|
||||
Current.set(Current.SelectedDirectory, file.getParentFile());
|
||||
UI.getMainWindow().getProjectWindow().ShowSelectedFile();
|
||||
if (o instanceof SapforVersion_json) {
|
||||
Current.set(current, o);
|
||||
System.out.println(((SapforVersion_json)o).Home);
|
||||
}
|
||||
UI.getMainWindow().getProjectWindow().ShowSelectedDirectory();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user