42 lines
1.3 KiB
Java
42 lines
1.3 KiB
Java
package com.molnarandrei.sopa.ui.navpane;
|
|
|
|
import com.molnarandrei.sopa.data.yaml.CallLog;
|
|
import org.kordamp.ikonli.Ikon;
|
|
import org.kordamp.ikonli.material2.Material2OutlinedAL;
|
|
import org.kordamp.ikonli.material2.Material2OutlinedMZ;
|
|
|
|
/** What the project tree shows next to a step about its SOAP call. */
|
|
public enum FlightState {
|
|
idle(Material2OutlinedMZ.RADIO_BUTTON_UNCHECKED, "idle"),
|
|
inFlight(Material2OutlinedMZ.PLAY_CIRCLE_OUTLINE, "in-flight"),
|
|
success(Material2OutlinedAL.CHECK_CIRCLE, "success"),
|
|
failed(Material2OutlinedAL.CANCEL, "failed"),
|
|
exception(Material2OutlinedAL.ERROR, "exception");
|
|
|
|
private final Ikon icon;
|
|
private final String styleClass;
|
|
|
|
FlightState(Ikon icon, String styleClass) {
|
|
this.icon = icon;
|
|
this.styleClass = styleClass;
|
|
}
|
|
|
|
public Ikon icon() {
|
|
return icon;
|
|
}
|
|
|
|
public String styleClass() {
|
|
return styleClass;
|
|
}
|
|
|
|
/** Logs written before results were recorded have no result and show as idle. */
|
|
public static FlightState of(CallLog callLog) {
|
|
if (callLog == null || callLog.getResult() == null) return idle;
|
|
return switch (callLog.getResult()) {
|
|
case success -> success;
|
|
case exception -> exception;
|
|
case assertionsFailed, extractionsFailed, notCalled -> failed;
|
|
};
|
|
}
|
|
}
|