no message
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
package Common.Passes;
|
||||
import Common.Current_;
|
||||
import Common.Utils.CommonUtils;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Utils.Stopwatch;
|
||||
import Common.Utils.TextLog;
|
||||
import Common.Visual.CommonUI;
|
||||
import Common.Visual.UI_;
|
||||
import Visual_DVM_2021.PassStats.PassStats;
|
||||
import Visual_DVM_2021.Passes.PassCode;
|
||||
import Visual_DVM_2021.Passes.UI.PassForm;
|
||||
@@ -53,9 +53,9 @@ public class Pass<T> {
|
||||
//важно. вызывать только если есть интерфейс. passstats делать частью общей бд.пусть будут.
|
||||
public static void CheckAllStats() throws Exception {
|
||||
for (Pass pass : FAPasses) {
|
||||
if (!((GlobalDatabase) CommonUtils.db).passStats.Data.containsKey(pass.code().toString()))
|
||||
CommonUtils.db.Insert(pass.stats = new PassStats(pass.code().toString()));
|
||||
else pass.stats = ((GlobalDatabase) CommonUtils.db).passStats.Data.get(pass.code().toString());
|
||||
if (!((GlobalDatabase) Utils_.db).passStats.Data.containsKey(pass.code().toString()))
|
||||
Utils_.db.Insert(pass.stats = new PassStats(pass.code().toString()));
|
||||
else pass.stats = ((GlobalDatabase) Utils_.db).passStats.Data.get(pass.code().toString());
|
||||
}
|
||||
FAPasses.sort(new SortPassesByStats());
|
||||
}
|
||||
@@ -68,7 +68,7 @@ public class Pass<T> {
|
||||
if (pass.hasStats())
|
||||
FAPasses.add(pass);
|
||||
} catch (Exception ex) {
|
||||
CommonUtils.MainLog.PrintException(ex);
|
||||
Utils_.MainLog.PrintException(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -78,7 +78,7 @@ public class Pass<T> {
|
||||
return null;
|
||||
}
|
||||
public Icon getTabIcon() {
|
||||
return CommonUtils.getTabIcon(getIconPath());
|
||||
return Utils_.getTabIcon(getIconPath());
|
||||
}
|
||||
public AbstractAction getControlAction() {
|
||||
return new AbstractAction() {
|
||||
@@ -128,12 +128,12 @@ public class Pass<T> {
|
||||
if (hasStats()) {
|
||||
stats.Inc();
|
||||
try {
|
||||
CommonUtils.db.Update(stats);
|
||||
Utils_.db.Update(stats);
|
||||
FAPasses.sort(new SortPassesByStats());
|
||||
if (Current.HasProject())
|
||||
UI.fastAccessMenuBar.Refresh();
|
||||
} catch (Exception ex) {
|
||||
CommonUtils.MainLog.PrintException(ex);
|
||||
Utils_.MainLog.PrintException(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -190,30 +190,30 @@ public class Pass<T> {
|
||||
//-
|
||||
private void PerformCanNotStart() throws Exception {
|
||||
performCanNotStart();
|
||||
if (CommonUI.isActive())
|
||||
if (UI_.isActive())
|
||||
showCanNotStart();
|
||||
}
|
||||
protected void PerformPreparation() throws Exception {
|
||||
performPreparation();
|
||||
if (CommonUI.isActive())
|
||||
if (UI_.isActive())
|
||||
showPreparation();
|
||||
}
|
||||
private void PerformFinish() throws Exception {
|
||||
performFinish();
|
||||
//-
|
||||
if (CommonUI.isActive())
|
||||
if (UI_.isActive())
|
||||
showFinish();
|
||||
}
|
||||
private void PerformDone() throws Exception {
|
||||
performDone();
|
||||
//-
|
||||
if (CommonUI.isActive())
|
||||
if (UI_.isActive())
|
||||
showDone();
|
||||
}
|
||||
private void PerformFail() throws Exception {
|
||||
performFail();
|
||||
//-
|
||||
if (CommonUI.isActive())
|
||||
if (UI_.isActive())
|
||||
showFail();
|
||||
}
|
||||
//------
|
||||
@@ -245,7 +245,7 @@ public class Pass<T> {
|
||||
Vector<String> ToPrint = new Vector<>();
|
||||
createStack_r(ToDo, ToPrint);
|
||||
if (Global.properties.ConfirmPassesStart && !ToPrint.isEmpty() &&
|
||||
!CommonUI.Question("Выполнить проход(ы):\n" + String.join("\n", ToPrint))
|
||||
!UI_.Question("Выполнить проход(ы):\n" + String.join("\n", ToPrint))
|
||||
) return false;
|
||||
while (ToDo.size() > 1) {
|
||||
if (!ToDo.pop().start()) return false;
|
||||
@@ -256,7 +256,7 @@ public class Pass<T> {
|
||||
//-
|
||||
if (Global.properties.ShowPassesDone && !ToPrint.isEmpty()
|
||||
) {
|
||||
CommonUI.Info("Проход(ы)\n\n" + String.join("\n", ToPrint) +
|
||||
UI_.Info("Проход(ы)\n\n" + String.join("\n", ToPrint) +
|
||||
"\nуспешно выполнен(ы)!");
|
||||
}
|
||||
//-
|
||||
@@ -270,7 +270,7 @@ public class Pass<T> {
|
||||
return false;
|
||||
}
|
||||
public void Interrupt() throws Exception {
|
||||
CommonUI.Info("Проход " + CommonUtils.Brackets(getDescription()) + " не разрешено прерывать.");
|
||||
UI_.Info("Проход " + Utils_.Brackets(getDescription()) + " не разрешено прерывать.");
|
||||
}
|
||||
public boolean needsConfirmations() {
|
||||
return false;
|
||||
@@ -281,7 +281,7 @@ public class Pass<T> {
|
||||
if (ex instanceof PassException) {
|
||||
Log.Writeln_(ex.getMessage());
|
||||
} else
|
||||
CommonUtils.MainLog.PrintException(ex);
|
||||
Utils_.MainLog.PrintException(ex);
|
||||
}
|
||||
public boolean start(Object... args) {
|
||||
//------------------------------->
|
||||
@@ -293,15 +293,15 @@ public class Pass<T> {
|
||||
target = null;
|
||||
Log = new TextLog();
|
||||
if (!getDescription().isEmpty())
|
||||
CommonUtils.MainLog.Print(getDescription() + " стартует..");
|
||||
Utils_.MainLog.Print(getDescription() + " стартует..");
|
||||
timer.Start();
|
||||
//------------------------------->
|
||||
try {
|
||||
if (CommonUI.isActive()) FocusBeforeStart();
|
||||
if (UI_.isActive()) FocusBeforeStart();
|
||||
if (canStart(args)) {
|
||||
PerformPreparation();
|
||||
//todo тут должна быть вилка на анимацию?
|
||||
if (CommonUI.isActive() && needsAnimation()) {
|
||||
if (UI_.isActive() && needsAnimation()) {
|
||||
animation_sem = new Semaphore(1);
|
||||
animation_sem.acquire();
|
||||
//---
|
||||
@@ -324,7 +324,7 @@ public class Pass<T> {
|
||||
try {
|
||||
animation_sem.acquire();
|
||||
} catch (InterruptedException e) {
|
||||
CommonUtils.MainLog.PrintException(e);
|
||||
Utils_.MainLog.PrintException(e);
|
||||
}
|
||||
//и уничтожаем его.
|
||||
// UI.Print(DebugPrintLevel.Passes, "Окно анимации активировано.");
|
||||
@@ -375,19 +375,19 @@ public class Pass<T> {
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
state = PassState.ExternalCrushed;
|
||||
CommonUtils.MainLog.PrintException(ex);
|
||||
Utils_.MainLog.PrintException(ex);
|
||||
}
|
||||
//------------------------------->
|
||||
timer.Stop();
|
||||
if (!getDescription().isEmpty()) {
|
||||
CommonUtils.MainLog.Print(
|
||||
Utils_.MainLog.Print(
|
||||
getDescription() +
|
||||
" окончен за " + timer.Print() +
|
||||
" состояние " + CommonUtils.Brackets(state.getDescription())
|
||||
" состояние " + Utils_.Brackets(state.getDescription())
|
||||
);
|
||||
if (!Log.isEmpty() && CommonUI.isActive())
|
||||
CommonUI.Error(
|
||||
"проход " + CommonUtils.Brackets(getDescription()) + "\n" + state.getDescription() + "\n\n" +
|
||||
if (!Log.isEmpty() && UI_.isActive())
|
||||
UI_.Error(
|
||||
"проход " + Utils_.Brackets(getDescription()) + "\n" + state.getDescription() + "\n\n" +
|
||||
Log.toString());
|
||||
}
|
||||
//------------------------------->
|
||||
@@ -395,7 +395,7 @@ public class Pass<T> {
|
||||
}
|
||||
//--
|
||||
public void ShowSapforMessage(String message) {
|
||||
if (CommonUI.isActive() && form != null) {
|
||||
if (UI_.isActive() && form != null) {
|
||||
String[] data = message.split(":");
|
||||
switch (data[0]) {
|
||||
case "message_1":
|
||||
@@ -408,17 +408,17 @@ public class Pass<T> {
|
||||
form.fields.ProgressBar.setValue((data.length > 1) ? Integer.parseInt(data[1]) : 0);
|
||||
break;
|
||||
}
|
||||
} else System.out.println(CommonUtils.Brackets(message));
|
||||
} else System.out.println(Utils_.Brackets(message));
|
||||
}
|
||||
public void ShowMessage1(String message) {
|
||||
if (form != null)
|
||||
form.fields.Label1.setText((message.length() > 1) ? message : "");
|
||||
else System.out.println(CommonUtils.Brackets(message));
|
||||
else System.out.println(Utils_.Brackets(message));
|
||||
}
|
||||
public void ShowMessage2(String message) {
|
||||
if (form != null)
|
||||
form.fields.Label2.setText((message.isEmpty() ? "" : message));
|
||||
else System.out.println(CommonUtils.Brackets(message));
|
||||
else System.out.println(Utils_.Brackets(message));
|
||||
}
|
||||
public void ShowProgress(int total, int current, boolean auto) {
|
||||
if (form != null) {
|
||||
|
||||
Reference in New Issue
Block a user