промежуточный. Добавлен объект файла баг-репорта.

This commit is contained in:
2025-12-23 21:17:28 +03:00
parent 07760fe410
commit 37f34b3462
7 changed files with 86 additions and 9 deletions

View File

@@ -6,6 +6,7 @@ import Common.Database.Tables.FKDataBehaviour;
import Common.Database.Tables.iDBTable;
import Common.Visual.DataSetControlForm;
import _VisualDVM.ComponentsServer.BugReport.UI.BugReportsForm;
import _VisualDVM.ComponentsServer.BugReportFile.BugReportFile;
import _VisualDVM.ComponentsServer.BugReportRecipient.BugReportRecipient;
import _VisualDVM.ComponentsServer.BugReportSetting.BugReportSetting;
@@ -37,6 +38,7 @@ public class BugReportsDBTable extends iDBTable<BugReport> {
LinkedHashMap<Class<? extends DBObject>, FKBehaviour> res = new LinkedHashMap<>();
res.put(BugReportSetting.class, new FKBehaviour(FKDataBehaviour.DELETE, FKCurrentObjectBehaviuor.PASSIVE));
res.put(BugReportRecipient.class, new FKBehaviour(FKDataBehaviour.DELETE, FKCurrentObjectBehaviuor.PASSIVE));
res.put(BugReportFile.class, new FKBehaviour(FKDataBehaviour.DELETE, FKCurrentObjectBehaviuor.ACTIVE));
return res;
}
//-

View File

@@ -1,5 +1,9 @@
package _VisualDVM.ComponentsServer.BugReportFile;
import Common.Database.Tables.iDBTable;
import Common.Visual.DataSetControlForm;
import _VisualDVM.ComponentsServer.BugReportFile.UI.BugReportFilesForm;
import javax.swing.*;
public class BugReportFilesDBTable extends iDBTable<BugReportFile> {
public BugReportFilesDBTable() {
super(BugReportFile.class);
@@ -12,4 +16,8 @@ public class BugReportFilesDBTable extends iDBTable<BugReportFile> {
public String getPluralDescription() {
return "файлы";
}
@Override
protected DataSetControlForm createUI(JPanel mountPanel) {
return new BugReportFilesForm(this, mountPanel);
}
}

View File

@@ -0,0 +1,29 @@
package _VisualDVM.ComponentsServer.BugReportFile.UI;
import Common.Database.Tables.DataSet;
import Common.Visual.DataSetControlForm;
import Common.Visual.Tables.ColumnInfo;
import _VisualDVM.ComponentsServer.BugReport.BugReport;
import _VisualDVM.ComponentsServer.BugReportFile.BugReportFile;
import _VisualDVM.Global;
import javax.swing.*;
public class BugReportFilesForm extends DataSetControlForm<BugReportFile> {
public BugReportFilesForm(DataSet<?, BugReportFile> dataSource_in, JPanel mountPanel_in) {
super(dataSource_in, mountPanel_in);
}
@Override
protected void createColumns() {
AddColumns(
new ColumnInfo<BugReportFile>("имя") {
@Override
public Object getFieldAt(BugReportFile object) {
return object.name;
}
}
);
}
@Override
public boolean isObjectVisible(BugReportFile object) {
return super.isObjectVisible(object)&&Global.componentsServer.db.getTable(BugReport.class).getUI().matchCurrentID(object.bugreport_id);
}
}

View File

@@ -1,26 +1,21 @@
package _VisualDVM.ComponentsServer;
import Common.Database.SQLITE.SQLiteDatabase;
import Common.Utils.Utils_;
import _VisualDVM.ComponentsServer.BugReport.BugReport;
import _VisualDVM.ComponentsServer.BugReport.BugReportsDBTable;
import _VisualDVM.ComponentsServer.BugReportFile.BugReportFilesDBTable;
import _VisualDVM.ComponentsServer.BugReportRecipient.BugReportRecipient;
import _VisualDVM.ComponentsServer.BugReportRecipient.BugReportRecipientsDBTable;
import _VisualDVM.ComponentsServer.BugReportSetting.BugReportSetting;
import _VisualDVM.ComponentsServer.BugReportSetting.BugReportSettingsDBTable;
import _VisualDVM.ComponentsServer.Recipient.RecipientsDataSet;
import _VisualDVM.Global;
import _VisualDVM.Passes.PassCode;
import _VisualDVM.Utils;
import org.apache.commons.io.FileUtils;
import java.io.File;
import java.nio.file.Paths;
import java.util.Comparator;
import java.util.Vector;
public class BugReportsDatabase extends SQLiteDatabase {
public BugReportsDBTable bugReports;
public BugReportSettingsDBTable bugReportSettings;
public BugReportRecipientsDBTable bugReportRecipients;
public BugReportFilesDBTable bugReportsFiles;
public RecipientsDataSet recipients = new RecipientsDataSet();
public BugReportsDatabase() {
super(Paths.get(System.getProperty("user.dir"), "Data", "bug_reports.sqlite").toFile());
@@ -30,6 +25,7 @@ public class BugReportsDatabase extends SQLiteDatabase {
addTable(bugReports = new BugReportsDBTable());
addTable(bugReportSettings = new BugReportSettingsDBTable());
addTable(bugReportRecipients = new BugReportRecipientsDBTable());
addTable(bugReportsFiles = new BugReportFilesDBTable());
}
@Override
public void Init() throws Exception {