реализовал сохранение пути при экспорте в эксель, и при сохранении изображения графа функций.
This commit is contained in:
@@ -19,11 +19,13 @@ public class NormalProperties extends VisualDVMProperties {
|
||||
public boolean OfferRegistrationOnStart=true;
|
||||
//--->
|
||||
@Expose
|
||||
public String Workspace = "";
|
||||
public String Workspace = ""; // место хранения проектов, и загруженных проектов
|
||||
@Expose
|
||||
public String ProjectsSearchDirectory = "";
|
||||
public String ProjectsSearchDirectory = ""; //место последнего открытия проектов
|
||||
@Expose
|
||||
public String VisualiserPath = "";
|
||||
public String DocumentsDirectory = ""; //место сохранения документов,например скрина графа функций или Excel
|
||||
@Expose
|
||||
public String VisualiserPath = ""; //места ручной установки компонентов. ( мб объединить с documents directory?)
|
||||
@Expose
|
||||
public String Sapfor_FPath = "";
|
||||
@Expose
|
||||
@@ -115,7 +117,7 @@ public class NormalProperties extends VisualDVMProperties {
|
||||
public String getFieldDescription(String fieldName) {
|
||||
switch (fieldName) {
|
||||
case "OfferRegistrationOnStart":
|
||||
return "Предложение регистрации при запуске";
|
||||
return "Проверка регистрации";
|
||||
case "Email":
|
||||
return "Адрес электронной почты";
|
||||
case "Kernels":
|
||||
|
||||
@@ -25,7 +25,7 @@ public class CreateGroupFromDirectory extends PublishTests {
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
Utils.RestoreSelectedDirectory(directoryChooser);
|
||||
Utils.ChooserProjectsSearchDirectory(directoryChooser);
|
||||
File dir = directoryChooser.ShowDialog();
|
||||
if (dir == null) {
|
||||
Log.Writeln_("Папка не выбрана");
|
||||
|
||||
@@ -22,7 +22,7 @@ public class CreateGroupFromFiles extends PublishTests {
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
Utils.RestoreSelectedDirectory(fileChooser);
|
||||
Utils.ChooserProjectsSearchDirectory(fileChooser);
|
||||
Vector<File> files = fileChooser.ShowMultiDialog();
|
||||
if (files.isEmpty()) {
|
||||
Log.Writeln_("Не выбрано ни одного файла.");
|
||||
|
||||
@@ -3,12 +3,10 @@ import Common.Passes.Pass;
|
||||
import Common.Passes.PassException;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Visual.Windows.Dialog.VDirectoryChooser;
|
||||
import _VisualDVM.ComponentsServer.Component.Sapfor.Sapfor;
|
||||
import _VisualDVM.Constants;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
import _VisualDVM.ProjectData.Files.ProjectFile;
|
||||
import _VisualDVM.ProjectData.LanguageName;
|
||||
import _VisualDVM.TestingSystem.Common.Group.Group;
|
||||
import _VisualDVM.TestingSystem.Common.Test.Test;
|
||||
import _VisualDVM.Utils;
|
||||
@@ -44,7 +42,7 @@ public class CreateTestFromDirectory extends Pass<Test> {
|
||||
}
|
||||
protected boolean selectFiles() {
|
||||
VDirectoryChooser directoryChooser = new VDirectoryChooser("Выбор домашней папки теста");
|
||||
Utils.RestoreSelectedDirectory(directoryChooser);
|
||||
Utils.ChooserProjectsSearchDirectory(directoryChooser);
|
||||
dir = directoryChooser.ShowDialog();
|
||||
if (dir == null) {
|
||||
Log.Writeln_("Папка не выбрана.");
|
||||
|
||||
@@ -12,7 +12,7 @@ public class CreateTestFromSelectedFiles extends CreateTestFromDirectory {
|
||||
@Override
|
||||
protected boolean selectFiles() {
|
||||
VFileChooser files_chooser = new VFileChooser("Выбор файлов");
|
||||
Utils.RestoreSelectedDirectory(files_chooser);
|
||||
Utils.ChooserProjectsSearchDirectory(files_chooser);
|
||||
Vector<File> res = files_chooser.ShowMultiDialog();
|
||||
dir = files_chooser.getCurrentDirectory();
|
||||
if (res.isEmpty()) {
|
||||
|
||||
@@ -19,7 +19,7 @@ public class CreateTestsFromFiles extends PublishTests {
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
if (Global.testingServer.db.groups.getUI().canModifyCurrent(Log)) {
|
||||
Utils.RestoreSelectedDirectory(fileChooser);
|
||||
Utils.ChooserProjectsSearchDirectory(fileChooser);
|
||||
Vector<File> files = fileChooser.ShowMultiDialog();
|
||||
if (files.isEmpty()) {
|
||||
Log.Writeln_("Не выбрано ни одного файла.");
|
||||
|
||||
@@ -82,11 +82,13 @@ public class ExportDVMPackageToExcel extends Pass<Vector<DVMPackage>> {
|
||||
}
|
||||
if (!Log.isEmpty())
|
||||
return false;
|
||||
Utils.ChooseDocumentsDirectory(directoryChooser);
|
||||
dir = directoryChooser.ShowDialog();
|
||||
if (dir == null) {
|
||||
Log.Writeln_("Папка не выбрана.");
|
||||
return false;
|
||||
}
|
||||
Global.mainModule.getPass(PassCode.UpdateProperty).Do("DocumentsDirectory", dir.getAbsolutePath());
|
||||
res = new File(dir, Utils_.getDateName("packages") + ".xls");
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ public class OpenCurrentProject extends Pass<db_project_info> {
|
||||
dir = null;
|
||||
target = null;
|
||||
if (args.length == 0) {
|
||||
Utils.RestoreSelectedDirectory(directoryChooser);
|
||||
Utils.ChooserProjectsSearchDirectory(directoryChooser);
|
||||
dir = directoryChooser.ShowDialog();
|
||||
} else {
|
||||
Object arg = args[0];
|
||||
|
||||
@@ -34,7 +34,7 @@ public class ReplaceTestsFromFiles extends TestingServerPass<Vector<Test>> {
|
||||
return false;
|
||||
group = Global.testingServer.db.groups.getUI().getCurrent();
|
||||
//--->>>
|
||||
Utils.RestoreSelectedDirectory(fileChooser);
|
||||
Utils.ChooserProjectsSearchDirectory(fileChooser);
|
||||
Vector<File> files = fileChooser.ShowMultiDialog();
|
||||
//----------------ROLE is-----------------------------------------------
|
||||
//--
|
||||
|
||||
@@ -3,8 +3,11 @@ import Common.Passes.Pass;
|
||||
import Common.Passes.PassException;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Visual.UI;
|
||||
import Common.Visual.Windows.Dialog.VDirectoryChooser;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
import _VisualDVM.ProjectData.SapforData.Functions.UI.Graph.FunctionsGraphForm;
|
||||
import _VisualDVM.Utils;
|
||||
import com.mxgraph.io.mxCodec;
|
||||
import com.mxgraph.util.mxCellRenderer;
|
||||
import com.mxgraph.util.mxXmlUtils;
|
||||
@@ -19,6 +22,7 @@ import java.io.FileOutputStream;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.file.Paths;
|
||||
public class SaveGraph extends Pass<File> {
|
||||
VDirectoryChooser directoryChooser = new VDirectoryChooser("Выбор папки для сохранения скриншота графа функций");
|
||||
FunctionsGraphForm graphForm = null;
|
||||
@Override
|
||||
protected boolean needsAnimation() {
|
||||
@@ -35,14 +39,19 @@ public class SaveGraph extends Pass<File> {
|
||||
Log.Writeln_("Сначала отобразите граф");
|
||||
if (Global.mainModule.getProject().functionsGraph.isEmpty())
|
||||
Log.Writeln_("Граф процедур пуст");
|
||||
return Log.isEmpty();
|
||||
Utils.ChooseDocumentsDirectory(directoryChooser);
|
||||
File dir = directoryChooser.ShowDialog();
|
||||
if (dir == null) {
|
||||
Log.Writeln_("Папка не выбрана.");
|
||||
}else {
|
||||
Global.mainModule.getPass(PassCode.UpdateProperty).Do("DocumentsDirectory", dir.getAbsolutePath());
|
||||
target = new File(dir, Utils_.getDateName("Graph")+".png");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
target = Paths.get(Global.visualiser.getWorkspace().getAbsolutePath(), "Graph.png").toFile();
|
||||
if (target.exists() && !target.delete())
|
||||
throw new PassException("Не удается удалить предыдущий файл " + Utils_.Brackets(target.getAbsolutePath()));
|
||||
//-
|
||||
mxGraph graph = graphForm.getControl().getGraph();
|
||||
BufferedImage image = mxCellRenderer.createBufferedImage(graph,
|
||||
null, 1, Color.WHITE,
|
||||
@@ -62,6 +71,16 @@ public class SaveGraph extends Pass<File> {
|
||||
}
|
||||
@Override
|
||||
protected void showDone() throws Exception {
|
||||
UI.Info("Граф успешно сохранен в файл: " + Utils_.Brackets(target.getAbsolutePath()));
|
||||
if (UI.Question("Изображение графа процедур успешно сохранено\n"
|
||||
+ "в папке " + Utils_.Brackets(target.getParent())+"\n"
|
||||
+ "под именем "+Utils_.Brackets(target.getName())+"\n"
|
||||
+ "Открыть его"
|
||||
)){
|
||||
try {
|
||||
Desktop.getDesktop().open(target);
|
||||
} catch (Exception ex) {
|
||||
Utils_.MainLog.PrintException(ex);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ public enum PassCode implements PassCode_ {
|
||||
SPF_ExpressionSubstitution,
|
||||
SPF_InsertDvmhRegions,
|
||||
SPF_StatisticAnalyzer,
|
||||
//-
|
||||
//- Проводнике
|
||||
CombineFiles,
|
||||
EraseBadSymbols,
|
||||
CopyProject,
|
||||
|
||||
@@ -600,11 +600,16 @@ public class Utils {
|
||||
}
|
||||
return res;
|
||||
}
|
||||
public static void RestoreSelectedDirectory(VFileChooser_ directoryChooser) {
|
||||
public static void ChooserProjectsSearchDirectory(VFileChooser_ directoryChooser) {
|
||||
String last_dir_home = Global.normalProperties.ProjectsSearchDirectory;
|
||||
if (!last_dir_home.isEmpty())
|
||||
directoryChooser.SetCurrentDirectory(last_dir_home);
|
||||
}
|
||||
public static void ChooseDocumentsDirectory(VFileChooser_ directoryChooser) {
|
||||
String last_dir_home = Global.normalProperties.DocumentsDirectory;
|
||||
if (!last_dir_home.isEmpty())
|
||||
directoryChooser.SetCurrentDirectory(last_dir_home);
|
||||
}
|
||||
public static void ClearProjectData(File project_home) throws Exception {
|
||||
Utils.deleteFilesByExtensions(project_home, "dep", "proj");
|
||||
File project_data = new File(project_home, Constants.data);
|
||||
|
||||
@@ -265,7 +265,7 @@ public class MainForm extends Form implements MainWindow {
|
||||
@Override
|
||||
public void ShowUndefinedTabs()
|
||||
{
|
||||
//ничего не делаем. лишних панелей и так нет.
|
||||
//ничего не делаем. лишних панелей и так нет. экспорт
|
||||
}
|
||||
@Override
|
||||
public void ShowUserTabs() {
|
||||
|
||||
Reference in New Issue
Block a user