галочка для назначения профиля по умолчанию
This commit is contained in:
@@ -31,6 +31,7 @@ import _VisualDVM.Passes.PassCode;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Date;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Vector;
|
||||
public class GlobalDatabase extends VisualiserDatabase {
|
||||
//---------СЕАНС----------------------------------------------
|
||||
public MachinesDBTable machines;
|
||||
|
||||
@@ -1,9 +1,23 @@
|
||||
package _VisualDVM.GlobalData.SapforProfile;
|
||||
import Common.Database.Objects.iDBObject;
|
||||
import Common.Utils.Utils_;
|
||||
import com.sun.org.glassfish.gmbal.Description;
|
||||
|
||||
import javax.swing.*;
|
||||
public class SapforProfile extends iDBObject {
|
||||
@Description("DEFAULT ''")
|
||||
public String description = "";
|
||||
@Description("DEFAULT 0")
|
||||
public long creationDate = 0;
|
||||
@Description("DEFAULT 0")
|
||||
public int isAuto = 0;
|
||||
public ImageIcon GetAutoIcon() {
|
||||
return Utils_.getIcon("/Common/icons/" + (isAuto == 1 ? "RedPick" : "NotPick") + ".png");
|
||||
}
|
||||
public String printAuto() {
|
||||
return isAuto > 0 ? "Да" : "Нет";
|
||||
}
|
||||
public void SwitchAuto() {
|
||||
isAuto = (isAuto == 0) ? 1 : 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,8 @@ import Common.Visual.Windows.Dialog.DBObjectDialog;
|
||||
import Common.Visual.Windows.Dialog.DialogFields;
|
||||
import _VisualDVM.GlobalData.SapforProfile.SapforProfile;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
import _VisualDVM.Visual.Tables.RendererProfileAuto;
|
||||
import _VisualDVM.Visual.Tables.SwitcherProfileAuto;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.Date;
|
||||
@@ -29,6 +31,28 @@ public class SapforProfilesForm extends DataSetControlForm<SapforProfile> {
|
||||
public Object getFieldAt(SapforProfile object) {
|
||||
return new Date(object.creationDate);
|
||||
}
|
||||
},
|
||||
new ColumnInfo<SapforProfile>("") {
|
||||
@Override
|
||||
public Object getFieldAt(SapforProfile object) {
|
||||
return object.printAuto();
|
||||
}
|
||||
@Override
|
||||
public Class getRendererClass() {
|
||||
return RendererProfileAuto.class;
|
||||
}
|
||||
@Override
|
||||
public Class getEditorClass() {
|
||||
return SwitcherProfileAuto.class;
|
||||
}
|
||||
@Override
|
||||
public int getMinWidth() {
|
||||
return 25;
|
||||
}
|
||||
@Override
|
||||
public int getMaxWidth() {
|
||||
return 25;
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
37
src/_VisualDVM/Passes/All/SetDefaultSapforProfile.java
Normal file
37
src/_VisualDVM/Passes/All/SetDefaultSapforProfile.java
Normal file
@@ -0,0 +1,37 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import Common.Passes.Pass;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Visual.UI;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.GlobalData.SapforProfile.SapforProfile;
|
||||
import _VisualDVM.Utils;
|
||||
|
||||
import java.util.Vector;
|
||||
public class SetDefaultSapforProfile extends Pass<SapforProfile> {
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
target = (SapforProfile) args[0];
|
||||
return UI.Question("Назначить профиль "+ Utils_.Brackets(target.description)+" профилем по умолчанию");
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
Vector<SapforProfile> toDrop = new Vector<>();
|
||||
for (SapforProfile sapforProfile : Global.mainModule.getDb().sapforProfiles.Data.values()) {
|
||||
if (sapforProfile.id!=target.id) {
|
||||
if (sapforProfile.isAuto != 0) {
|
||||
sapforProfile.isAuto = 0;
|
||||
toDrop.add(sapforProfile);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (SapforProfile sapforProfile : toDrop)
|
||||
Global.mainModule.getDb().Update(sapforProfile);
|
||||
//--
|
||||
target.SwitchAuto();
|
||||
Global.mainModule.getDb().Update(target);
|
||||
}
|
||||
@Override
|
||||
protected void showFinish() throws Exception {
|
||||
Global.mainModule.getDb().sapforProfiles.getUI().RedrawControl();
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ public enum PassCode implements PassCode_ {
|
||||
UpdateSapforProperty,
|
||||
ShowAllParallelVariants,
|
||||
ShowParallelVariantsCoverage,
|
||||
SetDefaultSapforProfile,
|
||||
//-
|
||||
DeleteServerSapfor,
|
||||
SaveProfile,
|
||||
@@ -356,6 +357,8 @@ public enum PassCode implements PassCode_ {
|
||||
@Override
|
||||
public String getDescription() {
|
||||
switch (this) {
|
||||
case SetDefaultSapforProfile:
|
||||
return "Установить профиль SAPFOR по умолчанию";
|
||||
case UpdateSapforProperty:
|
||||
return "Изменить настройку SAPFOR";
|
||||
case Email:
|
||||
|
||||
12
src/_VisualDVM/Visual/Tables/RendererProfileAuto.java
Normal file
12
src/_VisualDVM/Visual/Tables/RendererProfileAuto.java
Normal file
@@ -0,0 +1,12 @@
|
||||
package _VisualDVM.Visual.Tables;
|
||||
import Common.Visual.Tables.RendererDBObject;
|
||||
import _VisualDVM.GlobalData.SapforProfile.SapforProfile;
|
||||
import _VisualDVM.TestingSystem.Common.Configuration.Configuration;
|
||||
public class RendererProfileAuto extends RendererDBObject {
|
||||
@Override
|
||||
public void Display() {
|
||||
if (value != null) {
|
||||
setIcon(((SapforProfile) value).GetAutoIcon());
|
||||
}
|
||||
}
|
||||
}
|
||||
22
src/_VisualDVM/Visual/Tables/SwitcherProfileAuto.java
Normal file
22
src/_VisualDVM/Visual/Tables/SwitcherProfileAuto.java
Normal file
@@ -0,0 +1,22 @@
|
||||
package _VisualDVM.Visual.Tables;
|
||||
import Common.Passes.Pass;
|
||||
import Common.Visual.Tables.EditorDBObject;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.GlobalData.SapforProfile.SapforProfile;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
import _VisualDVM.Passes.Server.EditServerObject;
|
||||
import _VisualDVM.ServerObjectsCache.VisualCaches;
|
||||
import _VisualDVM.TestingSystem.Common.Configuration.Configuration;
|
||||
import _VisualDVM.TestingSystem.Common.TestingServer;
|
||||
import _VisualDVM.TestingSystem.SAPFOR.SapforConfiguration.SapforConfiguration;
|
||||
public class SwitcherProfileAuto extends EditorDBObject<SapforProfile> {
|
||||
@Override
|
||||
public void Action() {
|
||||
Global.mainModule.getPass(PassCode.SetDefaultSapforProfile).Do(value);
|
||||
setIcon(value.GetAutoIcon());
|
||||
}
|
||||
@Override
|
||||
public Object getCellEditorValue() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user