утренние изменения
удаление эталона и роль студента
This commit is contained in:
@@ -10,8 +10,8 @@ public class EnvironmentJson {
|
||||
name = src.name;
|
||||
value = src.value;
|
||||
}
|
||||
public EnvironmentJson(String name_in,String value_in){
|
||||
name=name_in;
|
||||
value=value_in;
|
||||
public EnvironmentJson(String name_in, String value_in) {
|
||||
name = name_in;
|
||||
value = value_in;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package _VisualDVM.GlobalData.CompilerOption.Json;
|
||||
import _VisualDVM.GlobalData.CompilerOption.CompilerOption;
|
||||
import com.google.gson.annotations.Expose;
|
||||
|
||||
import java.io.Serializable;
|
||||
public class OptionJson {
|
||||
@Expose
|
||||
public String name; //в том числе и с разделителем если есть. поиск по startswith
|
||||
@@ -11,8 +9,8 @@ public class OptionJson {
|
||||
public OptionJson(CompilerOption src) {
|
||||
this(src.name + src.parameterSeparator, src.parameterValue);
|
||||
}
|
||||
public OptionJson(String name_in, String value_in){
|
||||
name=name_in;
|
||||
value= value_in;
|
||||
public OptionJson(String name_in, String value_in) {
|
||||
name = name_in;
|
||||
value = value_in;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package _VisualDVM.GlobalData.CompilerOption.Json;
|
||||
import Common.Utils.Utils_;
|
||||
import com.google.gson.annotations.Expose;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
public class OptionsJson {
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
package _VisualDVM.GlobalData.CompilerOption.Json;
|
||||
import com.google.gson.annotations.Expose;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
public class OptionsSetJson {
|
||||
public class OptionsSetJson {
|
||||
@Expose
|
||||
public List<OptionsJson> values = new Vector<>();
|
||||
public OptionsSetJson() {
|
||||
|
||||
@@ -148,7 +148,7 @@ public class MainModule extends MainModule_<GlobalDatabase, MainUI> {
|
||||
for (PassCode code : accountRoleDependentPasses)
|
||||
getPass(code).setControlsVisible(false);
|
||||
}
|
||||
public void SetStudentPassesAccess(){
|
||||
public void SetStudentPassesAccess() {
|
||||
SetUserPassesAccess();
|
||||
}
|
||||
public void SetDeveloperPassesAccess() {
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import Common.CommonConstants;
|
||||
import Common.Passes.Pass;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Visual.UI;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.TestingSystem.SAPFOR.SapforPackage.SapforPackage;
|
||||
|
||||
import java.util.Vector;
|
||||
public class CompareSapforPackageToEthalon extends CompareSapforPackages {
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
@@ -28,8 +25,8 @@ public class CompareSapforPackageToEthalon extends CompareSapforPackages {
|
||||
master = ethalon;
|
||||
slave = sapforPackage;
|
||||
return true;
|
||||
}else
|
||||
return UI.Question("Отмечено более одного пакета. Желаете сравнить их")&&super.canStart(args);
|
||||
} else
|
||||
return UI.Question("Отмечено более одного пакета. Желаете сравнить их") && super.canStart(args);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import Common.CommonConstants;
|
||||
import _VisualDVM.Global;
|
||||
public class DropSapforConfigurationEthalon extends EditSapforConfiguration{
|
||||
public class DropSapforConfigurationEthalon extends EditSapforConfiguration {
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/Common/icons/Clean.png";
|
||||
|
||||
@@ -45,7 +45,6 @@ public class TestPass extends Pass {
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
List<Integer> numbers = new Vector_<>(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
|
||||
|
||||
// Use parallelStream() to create a parallel stream
|
||||
ForkJoinPool commonPool = ForkJoinPool.commonPool();
|
||||
commonPool.submit(() ->
|
||||
@@ -57,7 +56,6 @@ public class TestPass extends Pass {
|
||||
).join();
|
||||
System.out.println("DONE");
|
||||
//----
|
||||
|
||||
DiffRowGenerator generator = DiffRowGenerator.create()
|
||||
.showInlineDiffs(true)
|
||||
.inlineDiffByWord(true)
|
||||
@@ -67,7 +65,6 @@ public class TestPass extends Pass {
|
||||
List<DiffRow> rows = generator.generateDiffRows(
|
||||
Arrays.asList("This is a test senctence.", "This is the second line.", "And here is the finish."),
|
||||
Arrays.asList("This is a test for diffutils.", "This is the second line."));
|
||||
|
||||
System.out.println("|original|new|");
|
||||
System.out.println("|--------|---|");
|
||||
for (DiffRow row : rows) {
|
||||
|
||||
@@ -361,8 +361,7 @@ public enum PassCode implements PassCode_ {
|
||||
ComponentsServerBackUp,
|
||||
TestingServerBackUp,
|
||||
CompareDVMRunTaskToEthalon,
|
||||
DropSapforConfigurationEthalon
|
||||
;
|
||||
DropSapforConfigurationEthalon;
|
||||
//--
|
||||
@Override
|
||||
public String getDescription() {
|
||||
|
||||
@@ -5,7 +5,6 @@ import _VisualDVM.TestingSystem.DVM.DVMCompilationOptionsSet.DVMCompilationOptio
|
||||
import _VisualDVM.TestingSystem.DVM.DVMEnvironment.DVMEnvironment;
|
||||
import _VisualDVM.TestingSystem.DVM.DVMEnvironmentsSet.DVMEnvironmentsSet;
|
||||
import _VisualDVM.TestingSystem.DVM.DVMSettings.DVMSettings;
|
||||
import javafx.util.Pair;
|
||||
|
||||
import java.util.Vector;
|
||||
public class DVMSettingsCache extends VisualCache {
|
||||
@@ -16,10 +15,10 @@ public class DVMSettingsCache extends VisualCache {
|
||||
//-->>
|
||||
Vector<String> optionsSummary_ = new Vector<>();
|
||||
Vector<DVMCompilationOptionsSet> optionsSets = Global.testingServer.db.getVectorByFK(dvmSettings, DVMCompilationOptionsSet.class);
|
||||
for (DVMCompilationOptionsSet optionsSet: optionsSets){
|
||||
for (DVMCompilationOptionsSet optionsSet : optionsSets) {
|
||||
Vector<String> optionsValues = new Vector<>();
|
||||
Vector<DVMCompilationOption> options = Global.testingServer.db.getVectorByFK(optionsSet, DVMCompilationOption.class);
|
||||
for (DVMCompilationOption option: options){
|
||||
for (DVMCompilationOption option : options) {
|
||||
optionsValues.add(option.print());
|
||||
}
|
||||
optionsSummary_.add(String.join(" ", optionsValues));
|
||||
@@ -27,11 +26,11 @@ public class DVMSettingsCache extends VisualCache {
|
||||
optionsSummary = String.join(";\n", optionsSummary_);
|
||||
//-->>
|
||||
Vector<String> environmentsSummary_ = new Vector<>();
|
||||
Vector<DVMEnvironmentsSet> environmentsSets = Global.testingServer.db.getVectorByFK(dvmSettings,DVMEnvironmentsSet.class);
|
||||
for (DVMEnvironmentsSet environmentsSet: environmentsSets){
|
||||
Vector<DVMEnvironmentsSet> environmentsSets = Global.testingServer.db.getVectorByFK(dvmSettings, DVMEnvironmentsSet.class);
|
||||
for (DVMEnvironmentsSet environmentsSet : environmentsSets) {
|
||||
Vector<String> environmentsValues = new Vector<>();
|
||||
Vector<DVMEnvironment> environments = Global.testingServer.db.getVectorByFK(environmentsSet, DVMEnvironment.class);
|
||||
for (DVMEnvironment environment: environments){
|
||||
for (DVMEnvironment environment : environments) {
|
||||
environmentsValues.add(environment.print());
|
||||
}
|
||||
environmentsSummary_.add(String.join(" ", environmentsValues));
|
||||
|
||||
@@ -105,6 +105,18 @@ public class TestsDatabase extends SQLiteDatabase {
|
||||
public TestsDatabase() {
|
||||
super(Paths.get(System.getProperty("user.dir"), "Data", Constants.tests_db_name + ".sqlite").toFile());
|
||||
}
|
||||
public static String printOptionsLine(Vector<DVMCompilationOption> options) {
|
||||
Vector<String> res = new Vector<>();
|
||||
for (DVMCompilationOption option : options)
|
||||
res.add(option.print());
|
||||
return String.join(" ", res);
|
||||
}
|
||||
public static String printEnvironmentsLine(Vector<DVMEnvironment> environments) {
|
||||
Vector<String> res = new Vector<>();
|
||||
for (DVMEnvironment environment : environments)
|
||||
res.add(environment.print());
|
||||
return String.join(" ", res);
|
||||
}
|
||||
@Override
|
||||
protected void initAllTables() throws Exception {
|
||||
addTable(groups = new GroupsDBTable());
|
||||
@@ -702,18 +714,6 @@ public class TestsDatabase extends SQLiteDatabase {
|
||||
Commit();
|
||||
*/
|
||||
}
|
||||
public static String printOptionsLine(Vector<DVMCompilationOption> options) {
|
||||
Vector<String> res = new Vector<>();
|
||||
for (DVMCompilationOption option : options)
|
||||
res.add(option.print());
|
||||
return String.join(" ", res);
|
||||
}
|
||||
public static String printEnvironmentsLine(Vector<DVMEnvironment> environments) {
|
||||
Vector<String> res = new Vector<>();
|
||||
for (DVMEnvironment environment : environments)
|
||||
res.add(environment.print());
|
||||
return String.join(" ", res);
|
||||
}
|
||||
public Vector<Pair<String, String>> getTasksParameters(DVMSettings dvmSettings_in) {
|
||||
//уравниваем количество наборов опций и окружений и сопоставляем 1 к 1
|
||||
Vector<Pair<String, String>> res = new Vector<>();
|
||||
|
||||
@@ -5,22 +5,23 @@ import Common.Database.Objects.iDBObject;
|
||||
import Common.Utils.Utils_;
|
||||
public class DVMCompilationOption extends iDBObject {
|
||||
public String name = "";
|
||||
public String value= "";
|
||||
public String value = "";
|
||||
public int dvmcompilationoptionsset_id = CommonConstants.Nan;
|
||||
public DVMCompilationOption(String name_in, String value_in) {
|
||||
name = name_in;
|
||||
value = value_in;
|
||||
}
|
||||
public DVMCompilationOption() {
|
||||
}
|
||||
@Override
|
||||
public void SynchronizeFields(DBObject src) {
|
||||
super.SynchronizeFields(src);
|
||||
DVMCompilationOption src_ = (DVMCompilationOption) src;
|
||||
name = src_.name;
|
||||
value=src_.value;
|
||||
value = src_.value;
|
||||
dvmcompilationoptionsset_id = src_.dvmcompilationoptionsset_id;
|
||||
}
|
||||
public DVMCompilationOption(){}
|
||||
public String print(){
|
||||
return name + (value.contains(" ") ? Utils_.DQuotes(value) : value);
|
||||
public String print() {
|
||||
return name + (value.contains(" ") ? Utils_.DQuotes(value) : value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,5 @@
|
||||
package _VisualDVM.TestingSystem.DVM.DVMCompilationOption;
|
||||
import Common.Database.Objects.DBObject;
|
||||
import Common.Database.Tables.FKBehaviour;
|
||||
import Common.Database.Tables.FKCurrentObjectBehaviuor;
|
||||
import Common.Database.Tables.FKDataBehaviour;
|
||||
import Common.Database.Tables.iDBTable;
|
||||
import _VisualDVM.TestingSystem.DVM.DVMCompilationOptionsSet.DVMCompilationOptionsSet;
|
||||
import _VisualDVM.TestingSystem.DVM.DVMConfigurationSettings.DVMConfigurationSettings;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
public class DVMCompilationOptionsDBTable extends iDBTable<DVMCompilationOption> {
|
||||
public DVMCompilationOptionsDBTable() {
|
||||
super(DVMCompilationOption.class);
|
||||
|
||||
@@ -11,15 +11,15 @@ public class DVMCompilationOptionsSet extends iDBObject {
|
||||
public int dvmsettings_id = CommonConstants.Nan;
|
||||
@Description("IGNORE")
|
||||
public Vector<DVMCompilationOption> options = null;
|
||||
public DVMCompilationOptionsSet() {
|
||||
}
|
||||
public DVMCompilationOptionsSet(DVMSettings settings_in) {
|
||||
dvmsettings_id = settings_in.id;
|
||||
}
|
||||
@Override
|
||||
public void SynchronizeFields(DBObject src) {
|
||||
super.SynchronizeFields(src);
|
||||
DVMCompilationOptionsSet src_ = (DVMCompilationOptionsSet) src;
|
||||
dvmsettings_id = src_.dvmsettings_id;
|
||||
}
|
||||
public DVMCompilationOptionsSet() {
|
||||
}
|
||||
public DVMCompilationOptionsSet(DVMSettings settings_in) {
|
||||
dvmsettings_id = settings_in.id;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,10 +4,8 @@ import Common.Database.Tables.FKBehaviour;
|
||||
import Common.Database.Tables.FKCurrentObjectBehaviuor;
|
||||
import Common.Database.Tables.FKDataBehaviour;
|
||||
import Common.Database.Tables.iDBTable;
|
||||
import Common.Visual.DataSetControlForm;
|
||||
import _VisualDVM.TestingSystem.DVM.DVMCompilationOption.DVMCompilationOption;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.LinkedHashMap;
|
||||
public class DVMCompilationOptionsSetsDBTable extends iDBTable<DVMCompilationOptionsSet> {
|
||||
public DVMCompilationOptionsSetsDBTable() {
|
||||
|
||||
@@ -11,6 +11,8 @@ public class DVMEnvironment extends iDBObject {
|
||||
name = name_in;
|
||||
value = value_in;
|
||||
}
|
||||
public DVMEnvironment() {
|
||||
}
|
||||
@Override
|
||||
public void SynchronizeFields(DBObject src) {
|
||||
super.SynchronizeFields(src);
|
||||
@@ -19,8 +21,6 @@ public class DVMEnvironment extends iDBObject {
|
||||
value = src_.value;
|
||||
dvmenvironmentsset_id = src_.dvmenvironmentsset_id;
|
||||
}
|
||||
public DVMEnvironment() {
|
||||
}
|
||||
public String print() {
|
||||
return name + "=" + Utils_.DQuotes(value);
|
||||
}
|
||||
|
||||
@@ -1,12 +1,5 @@
|
||||
package _VisualDVM.TestingSystem.DVM.DVMEnvironment;
|
||||
import Common.Database.Objects.DBObject;
|
||||
import Common.Database.Tables.FKBehaviour;
|
||||
import Common.Database.Tables.FKCurrentObjectBehaviuor;
|
||||
import Common.Database.Tables.FKDataBehaviour;
|
||||
import Common.Database.Tables.iDBTable;
|
||||
import _VisualDVM.TestingSystem.DVM.DVMCompilationOption.DVMCompilationOption;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
public class DVMEnvironmentsDBTable extends iDBTable<DVMEnvironment> {
|
||||
public DVMEnvironmentsDBTable() {
|
||||
super(DVMEnvironment.class);
|
||||
|
||||
@@ -8,19 +8,18 @@ import com.sun.org.glassfish.gmbal.Description;
|
||||
|
||||
import java.util.Vector;
|
||||
public class DVMEnvironmentsSet extends iDBObject {
|
||||
public int dvmsettings_id=CommonConstants.Nan;
|
||||
public int dvmsettings_id = CommonConstants.Nan;
|
||||
@Description("IGNORE")
|
||||
public Vector<DVMEnvironment> environments = null;
|
||||
public DVMEnvironmentsSet(DVMSettings dvmSettings){
|
||||
public DVMEnvironmentsSet(DVMSettings dvmSettings) {
|
||||
dvmsettings_id = dvmSettings.id;
|
||||
}
|
||||
public DVMEnvironmentsSet(){
|
||||
|
||||
public DVMEnvironmentsSet() {
|
||||
}
|
||||
@Override
|
||||
public void SynchronizeFields(DBObject src) {
|
||||
super.SynchronizeFields(src);
|
||||
DVMEnvironmentsSet src_= (DVMEnvironmentsSet) src;
|
||||
DVMEnvironmentsSet src_ = (DVMEnvironmentsSet) src;
|
||||
dvmsettings_id = src_.dvmsettings_id;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,8 +11,6 @@ import _VisualDVM.GlobalData.Machine.Machine;
|
||||
import _VisualDVM.GlobalData.Machine.MachineType;
|
||||
import _VisualDVM.GlobalData.Tasks.TaskState;
|
||||
import _VisualDVM.GlobalData.User.User;
|
||||
import _VisualDVM.ServerObjectsCache.DVMSettingsCache;
|
||||
import _VisualDVM.ServerObjectsCache.VisualCaches;
|
||||
import _VisualDVM.TestingSystem.Common.Configuration.Configuration;
|
||||
import _VisualDVM.TestingSystem.Common.Group.Group;
|
||||
import _VisualDVM.TestingSystem.Common.TasksPackageState;
|
||||
|
||||
@@ -18,6 +18,6 @@ public class DVMPackageConfiguration extends iDBObject {
|
||||
super.SynchronizeFields(src);
|
||||
DVMPackageConfiguration src_ = (DVMPackageConfiguration) src;
|
||||
dvmconfiguration_id = src_.dvmconfiguration_id;
|
||||
dvmpackage_id =src_.dvmpackage_id;
|
||||
dvmpackage_id = src_.dvmpackage_id;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package _VisualDVM.TestingSystem.DVM.DVMSettings;
|
||||
import Common.Database.Objects.DBObject;
|
||||
import _VisualDVM.GlobalData.CompilerEnvironment.Json.EnvironmentsSetJson;
|
||||
import _VisualDVM.GlobalData.CompilerOption.Json.OptionsSetJson;
|
||||
import _VisualDVM.GlobalData.RunConfiguration.RunConfiguration;
|
||||
import _VisualDVM.TestingSystem.Common.Settings.Settings;
|
||||
import com.sun.org.glassfish.gmbal.Description;
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
package _VisualDVM.TestingSystem.DVM.DVMSettings.UI;
|
||||
import Common.MainModule_;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Visual.TextField.StyledTextField;
|
||||
import Common.Visual.Windows.Dialog.DialogFields;
|
||||
import _VisualDVM.GlobalData.CompilerEnvironment.EnvironmentsLinesSet;
|
||||
import _VisualDVM.GlobalData.CompilerEnvironment.Json.EnvironmentsSetJson;
|
||||
import _VisualDVM.GlobalData.CompilerOption.Json.OptionsSetJson;
|
||||
import _VisualDVM.GlobalData.CompilerOption.OptionsLinesSet;
|
||||
import _VisualDVM.TestingSystem.DVM.DVMCompilationOptionsSet.DVMCompilationOptionsSet;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
@@ -9,8 +9,8 @@ public class SapforConfigurationFields implements DialogFields {
|
||||
public JTextField tfName;
|
||||
public JSpinner sTransformationMaxtime;
|
||||
public JSpinner sKernels;
|
||||
private JPanel content;
|
||||
public JCheckBox cbGroupsOnly;
|
||||
private JPanel content;
|
||||
public SapforConfigurationFields() {
|
||||
sKernels.setModel(new SpinnerNumberModel(1, 1,
|
||||
Constants.testingMaxKernels,
|
||||
|
||||
@@ -16,7 +16,7 @@ public class SapforConfigurationSettings extends iDBObject {
|
||||
@Override
|
||||
public void SynchronizeFields(DBObject src) {
|
||||
super.SynchronizeFields(src);
|
||||
SapforConfigurationSettings src_= (SapforConfigurationSettings) src;
|
||||
SapforConfigurationSettings src_ = (SapforConfigurationSettings) src;
|
||||
sapforconfiguration_id = src_.sapforconfiguration_id;
|
||||
sapforsettings_id = src_.sapforsettings_id;
|
||||
}
|
||||
|
||||
@@ -130,7 +130,7 @@ public class SapforPackagesForm extends RDataSetControlForm<SapforPackage> {
|
||||
addSeparator();
|
||||
addPasses(PassCode.AbortSapforPackage);
|
||||
addSeparator();
|
||||
addPasses(PassCode.CompareSapforPackageToEthalon,PassCode.JoinSapforTestingVersionsToGroup);
|
||||
addPasses(PassCode.CompareSapforPackageToEthalon, PassCode.JoinSapforTestingVersionsToGroup);
|
||||
addSeparator();
|
||||
addPasses(PassCode.DeleteSapforPackage);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package _VisualDVM.TestingSystem.SAPFOR.SapforPackageConfiguration;
|
||||
import Common.CommonConstants;
|
||||
import Common.Database.Objects.DBObject;
|
||||
import Common.Database.Objects.iDBObject;
|
||||
import _VisualDVM.TestingSystem.DVM.DVMPackageConfiguration.DVMPackageConfiguration;
|
||||
import _VisualDVM.TestingSystem.SAPFOR.SapforConfiguration.SapforConfiguration;
|
||||
public class SapforPackageConfiguration extends iDBObject {
|
||||
public int sapforpackage_id = CommonConstants.Nan;
|
||||
@@ -19,6 +18,6 @@ public class SapforPackageConfiguration extends iDBObject {
|
||||
super.SynchronizeFields(src);
|
||||
SapforPackageConfiguration src_ = (SapforPackageConfiguration) src;
|
||||
sapforconfiguration_id = src_.sapforconfiguration_id;
|
||||
sapforpackage_id =src_.sapforpackage_id;
|
||||
sapforpackage_id = src_.sapforpackage_id;
|
||||
}
|
||||
}
|
||||
@@ -129,7 +129,7 @@ public class MainUI extends UIModule_ {
|
||||
Global.normalProperties.AutoCheckTesting = false;
|
||||
Global.normalProperties.Update();
|
||||
}
|
||||
void showStudentRights(){
|
||||
void showStudentRights() {
|
||||
Global.mainModule.SetUserPassesAccess();
|
||||
getMainWindow().ShowStudentTabs();
|
||||
getTestingMenuBar().showServerAdminLabel(false);
|
||||
|
||||
@@ -5,10 +5,10 @@ public class VersionsComparisonMenu extends PropertiesSubmenu {
|
||||
public VersionsComparisonMenu() {
|
||||
super("Сравнение версий", null,
|
||||
Global.normalProperties,
|
||||
// "RegisterOn",
|
||||
// "SpacesOn",
|
||||
// "EmptyLinesOn",
|
||||
// "FortranWrapsOn",
|
||||
// "RegisterOn",
|
||||
// "SpacesOn",
|
||||
// "EmptyLinesOn",
|
||||
// "FortranWrapsOn",
|
||||
"ExtensionsOn",
|
||||
"ComparsionDiffMergeOn"
|
||||
);
|
||||
|
||||
@@ -15,13 +15,14 @@ import javafx.util.Pair;
|
||||
import org.fife.ui.rtextarea.RTextScrollPane;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.text.BadLocationException;
|
||||
import javax.swing.text.Highlighter;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
public abstract class ComparisonForm<T> {
|
||||
final String separator = "\u200B";
|
||||
final char cseparator = '\u200B';
|
||||
public Class<T> t; //класс объектов.
|
||||
//-->>
|
||||
public Vector<String> lines = new Vector<>(); //строки с учетом/неучетом пробелов. для сравнения
|
||||
@@ -34,6 +35,10 @@ public abstract class ComparisonForm<T> {
|
||||
protected T object = null;
|
||||
//-->>
|
||||
protected BaseEditor Body;
|
||||
//невидимый пробел https://translated.turbopages.org/proxy_u/en-ru.ru.898e1daf-67e318c0-3fccff8a-74722d776562/https/stackoverflow.com/questions/17978720/invisible-characters-ascii
|
||||
//--->>
|
||||
// protected Object ownScrollModel = null;
|
||||
protected Vector<Pair<Integer, Integer>> diffs = new Vector<>();
|
||||
//-->>
|
||||
ComparisonForm<T> this_ = null; //?
|
||||
ComparisonForm<T> slave = null;
|
||||
@@ -48,22 +53,6 @@ public abstract class ComparisonForm<T> {
|
||||
//-----
|
||||
private boolean events_on = false;//относится только к мастеру, отвечает за скроллы.
|
||||
private int current_diff_num = -1;
|
||||
final String separator = "\u200B";
|
||||
final char cseparator = '\u200B';
|
||||
//невидимый пробел https://translated.turbopages.org/proxy_u/en-ru.ru.898e1daf-67e318c0-3fccff8a-74722d776562/https/stackoverflow.com/questions/17978720/invisible-characters-ascii
|
||||
//--->>
|
||||
// protected Object ownScrollModel = null;
|
||||
protected Vector<Pair<Integer, Integer>> diffs = new Vector<>();
|
||||
//---<<
|
||||
private void ShowCurrentDiff() {
|
||||
try {
|
||||
int diff_line = Body.getLineOfOffset(diffs.get(current_diff_num).getKey());
|
||||
Body.gotoLine_(diff_line);
|
||||
}
|
||||
catch (Exception ex){
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
public ComparisonForm(Class<T> t_in, ComparisonForm<T> slave_in) {
|
||||
//-
|
||||
Body = new BaseEditor();
|
||||
@@ -130,6 +119,15 @@ public abstract class ComparisonForm<T> {
|
||||
}
|
||||
});
|
||||
}
|
||||
//---<<
|
||||
private void ShowCurrentDiff() {
|
||||
try {
|
||||
int diff_line = Body.getLineOfOffset(diffs.get(current_diff_num).getKey());
|
||||
Body.gotoLine_(diff_line);
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
public JPanel getContent() {
|
||||
return content;
|
||||
}
|
||||
@@ -176,7 +174,7 @@ public abstract class ComparisonForm<T> {
|
||||
protected void Compare() throws Exception {
|
||||
events_on = false;
|
||||
current_diff_num = CommonConstants.Nan;
|
||||
slave.current_diff_num =CommonConstants.Nan;
|
||||
slave.current_diff_num = CommonConstants.Nan;
|
||||
//-----------------------------------------------------------------------------------------------
|
||||
Body.setText("");
|
||||
slave.Body.setText("");
|
||||
@@ -217,31 +215,30 @@ public abstract class ComparisonForm<T> {
|
||||
diffs.clear();
|
||||
boolean flag = false;
|
||||
char[] chars = Body.getText().toCharArray();
|
||||
int dif_start=CommonConstants.Nan;
|
||||
int dif_end=CommonConstants.Nan;
|
||||
int dif_start = CommonConstants.Nan;
|
||||
int dif_end = CommonConstants.Nan;
|
||||
for (int i = 0; i < chars.length; ++i) {
|
||||
char c = chars[i];
|
||||
//--
|
||||
if (flag) {
|
||||
//различие
|
||||
switch (c){
|
||||
switch (c) {
|
||||
case cseparator:
|
||||
//кончилось различие
|
||||
dif_end =i;
|
||||
flag=false;
|
||||
diffs.add(new Pair<>(dif_start,dif_end));
|
||||
dif_start=CommonConstants.Nan;
|
||||
dif_end=CommonConstants.Nan;
|
||||
dif_end = i;
|
||||
flag = false;
|
||||
diffs.add(new Pair<>(dif_start, dif_end));
|
||||
dif_start = CommonConstants.Nan;
|
||||
dif_end = CommonConstants.Nan;
|
||||
break;
|
||||
}
|
||||
|
||||
} else {
|
||||
//поиск
|
||||
switch (c) {
|
||||
case cseparator:
|
||||
//началось различие
|
||||
dif_start =i;
|
||||
flag=true;
|
||||
dif_start = i;
|
||||
flag = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -249,18 +246,18 @@ public abstract class ComparisonForm<T> {
|
||||
}
|
||||
}
|
||||
if (!diffs.isEmpty())
|
||||
current_diff_num=0;
|
||||
current_diff_num = 0;
|
||||
}
|
||||
public void colorDiffs() throws Exception{
|
||||
Highlighter.HighlightPainter painter = isMaster()? SPFEditor.RedTextPainter: SPFEditor.GreenTextPainter;
|
||||
for (Pair<Integer, Integer> diff: diffs){
|
||||
Body.getHighlighter().addHighlight(diff.getKey(),diff.getValue(), painter);
|
||||
public void colorDiffs() throws Exception {
|
||||
Highlighter.HighlightPainter painter = isMaster() ? SPFEditor.RedTextPainter : SPFEditor.GreenTextPainter;
|
||||
for (Pair<Integer, Integer> diff : diffs) {
|
||||
Body.getHighlighter().addHighlight(diff.getKey(), diff.getValue(), painter);
|
||||
}
|
||||
}
|
||||
public void Show() throws Exception {
|
||||
events_on = false;
|
||||
current_diff_num = CommonConstants.Nan;
|
||||
slave.current_diff_num =CommonConstants.Nan;
|
||||
slave.current_diff_num = CommonConstants.Nan;
|
||||
//----------------------------------------------------------------------------------------------
|
||||
Body.setText("");
|
||||
slave.Body.setText("");
|
||||
|
||||
Reference in New Issue
Block a user