галочка для назначения профиля по умолчанию

This commit is contained in:
2025-01-16 23:44:17 +03:00
parent 72e4fbdf31
commit 01da3b3a70
9 changed files with 139 additions and 21 deletions

View 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();
}
}