10
src/TestingSystem/Common/Test/ProjectFiles_json.java
Normal file
10
src/TestingSystem/Common/Test/ProjectFiles_json.java
Normal file
@@ -0,0 +1,10 @@
|
||||
package TestingSystem.Common.Test;
|
||||
import ProjectData.Files.DBProjectFile;
|
||||
import com.google.gson.annotations.Expose;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
public class ProjectFiles_json {
|
||||
@Expose
|
||||
public List<DBProjectFile> files = new Vector<>();
|
||||
}
|
||||
53
src/TestingSystem/Common/Test/Test.java
Normal file
53
src/TestingSystem/Common/Test/Test.java
Normal file
@@ -0,0 +1,53 @@
|
||||
package TestingSystem.Common.Test;
|
||||
import Common.Constants;
|
||||
import Common.Current;
|
||||
import Common.Database.DBObject;
|
||||
import Common.Database.riDBObject;
|
||||
import Common.Global;
|
||||
import Common.UI.UI;
|
||||
import com.sun.org.glassfish.gmbal.Description;
|
||||
|
||||
import java.io.File;
|
||||
public class Test extends riDBObject {
|
||||
@Description("DEFAULT 1")
|
||||
public int dim = 1; //размерность теста. для удобства пусть будет и внешним полем.
|
||||
@Description("DEFAULT ''")
|
||||
public String args = ""; //аргументы командной строки. на всякий случай поле зарезервирую. пусть будут.
|
||||
@Description("DEFAULT -1")
|
||||
public int group_id = Constants.Nan;
|
||||
@Override
|
||||
public void SynchronizeFields(DBObject src) {
|
||||
super.SynchronizeFields(src);
|
||||
Test t = (Test) src;
|
||||
dim = t.dim;
|
||||
args = t.args;
|
||||
group_id = t.group_id;
|
||||
}
|
||||
public Test(Test test) {
|
||||
this.SynchronizeFields(test);
|
||||
}
|
||||
public Test() {
|
||||
}
|
||||
@Override
|
||||
public void select(boolean flag) {
|
||||
super.select(flag);
|
||||
if (Current.hasUI())
|
||||
UI.getMainWindow().ShowCheckedTestsCount();
|
||||
}
|
||||
//---
|
||||
@Override
|
||||
public boolean isVisible() {
|
||||
return Current.HasGroup() && (Current.getGroup().id == group_id);
|
||||
}
|
||||
//-
|
||||
public File getArchive() {
|
||||
return new File(Global.TestsDirectory, id + ".zip");
|
||||
}
|
||||
//-
|
||||
public File getServerPath() {
|
||||
return new File(Global.TestsDirectory, String.valueOf(id));
|
||||
}
|
||||
public File getHomePath() {
|
||||
return new File(Global.visualiser.getWorkspace(), String.valueOf(id));
|
||||
}
|
||||
}
|
||||
86
src/TestingSystem/Common/Test/TestDBTable.java
Normal file
86
src/TestingSystem/Common/Test/TestDBTable.java
Normal file
@@ -0,0 +1,86 @@
|
||||
package TestingSystem.Common.Test;
|
||||
import Common.Current;
|
||||
import Common.Database.iDBTable;
|
||||
import Common.UI.DataSetControlForm;
|
||||
import Common.UI.Windows.Dialog.DBObjectDialog;
|
||||
import TestingSystem.Common.Test.UI.TestFields;
|
||||
public class TestDBTable extends iDBTable<Test> {
|
||||
public TestDBTable() {
|
||||
super(Test.class);
|
||||
}
|
||||
@Override
|
||||
public String getSingleDescription() {
|
||||
return "тест DVM";
|
||||
}
|
||||
@Override
|
||||
public String getPluralDescription() {
|
||||
return "тесты";
|
||||
}
|
||||
@Override
|
||||
protected DataSetControlForm createUI() {
|
||||
return new DataSetControlForm(this) {
|
||||
@Override
|
||||
protected void AdditionalInitColumns() {
|
||||
//columns.get(0).setVisible(false);
|
||||
}
|
||||
@Override
|
||||
public boolean hasCheckBox() {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
}
|
||||
@Override
|
||||
public Object getFieldAt(Test object, int columnIndex) {
|
||||
switch (columnIndex) {
|
||||
case 2:
|
||||
return object.description;
|
||||
case 3:
|
||||
return object.dim;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public String[] getUIColumnNames() {
|
||||
return new String[]{
|
||||
"имя", "размерность"};
|
||||
}
|
||||
@Override
|
||||
public Current CurrentName() {
|
||||
return Current.Test;
|
||||
}
|
||||
@Override
|
||||
public DBObjectDialog<Test, TestFields> getDialog() {
|
||||
return new DBObjectDialog<Test, TestFields>(TestFields.class) {
|
||||
@Override
|
||||
public int getDefaultHeight() {
|
||||
return 200;
|
||||
}
|
||||
@Override
|
||||
public int getDefaultWidth() {
|
||||
return 400;
|
||||
}
|
||||
@Override
|
||||
public void validateFields() {
|
||||
if (!edit) {
|
||||
if (!Current.getGroup().language.equals(Current.getProject().languageName))
|
||||
Log.Writeln_("В текущую группу могут войти только тесты на языке " + Current.getGroup().language);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void fillFields() {
|
||||
fields.tfName.setText(Result.description);
|
||||
fields.sDim.setValue(Result.dim);
|
||||
}
|
||||
@Override
|
||||
public void ProcessResult() {
|
||||
Result.description = fields.tfName.getText();
|
||||
Result.dim = (int) fields.sDim.getValue();
|
||||
if (!edit) {
|
||||
Result.sender_name = Current.getAccount().name;
|
||||
Result.sender_address = Current.getAccount().email;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
22
src/TestingSystem/Common/Test/TestType.java
Normal file
22
src/TestingSystem/Common/Test/TestType.java
Normal file
@@ -0,0 +1,22 @@
|
||||
package TestingSystem.Common.Test;
|
||||
public enum TestType {
|
||||
Default,
|
||||
Correctness,
|
||||
Performance,
|
||||
SAPFOR,
|
||||
;
|
||||
public String getDescription(){
|
||||
switch (this){
|
||||
case Correctness:
|
||||
return "Корректность";
|
||||
case Performance:
|
||||
return "Производительность";
|
||||
case Default:
|
||||
return "Без типа";
|
||||
case SAPFOR:
|
||||
return "SAPFOR";
|
||||
default:
|
||||
return "?";
|
||||
}
|
||||
}
|
||||
}
|
||||
55
src/TestingSystem/Common/Test/UI/TestFields.form
Normal file
55
src/TestingSystem/Common/Test/UI/TestFields.form
Normal file
@@ -0,0 +1,55 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="TestingSystem.Common.Test.UI.TestFields">
|
||||
<grid id="27dc6" binding="content" layout-manager="GridLayoutManager" row-count="3" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<xy x="20" y="20" width="500" height="400"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="e9479" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="2" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<font name="Times New Roman" size="16" style="2"/>
|
||||
<text value="название"/>
|
||||
</properties>
|
||||
</component>
|
||||
<vspacer id="9a439">
|
||||
<constraints>
|
||||
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</vspacer>
|
||||
<component id="ddf02" class="javax.swing.JTextField" binding="tfName" custom-create="true">
|
||||
<constraints>
|
||||
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="150" height="-1"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<enabled value="true"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="fbef6" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="2" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<font name="Times New Roman" size="16" style="2"/>
|
||||
<text value="размерность"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="2b54" class="javax.swing.JSpinner" binding="sDim">
|
||||
<constraints>
|
||||
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="50" height="-1"/>
|
||||
<maximum-size width="50" height="-1"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties/>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
</form>
|
||||
22
src/TestingSystem/Common/Test/UI/TestFields.java
Normal file
22
src/TestingSystem/Common/Test/UI/TestFields.java
Normal file
@@ -0,0 +1,22 @@
|
||||
package TestingSystem.Common.Test.UI;
|
||||
import Common.UI.TextField.StyledTextField;
|
||||
import Common.UI.Windows.Dialog.DialogFields;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
public class TestFields implements DialogFields {
|
||||
public JTextField tfName;
|
||||
private JPanel content;
|
||||
public JSpinner sDim;
|
||||
@Override
|
||||
public Component getContent() {
|
||||
return content;
|
||||
}
|
||||
private void createUIComponents() {
|
||||
// TODO: place custom component creation code here
|
||||
tfName = new StyledTextField();
|
||||
}
|
||||
public TestFields(){
|
||||
sDim.setModel(new SpinnerNumberModel(1, 0, 16,1));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user