рефакторинг форм таблиц и заполнения информации о столбцах
This commit is contained in:
@@ -2,6 +2,7 @@ package _VisualDVM.TestingSystem.DVM.DVMConfiguration.UI;
|
||||
import Common.Database.Tables.DataSet;
|
||||
import Common.Visual.DataSetControlForm;
|
||||
import Common.Visual.Menus.DataMenuBar;
|
||||
import Common.Visual.Tables.ColumnInfo;
|
||||
import Common.Visual.Tables.RendererMultiline;
|
||||
import Common.Visual.Windows.Dialog.DBObjectDialog;
|
||||
import _VisualDVM.Global;
|
||||
@@ -14,48 +15,64 @@ import javax.swing.*;
|
||||
public class DVMConfigurationsForm extends DataSetControlForm<DVMConfiguration> {
|
||||
public DVMConfigurationsForm(DataSet<?, DVMConfiguration> dataSource_in, JPanel mountPanel_in) {
|
||||
super(dataSource_in, mountPanel_in);
|
||||
}
|
||||
@Override
|
||||
public String[] getUIColumnNames() {
|
||||
return new String[]{
|
||||
"имя",
|
||||
"автор",
|
||||
"ядра",
|
||||
"параметры",
|
||||
"группы",
|
||||
"тестов",
|
||||
"компиляция(с)",
|
||||
"запуск(с)"
|
||||
};
|
||||
}
|
||||
@Override
|
||||
public Object getFieldAt(DVMConfiguration object, int columnIndex) {
|
||||
ConfigurationCache cache = (ConfigurationCache) VisualCaches.GetCache(object);
|
||||
switch (columnIndex) {
|
||||
case 2:
|
||||
return object.description;
|
||||
case 3:
|
||||
return object.sender_name;
|
||||
case 4:
|
||||
return object.kernels;
|
||||
case 5:
|
||||
return cache.settingsSummary;
|
||||
case 6:
|
||||
return cache.groupsSummary;
|
||||
case 7:
|
||||
return cache.getTestsCount();
|
||||
case 8:
|
||||
return object.c_maxtime;
|
||||
case 9:
|
||||
return object.maxtime;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected void AdditionalInitColumns() {
|
||||
columns.get(6).setRendererClass(RendererMultiline.class);
|
||||
columns.get(6).setMaxWidth(500);
|
||||
AddColumns(
|
||||
new ColumnInfo<DVMConfiguration>("имя") {
|
||||
@Override
|
||||
public Object getFieldAt(DVMConfiguration object) {
|
||||
return object.description;
|
||||
}
|
||||
},
|
||||
new ColumnInfo<DVMConfiguration>("автор") {
|
||||
@Override
|
||||
public Object getFieldAt(DVMConfiguration object) {
|
||||
return object.sender_name;
|
||||
}
|
||||
},
|
||||
new ColumnInfo<DVMConfiguration>("ядра") {
|
||||
@Override
|
||||
public Object getFieldAt(DVMConfiguration object) {
|
||||
return object.kernels;
|
||||
}
|
||||
},
|
||||
new ColumnInfo<DVMConfiguration>("параметры") {
|
||||
@Override
|
||||
public Object getFieldAt(DVMConfiguration object) {
|
||||
return ((ConfigurationCache) VisualCaches.GetCache(object)).settingsSummary;
|
||||
}
|
||||
},
|
||||
new ColumnInfo<DVMConfiguration>("группы") {
|
||||
@Override
|
||||
public Object getFieldAt(DVMConfiguration object) {
|
||||
return ((ConfigurationCache) VisualCaches.GetCache(object)).groupsSummary;
|
||||
}
|
||||
@Override
|
||||
public Class getRendererClass() {
|
||||
return RendererMultiline.class;
|
||||
}
|
||||
@Override
|
||||
public int getMaxWidth() {
|
||||
return 700;
|
||||
}
|
||||
},
|
||||
new ColumnInfo<DVMConfiguration>("тестов") {
|
||||
@Override
|
||||
public Object getFieldAt(DVMConfiguration object) {
|
||||
return ((ConfigurationCache) VisualCaches.GetCache(object)).getTestsCount();
|
||||
}
|
||||
},
|
||||
new ColumnInfo<DVMConfiguration>("компиляция(с)") {
|
||||
@Override
|
||||
public Object getFieldAt(DVMConfiguration object) {
|
||||
return object.c_maxtime;
|
||||
}
|
||||
},
|
||||
new ColumnInfo<DVMConfiguration>("запуск(с)") {
|
||||
@Override
|
||||
public Object getFieldAt(DVMConfiguration object) {
|
||||
return object.maxtime;
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
@Override
|
||||
public DataMenuBar createMenuBar() {
|
||||
|
||||
Reference in New Issue
Block a user