[#2456] Add sim warnings tab to sim config
This commit is contained in:
parent
90236a2715
commit
80d82ad99d
@ -455,10 +455,7 @@ simedtdlg.title.MultiSimEdit.ttip = <html>You are editing the following simulati
|
||||
simedtdlg.lbl.Simname = Name:
|
||||
simedtdlg.tab.Launchcond = Launch conditions
|
||||
simedtdlg.tab.Simopt = Simulation options
|
||||
simedtdlg.tab.Settings = Settings
|
||||
simedtdlg.tab.Plotdata = Plot data
|
||||
simedtdlg.tab.CustomExpressions = Custom expressions
|
||||
simedtdlg.tab.Exportdata = Export data
|
||||
simedtdlg.lbl.Flightcfg = Flight configuration:
|
||||
simedtdlg.lbl.ttip.Flightcfg = Select the flight configuration to use.
|
||||
simedtdlg.combo.ttip.Flightcfg = Select the flight configuration to use.
|
||||
@ -536,6 +533,10 @@ simedtdlg.IntensityDesc.Veryhigh = Very high
|
||||
simedtdlg.IntensityDesc.Extreme = Extreme
|
||||
|
||||
! SimulationConfigDialog
|
||||
SimulationConfigDialog.tab.Settings = Settings
|
||||
SimulationConfigDialog.tab.Warnings = Warnings
|
||||
SimulationConfigDialog.tab.Plotdata = Plot data
|
||||
SimulationConfigDialog.tab.Exportdata = Export data
|
||||
SimulationConfigDialog.btn.plot = Plot
|
||||
SimulationConfigDialog.btn.export = Export
|
||||
SimulationConfigDialog.btn.OK.ttip = Keep changes and close the dialog
|
||||
@ -544,9 +545,15 @@ SimulationConfigDialog.CancelOperation.msg.discardChanges = <html>Are you sure y
|
||||
SimulationConfigDialog.CancelOperation.msg.undoAdd = <html>Are you sure you want to <b>undo adding</b> this simulation?</html>
|
||||
SimulationConfigDialog.CancelOperation.title = Cancel operation
|
||||
SimulationConfigDialog.CancelOperation.checkbox.dontAskAgain = Don't ask me again
|
||||
SimulationConfigDialog.tab.warnDis.ttip = Warnings not supported for multi-simulation editing
|
||||
SimulationConfigDialog.tab.plotDis.ttip = Plotting not supported for multi-simulation editing
|
||||
SimulationConfigDialog.tab.expDis.ttip = Exporting not supported for multi-simulation editing
|
||||
|
||||
! SimulationWarningsPanel
|
||||
SimulationWarningsPanel.lbl.CriticalWarnings = Critical Warning(s)
|
||||
SimulationWarningsPanel.lbl.NormalWarnings = Warning(s)
|
||||
SimulationWarningsPanel.lbl.InformativeWarnings = Informative Warning(s)
|
||||
|
||||
SimulationExtension.airstart.name.alt = Air-start ({alt})
|
||||
SimulationExtension.airstart.name.altvel = Air-start ({alt}, {vel})
|
||||
SimulationExtension.javacode.name = Java code
|
||||
|
@ -385,9 +385,9 @@ simedtdlg.title.Editsim = تعديل المحاكاة
|
||||
simedtdlg.lbl.Simname = :إسم المحاكاة
|
||||
simedtdlg.tab.Launchcond = شروط الإطلاق
|
||||
simedtdlg.tab.Simopt = خيارات المحاكاة
|
||||
simedtdlg.tab.Plotdata = عرض البيانات
|
||||
SimulationConfigDialog.tab.Plotdata = عرض البيانات
|
||||
simedtdlg.tab.CustomExpressions = التعبيرات المخصصة
|
||||
simedtdlg.tab.Exportdata = تصدير البيانات
|
||||
SimulationConfigDialog.tab.Exportdata = تصدير البيانات
|
||||
simedtdlg.lbl.Flightcfg = :إعدادات الطيران
|
||||
simedtdlg.lbl.ttip.Flightcfg = .حدد إعدادات الرحلة لإستخدامها
|
||||
simedtdlg.combo.ttip.Flightcfg = .حدد إعدادات الرحلة لإستخدامها
|
||||
|
@ -283,8 +283,8 @@ simedtdlg.title.Editsim = Uprav simulaci
|
||||
simedtdlg.lbl.Simname = Jméno simulace:
|
||||
simedtdlg.tab.Launchcond = Startovací podmínky
|
||||
simedtdlg.tab.Simopt = Parametry simulace
|
||||
simedtdlg.tab.Plotdata = Zobraz data
|
||||
simedtdlg.tab.Exportdata = Exportuj data
|
||||
SimulationConfigDialog.tab.Plotdata = Zobraz data
|
||||
SimulationConfigDialog.tab.Exportdata = Exportuj data
|
||||
simedtdlg.lbl.Motorcfg = Nastavení motoru:
|
||||
simedtdlg.lbl.ttip.Motorcfg = Nastav konfiguraci motoru k pouziti.
|
||||
simedtdlg.combo.ttip.motorconf = Nastav konfiguraci motoru k pouziti.
|
||||
|
@ -285,9 +285,9 @@ simedtdlg.title.Editsim = Simulation bearbeiten
|
||||
simedtdlg.lbl.Simname = Name der Simulation:
|
||||
simedtdlg.tab.Launchcond = Startbedingungen
|
||||
simedtdlg.tab.Simopt = Simulationsoptionen
|
||||
simedtdlg.tab.Plotdata = Daten plotten
|
||||
SimulationConfigDialog.tab.Plotdata = Daten plotten
|
||||
simedtdlg.tab.CustomExpressions = Benutzerdefinierte Ausdrücke
|
||||
simedtdlg.tab.Exportdata = Daten exportieren
|
||||
SimulationConfigDialog.tab.Exportdata = Daten exportieren
|
||||
simedtdlg.lbl.Motorcfg = Motorkonfiguration:
|
||||
simedtdlg.lbl.ttip.Motorcfg = Motorkonfiguration auswählen
|
||||
simedtdlg.combo.ttip.motorconf = Die Motorkonfiguration auswählen.
|
||||
|
@ -1787,9 +1787,9 @@ simedtdlg.lbl.ttip.Turbulenceintensity1 = <html>La intensidad de la turbulen
|
||||
simedtdlg.lbl.ttip.Turbulenceintensity2 = Valores t\u00edpicos en el campo
|
||||
simedtdlg.lbl.ttip.Turbulenceintensity3 = a
|
||||
simedtdlg.tab.CustomExpressions = Expresiones personalizadas
|
||||
simedtdlg.tab.Exportdata = Exportar datos
|
||||
SimulationConfigDialog.tab.Exportdata = Exportar datos
|
||||
simedtdlg.tab.Launchcond = Condiciones del lanzamiento
|
||||
simedtdlg.tab.Plotdata = Datos del gr\u00e1fico
|
||||
SimulationConfigDialog.tab.Plotdata = Datos del gr\u00e1fico
|
||||
simedtdlg.tab.Simopt = Opciones de simulaci\u00f3n
|
||||
simedtdlg.title.Editsim = Mostrar la simulaci\u00f3n
|
||||
simedtdlg.txt.longA1 = <html><i>Extensiones del simulador</i> es una caracter\u00edstica avanzada que permite que el c\u00f3digo escrito por un usuario pueda conectar e interactuar con la simulaci\u00f3n mientras \u00e9sta se est\u00e1 ejecutando.
|
||||
|
@ -1779,9 +1779,9 @@ simedtdlg.lbl.ttip.Turbulenceintensity1 = <html>L'intensit\u00E9 de la turbu
|
||||
simedtdlg.lbl.ttip.Turbulenceintensity2 = Les valeurs typiques vont de
|
||||
simedtdlg.lbl.ttip.Turbulenceintensity3 = \u00E0
|
||||
simedtdlg.tab.CustomExpressions = Expressions personnalis\u00E9es
|
||||
simedtdlg.tab.Exportdata = Exporter les donn\u00E9es
|
||||
SimulationConfigDialog.tab.Exportdata = Exporter les donn\u00E9es
|
||||
simedtdlg.tab.Launchcond = Conditions de lancement
|
||||
simedtdlg.tab.Plotdata = Tracer les donn\u00E9es
|
||||
SimulationConfigDialog.tab.Plotdata = Tracer les donn\u00E9es
|
||||
simedtdlg.tab.Simopt = Options de simulation
|
||||
simedtdlg.title.Editsim = Modifier la simulation
|
||||
simedtdlg.txt.longA1 = <html><i>Les auditeurs de simulation</i> sont une fonction avanc\u00E9e qui permet \u00E0 l'utilisateur d'\u00E9crire du code pour suivre et interagir avec la simulation.
|
||||
|
@ -287,9 +287,9 @@ simedtdlg.title.Editsim = Modifica simulazione
|
||||
simedtdlg.lbl.Simname = Nome della simulazione:
|
||||
simedtdlg.tab.Launchcond = Condizioni di lancio
|
||||
simedtdlg.tab.Simopt = Opzioni di simulazione
|
||||
simedtdlg.tab.Plotdata = Grafico
|
||||
SimulationConfigDialog.tab.Plotdata = Grafico
|
||||
simedtdlg.tab.CustomExpressions = Custom expressions
|
||||
simedtdlg.tab.Exportdata = Esporta i dati
|
||||
SimulationConfigDialog.tab.Exportdata = Esporta i dati
|
||||
simedtdlg.lbl.Motorcfg = Configurazione del motore:
|
||||
simedtdlg.lbl.ttip.Motorcfg = Seleziona la configurazione del motore da usare.
|
||||
simedtdlg.combo.ttip.motorconf = Seleziona la configurazione del motore da usare.
|
||||
|
@ -284,9 +284,9 @@ simedtdlg.title.Editsim = \u30B7\u30DF\u30E5\u30EC\u30FC\u30B7\u30E7\u30F3\u306
|
||||
simedtdlg.lbl.Simname = \u30B7\u30DF\u30E5\u30EC\u30FC\u30B7\u30E7\u30F3\u306E\u540D\u524D\uFF1A
|
||||
simedtdlg.tab.Launchcond = \u30ED\u30FC\u30F3\u30C1\u30B3\u30F3\u30C7\u30A3\u30B7\u30E7\u30F3
|
||||
simedtdlg.tab.Simopt = \u30B7\u30DF\u30E5\u30EC\u30FC\u30B7\u30E7\u30F3\u30AA\u30D7\u30B7\u30E7\u30F3
|
||||
simedtdlg.tab.Plotdata = \u30C7\u30FC\u30BF\u30D7\u30ED\u30C3\u30C8
|
||||
SimulationConfigDialog.tab.Plotdata = \u30C7\u30FC\u30BF\u30D7\u30ED\u30C3\u30C8
|
||||
simedtdlg.tab.CustomExpressions = \u30AB\u30B9\u30BF\u30E0\u5F0F
|
||||
simedtdlg.tab.Exportdata = \u30C7\u30FC\u30BF\u306E\u30A8\u30AF\u30B9\u30DD\u30FC\u30C8
|
||||
SimulationConfigDialog.tab.Exportdata = \u30C7\u30FC\u30BF\u306E\u30A8\u30AF\u30B9\u30DD\u30FC\u30C8
|
||||
simedtdlg.lbl.Motorcfg = \u30E2\u30FC\u30BF\u30FC\u30B3\u30F3\u30D5\u30A3\u30AE\u30E5\u30EC\u30FC\u30B7\u30E7\u30F3\uFF1A
|
||||
simedtdlg.lbl.ttip.Motorcfg = \u4F7F\u7528\u3059\u308B\u30E2\u30FC\u30BF\u30FC\u30B3\u30F3\u30D5\u30A3\u30AE\u30E5\u30EC\u30FC\u30B7\u30E7\u30F3\u306E\u9078\u629E
|
||||
simedtdlg.combo.ttip.motorconf = \u4F7F\u7528\u3059\u308B\u30E2\u30FC\u30BF\u30FC\u30B3\u30F3\u30D5\u30A3\u30AE\u30E5\u30EC\u30FC\u30B7\u30E7\u30F3\u306E\u9078\u629E
|
||||
|
@ -365,9 +365,9 @@ simedtdlg.title.Editsim = Bewerk simulatie
|
||||
simedtdlg.lbl.Simname = Simulatienaam:
|
||||
simedtdlg.tab.Launchcond = Lanceeromstandigheden
|
||||
simedtdlg.tab.Simopt = Simulatie-opties
|
||||
simedtdlg.tab.Plotdata = Gegevens plotten
|
||||
SimulationConfigDialog.tab.Plotdata = Gegevens plotten
|
||||
simedtdlg.tab.CustomExpressions = Aangepaste uitdrukkingen
|
||||
simedtdlg.tab.Exportdata = Exporteer data
|
||||
SimulationConfigDialog.tab.Exportdata = Exporteer data
|
||||
simedtdlg.lbl.Flightcfg = Vluchtconfiguratie:
|
||||
simedtdlg.lbl.ttip.Flightcfg = Selecteer de te gebruiken vluchtconfiguratie.
|
||||
simedtdlg.combo.ttip.Flightcfg = Selecteer de te gebruiken vluchtconfiguratie.
|
||||
|
@ -285,8 +285,8 @@ update.dlg.latestVersion = Korzystasz z najnowszej wersji OpenRocket: %s.
|
||||
simedtdlg.lbl.Simname = Nazwa symulacji:
|
||||
simedtdlg.tab.Launchcond = Warunki startowe
|
||||
simedtdlg.tab.Simopt = Opcje symulacji
|
||||
simedtdlg.tab.Plotdata = Poka\u017C wykres
|
||||
simedtdlg.tab.Exportdata = Eksportuj dane
|
||||
SimulationConfigDialog.tab.Plotdata = Poka\u017C wykres
|
||||
SimulationConfigDialog.tab.Exportdata = Eksportuj dane
|
||||
simedtdlg.lbl.Motorcfg = Konfiguracja silnika:
|
||||
simedtdlg.lbl.ttip.Motorcfg = Wybierz konfiguracj\u0119 silnika.
|
||||
simedtdlg.combo.ttip.motorconf = Wybierz konfiguracj\u0119 silnika.
|
||||
|
@ -1731,9 +1731,9 @@ simedtdlg.lbl.ttip.Turbulenceintensity1 = <html>A intensidade de turbul\u00e
|
||||
simedtdlg.lbl.ttip.Turbulenceintensity2 = Os valores t\u00edpicos variam entre
|
||||
simedtdlg.lbl.ttip.Turbulenceintensity3 = a
|
||||
simedtdlg.tab.CustomExpressions = Express\u00f5es personalizadas
|
||||
simedtdlg.tab.Exportdata = Exportar dados
|
||||
SimulationConfigDialog.tab.Exportdata = Exportar dados
|
||||
simedtdlg.tab.Launchcond = Condi\u00e7\u00f5es do lan\u00e7amento
|
||||
simedtdlg.tab.Plotdata = Plotar dados
|
||||
SimulationConfigDialog.tab.Plotdata = Plotar dados
|
||||
simedtdlg.tab.Simopt = Op\u00e7\u00f5es de simula\u00e7\u00e3o
|
||||
simedtdlg.title.Editsim = Editar simula\u00e7\u00e3o
|
||||
simedtdlg.txt.longA1 = <html><i>Observa\u00e7\u00e3o da simula\u00e7\u00e3o</i> \u00e9 um recurso avan\u00e7ado que permite que o usu\u00e1rio escreva c\u00f3digo para observar e interagir com a simula\u00e7\u00e3o.
|
||||
|
@ -374,9 +374,9 @@ simedtdlg.title.Editsim = \u0418\u0437\u043C\u0435\u043D\u0435\u043D\u0438\u0435
|
||||
simedtdlg.lbl.Simname = \u041D\u0430\u0437\u0432\u0430\u043D\u0438\u0435 \u0440\u0430\u0441\u0447\u0435\u0442\u0430:
|
||||
simedtdlg.tab.Launchcond = \u0423\u0441\u043B\u043E\u0432\u0438\u044F \u0437\u0430\u043F\u0443\u0441\u043A\u0430
|
||||
simedtdlg.tab.Simopt = \u041F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u044B \u0440\u0430\u0441\u0447\u0435\u0442\u0430
|
||||
simedtdlg.tab.Plotdata = \u0413\u0440\u0430\u0444\u0438\u043A\u0438 \u0434\u0430\u043D\u043D\u044B\u0445
|
||||
SimulationConfigDialog.tab.Plotdata = \u0413\u0440\u0430\u0444\u0438\u043A\u0438 \u0434\u0430\u043D\u043D\u044B\u0445
|
||||
simedtdlg.tab.CustomExpressions = \u0421\u0432\u043E\u0438 \u0432\u044B\u0440\u0430\u0436\u0435\u043D\u0438\u044F
|
||||
simedtdlg.tab.Exportdata = \u042D\u043A\u0441\u043F\u043E\u0440\u0442 \u0434\u0430\u043D\u043D\u044B\u0445
|
||||
SimulationConfigDialog.tab.Exportdata = \u042D\u043A\u0441\u043F\u043E\u0440\u0442 \u0434\u0430\u043D\u043D\u044B\u0445
|
||||
simedtdlg.lbl.Flightcfg = \u041F\u043E\u043B\u0435\u0442\u043D\u0430\u044F \u043A\u043E\u043D\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044F:
|
||||
simedtdlg.lbl.ttip.Flightcfg = \u0412\u044B\u0431\u0440\u0430\u0442\u044C \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0435\u043C\u0443\u044E \u043F\u043E\u043B\u0435\u0442\u043D\u0443\u044E \u043A\u043E\u043D\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044E.
|
||||
simedtdlg.combo.ttip.Flightcfg = \u0412\u044B\u0431\u0440\u0430\u0442\u044C \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0435\u043C\u0443\u044E \u043F\u043E\u043B\u0435\u0442\u043D\u0443\u044E \u043A\u043E\u043D\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044E.
|
||||
|
@ -324,9 +324,9 @@ simedtdlg.title.Editsim = Edit simulation
|
||||
simedtdlg.lbl.Simname = Name:
|
||||
simedtdlg.tab.Launchcond = Launch conditions
|
||||
simedtdlg.tab.Simopt = Simulation options
|
||||
simedtdlg.tab.Plotdata = Plot data
|
||||
SimulationConfigDialog.tab.Plotdata = Plot data
|
||||
simedtdlg.tab.CustomExpressions = Custom expressions
|
||||
simedtdlg.tab.Exportdata = Export data
|
||||
SimulationConfigDialog.tab.Exportdata = Export data
|
||||
simedtdlg.lbl.Flightcfg = Flight configuration:
|
||||
simedtdlg.lbl.ttip.Flightcfg = Select the flight configuration to use.
|
||||
simedtdlg.combo.ttip.Flightcfg = Select the flight configuration to use.
|
||||
|
@ -1877,9 +1877,9 @@ simedtdlg.lbl.ttip.Turbulenceintensity2 = \u5178\u578B\u53D6\u503C\u8303\u56
|
||||
simedtdlg.lbl.ttip.Turbulenceintensity3 = \u5230
|
||||
simedtdlg.lbl.ttip.Winddirection = <html>\u98CE\u5411, 0-360\u5EA6. <br>0 \u662F\u5317\u98CE,<br> 90 \u662F\u4E1C\u98CE
|
||||
simedtdlg.tab.CustomExpressions = \u81EA\u5B9A\u4E49\u8868\u8FBE\u5F0F
|
||||
simedtdlg.tab.Exportdata = \u8F93\u51FA\u6570\u636E
|
||||
SimulationConfigDialog.tab.Exportdata = \u8F93\u51FA\u6570\u636E
|
||||
simedtdlg.tab.Launchcond = \u53D1\u5C04\u6761\u4EF6
|
||||
simedtdlg.tab.Plotdata = \u6570\u636E\u7ED8\u56FE
|
||||
SimulationConfigDialog.tab.Plotdata = \u6570\u636E\u7ED8\u56FE
|
||||
simedtdlg.tab.Simopt = \u6A21\u62DF\u9009\u9879
|
||||
simedtdlg.title.Editsim = \u7F16\u8F91\u4EFF\u771F
|
||||
simedtdlg.txt.longA1 = <html><i>\u4EFF\u771F\u76D1\u542C\u5668(Simulation Listener)</i>\u662F\u4E00\u4E2A\u9AD8\u7EA7\u7279\u6027,\u5141\u8BB8\u7528\u6237\u81EA\u5B9A\u4E49\u4EE3\u7801\u4E0E\u4EFF\u771F\u8FC7\u7A0B\u4EA4\u4E92
|
||||
|
@ -2,6 +2,9 @@ package net.sf.openrocket.logging;
|
||||
|
||||
import net.sf.openrocket.util.BugException;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* A set that contains multiple <code>Warning</code>s. When adding a
|
||||
* {@link Warning} to this set, the contents is checked for a warning of the
|
||||
@ -39,6 +42,29 @@ public class WarningSet extends MessageSet<Warning> {
|
||||
return getNrOfMessagesWithPriority(MessagePriority.LOW);
|
||||
}
|
||||
|
||||
public List<Warning> getCriticalWarnings() {
|
||||
List<Message> list = getMessagesWithPriority(MessagePriority.HIGH);
|
||||
return convertMessageListToWarningList(list);
|
||||
}
|
||||
|
||||
public List<Warning> getNormalWarnings() {
|
||||
List<Message> list = getMessagesWithPriority(MessagePriority.NORMAL);
|
||||
return convertMessageListToWarningList(list);
|
||||
}
|
||||
|
||||
public List<Warning> getInformativeWarnings() {
|
||||
List<Message> list = getMessagesWithPriority(MessagePriority.LOW);
|
||||
return convertMessageListToWarningList(list);
|
||||
}
|
||||
|
||||
private static List<Warning> convertMessageListToWarningList(List<Message> list) {
|
||||
List<Warning> warnings = new ArrayList<>(list.size());
|
||||
for (Message m : list) {
|
||||
warnings.add((Warning) m);
|
||||
}
|
||||
return warnings;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WarningSet clone() {
|
||||
try {
|
||||
|
@ -1,8 +1,11 @@
|
||||
package net.sf.openrocket.gui.components;
|
||||
|
||||
import net.sf.openrocket.gui.util.Icons;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Font;
|
||||
|
||||
import javax.swing.Icon;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.SwingConstants;
|
||||
|
||||
@ -58,6 +61,10 @@ public class StyledLabel extends JLabel {
|
||||
checkPreferredSize(size, Style.PLAIN);
|
||||
}
|
||||
|
||||
public StyledLabel(Icon icon, float size) {
|
||||
super(Icons.getScaledIcon(icon, size));
|
||||
}
|
||||
|
||||
|
||||
|
||||
public StyledLabel(Style style) {
|
||||
|
@ -57,7 +57,7 @@ public abstract class ErrorWarningDialog {
|
||||
Error[] e = errors.toArray(new Error[0]);
|
||||
final JList<Error> errorList = new JList<>(e);
|
||||
errorList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
||||
errorList.setCellRenderer(new ErrorListCellRenderer());
|
||||
errorList.setCellRenderer(new BetterListCellRenderer(darkErrorColor));
|
||||
JScrollPane errorPane = new JScrollPane(errorList);
|
||||
errorList.setBorder(border);
|
||||
content.add(errorPane, "wrap, growx");
|
||||
@ -99,21 +99,4 @@ public abstract class ErrorWarningDialog {
|
||||
title, JOptionPane.WARNING_MESSAGE);
|
||||
|
||||
}
|
||||
|
||||
private static class ErrorListCellRenderer extends BetterListCellRenderer {
|
||||
@Override
|
||||
public Component getListCellRendererComponent(JList<?> list, Object value, int index,
|
||||
boolean isSelected, boolean cellHasFocus) {
|
||||
JLabel label = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
|
||||
|
||||
// Text color
|
||||
if (isSelected) {
|
||||
label.setForeground(textSelectionForegroundColor);
|
||||
} else {
|
||||
label.setForeground(darkErrorColor);
|
||||
}
|
||||
|
||||
return label;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -196,7 +196,7 @@ public class BasicFrame extends JFrame {
|
||||
log.debug("Constructing the BasicFrame UI");
|
||||
|
||||
//// Top segment, tabbed pane
|
||||
simulationPanel = new SimulationPanel(document);
|
||||
simulationPanel = new SimulationPanel(this, document);
|
||||
{
|
||||
// Obtain the simulation selection model that will be used
|
||||
simulationSelectionModel = simulationPanel.getSimulationListSelectionModel();
|
||||
|
@ -7,6 +7,7 @@ import java.awt.Component;
|
||||
import java.awt.Container;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Toolkit;
|
||||
import java.awt.Window;
|
||||
import java.awt.datatransfer.Clipboard;
|
||||
import java.awt.datatransfer.DataFlavor;
|
||||
import java.awt.datatransfer.StringSelection;
|
||||
@ -53,7 +54,7 @@ import net.sf.openrocket.gui.util.SwingPreferences;
|
||||
import net.sf.openrocket.gui.util.UITheme;
|
||||
import net.sf.openrocket.gui.widgets.SaveFileChooser;
|
||||
import net.sf.openrocket.logging.Message;
|
||||
import net.sf.openrocket.logging.MessagePriority;
|
||||
import net.sf.openrocket.logging.Warning;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@ -73,7 +74,6 @@ import net.sf.openrocket.gui.adaptors.ColumnTableRowSorter;
|
||||
import net.sf.openrocket.gui.adaptors.ValueColumn;
|
||||
import net.sf.openrocket.gui.components.StyledLabel;
|
||||
import net.sf.openrocket.gui.simulation.SimulationRunDialog;
|
||||
import net.sf.openrocket.gui.simulation.SimulationWarningDialog;
|
||||
import net.sf.openrocket.gui.util.Icons;
|
||||
import net.sf.openrocket.gui.widgets.IconButton;
|
||||
import net.sf.openrocket.l10n.Translator;
|
||||
@ -101,6 +101,7 @@ public class SimulationPanel extends JPanel {
|
||||
private RocketDescriptor descriptor = Application.getInjector().getInstance(RocketDescriptor.class);
|
||||
|
||||
|
||||
private final Window parent;
|
||||
private final OpenRocketDocument document;
|
||||
|
||||
private final ColumnTableModel simulationTableModel;
|
||||
@ -136,9 +137,10 @@ public class SimulationPanel extends JPanel {
|
||||
initColors();
|
||||
}
|
||||
|
||||
public SimulationPanel(OpenRocketDocument doc) {
|
||||
public SimulationPanel(Window parent, OpenRocketDocument doc) {
|
||||
super(new MigLayout("fill", "[grow][][][][][][grow]"));
|
||||
|
||||
this.parent = parent;
|
||||
this.document = doc;
|
||||
|
||||
|
||||
@ -261,7 +263,10 @@ public class SimulationPanel extends JPanel {
|
||||
int selected = simulationTable.convertRowIndexToModel(selectedRow);
|
||||
// Show the warnings for the simulation
|
||||
if (column == 1) {
|
||||
SimulationWarningDialog.showWarningDialog(SimulationPanel.this, document.getSimulations().get(selected));
|
||||
SimulationConfigDialog dialog = new SimulationConfigDialog(parent, document, false,
|
||||
document.getSimulations().get(selected));
|
||||
dialog.switchToWarningsTab();
|
||||
dialog.setVisible(true);
|
||||
}
|
||||
// Edit the simulation or plot/export
|
||||
else if (column > 1) {
|
||||
@ -844,9 +849,9 @@ public class SimulationPanel extends JPanel {
|
||||
return tip.toString();
|
||||
}
|
||||
|
||||
List<Message> criticalWarnings = warnings.getMessagesWithPriority(MessagePriority.HIGH);
|
||||
List<Message> normalWarnings = warnings.getMessagesWithPriority(MessagePriority.NORMAL);
|
||||
List<Message> informativeWarnings = warnings.getMessagesWithPriority(MessagePriority.LOW);
|
||||
List<Warning> criticalWarnings = warnings.getCriticalWarnings();
|
||||
List<Warning> normalWarnings = warnings.getNormalWarnings();
|
||||
List<Warning> informativeWarnings = warnings.getInformativeWarnings();
|
||||
|
||||
// Critical warnings
|
||||
if (!criticalWarnings.isEmpty()) {
|
||||
|
@ -64,8 +64,9 @@ public class SimulationConfigDialog extends JDialog {
|
||||
private final boolean isNewSimulation; // Whether you are editing a new simulation, or an existing one
|
||||
|
||||
private static final int SETTINGS_IDX = 0;
|
||||
private static final int PLOT_IDX = 1;
|
||||
private static final int EXPORT_IDX = 2;
|
||||
private static final int WARNINGS_IDX = 1;
|
||||
private static final int PLOT_IDX = 2;
|
||||
private static final int EXPORT_IDX = 3;
|
||||
|
||||
private final SimulationPlotPanel plotTab;
|
||||
private final SimulationExportPanel exportTab;
|
||||
@ -106,11 +107,19 @@ public class SimulationConfigDialog extends JDialog {
|
||||
|
||||
//// Simulation Settings
|
||||
final SimulationSettingsPanel settingsTab = new SimulationSettingsPanel(document, simulationList[0]);
|
||||
tabbedPane.addTab(trans.get("simedtdlg.tab.Settings"), settingsTab);
|
||||
tabbedPane.addTab(trans.get("SimulationConfigDialog.tab.Settings"), settingsTab);
|
||||
|
||||
//// Simulation Warnings
|
||||
final SimulationWarningsPanel warningsTab = new SimulationWarningsPanel(simulationList[0]);
|
||||
tabbedPane.addTab(trans.get("SimulationConfigDialog.tab.Warnings"), warningsTab);
|
||||
if (isMultiCompEdit()) {
|
||||
tabbedPane.setEnabledAt(WARNINGS_IDX, false);
|
||||
tabbedPane.setToolTipTextAt(WARNINGS_IDX, trans.get("SimulationConfigDialog.tab.warnDis.ttip"));
|
||||
}
|
||||
|
||||
//// Plot data
|
||||
this.plotTab = new SimulationPlotPanel(simulationList[0]);
|
||||
tabbedPane.addTab(trans.get("simedtdlg.tab.Plotdata"), plotTab);
|
||||
tabbedPane.addTab(trans.get("SimulationConfigDialog.tab.Plotdata"), plotTab);
|
||||
if (isMultiCompEdit()) {
|
||||
tabbedPane.setEnabledAt(PLOT_IDX, false);
|
||||
tabbedPane.setToolTipTextAt(PLOT_IDX, trans.get("SimulationConfigDialog.tab.plotDis.ttip"));
|
||||
@ -118,7 +127,7 @@ public class SimulationConfigDialog extends JDialog {
|
||||
|
||||
//// Export data
|
||||
this.exportTab = new SimulationExportPanel(simulationList[0]);
|
||||
tabbedPane.addTab(trans.get("simedtdlg.tab.Exportdata"), exportTab);
|
||||
tabbedPane.addTab(trans.get("SimulationConfigDialog.tab.Exportdata"), exportTab);
|
||||
if (isMultiCompEdit()) {
|
||||
tabbedPane.setEnabledAt(EXPORT_IDX, false);
|
||||
tabbedPane.setToolTipTextAt(EXPORT_IDX, trans.get("SimulationConfigDialog.tab.expDis.ttip"));
|
||||
@ -143,16 +152,24 @@ public class SimulationConfigDialog extends JDialog {
|
||||
case SETTINGS_IDX:
|
||||
okButton.setText(trans.get("dlg.but.ok"));
|
||||
cancelButton.setText(trans.get("dlg.but.cancel"));
|
||||
cancelButton.setVisible(true);
|
||||
SimulationConfigDialog.this.revalidate();
|
||||
break;
|
||||
case WARNINGS_IDX:
|
||||
okButton.setText(trans.get("dlg.but.close"));
|
||||
cancelButton.setVisible(false);
|
||||
SimulationConfigDialog.this.revalidate();
|
||||
break;
|
||||
case PLOT_IDX:
|
||||
okButton.setText(trans.get("SimulationConfigDialog.btn.plot"));
|
||||
cancelButton.setText(trans.get("dlg.but.close"));
|
||||
cancelButton.setVisible(true);
|
||||
SimulationConfigDialog.this.revalidate();
|
||||
break;
|
||||
case EXPORT_IDX:
|
||||
okButton.setText(trans.get("SimulationConfigDialog.btn.export"));
|
||||
cancelButton.setText(trans.get("dlg.but.close"));
|
||||
cancelButton.setVisible(true);
|
||||
SimulationConfigDialog.this.revalidate();
|
||||
break;
|
||||
}
|
||||
@ -190,6 +207,10 @@ public class SimulationConfigDialog extends JDialog {
|
||||
tabbedPane.setSelectedIndex(SETTINGS_IDX);
|
||||
}
|
||||
|
||||
public void switchToWarningsTab() {
|
||||
tabbedPane.setSelectedIndex(WARNINGS_IDX);
|
||||
}
|
||||
|
||||
public void switchToPlotTab() {
|
||||
tabbedPane.setSelectedIndex(PLOT_IDX);
|
||||
}
|
||||
|
@ -1,32 +0,0 @@
|
||||
package net.sf.openrocket.gui.simulation;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
import net.sf.openrocket.logging.Warning;
|
||||
import net.sf.openrocket.document.Simulation;
|
||||
import net.sf.openrocket.gui.dialogs.DetailDialog;
|
||||
import net.sf.openrocket.l10n.Translator;
|
||||
import net.sf.openrocket.startup.Application;
|
||||
|
||||
public class SimulationWarningDialog {
|
||||
|
||||
private static final Translator trans = Application.getTranslator();
|
||||
|
||||
public static void showWarningDialog(Component parent, Simulation simulation) {
|
||||
|
||||
if (simulation.getSimulatedWarnings() != null && simulation.getSimulatedWarnings().size() > 0) {
|
||||
ArrayList<String> messages = new ArrayList<String>();
|
||||
messages.add(trans.get("SimuRunDlg.msg.errorOccurred"));
|
||||
for (Warning m : simulation.getSimulatedWarnings()) {
|
||||
messages.add(m.toString());
|
||||
}
|
||||
DetailDialog.showDetailedMessageDialog(parent,
|
||||
messages.toArray(),
|
||||
null, simulation.getName(), JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,111 @@
|
||||
package net.sf.openrocket.gui.simulation;
|
||||
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import net.sf.openrocket.document.Simulation;
|
||||
import net.sf.openrocket.gui.components.StyledLabel;
|
||||
import net.sf.openrocket.gui.util.BetterListCellRenderer;
|
||||
import net.sf.openrocket.gui.util.GUIUtil;
|
||||
import net.sf.openrocket.gui.util.Icons;
|
||||
import net.sf.openrocket.gui.util.UITheme;
|
||||
import net.sf.openrocket.l10n.Translator;
|
||||
import net.sf.openrocket.logging.Warning;
|
||||
import net.sf.openrocket.logging.WarningSet;
|
||||
import net.sf.openrocket.startup.Application;
|
||||
|
||||
import javax.swing.DefaultListSelectionModel;
|
||||
import javax.swing.Icon;
|
||||
import javax.swing.JList;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.border.Border;
|
||||
import java.awt.Color;
|
||||
import java.util.List;
|
||||
|
||||
public class SimulationWarningsPanel extends JPanel {
|
||||
private static final Translator trans = Application.getTranslator();
|
||||
|
||||
private static Border border;
|
||||
private static Color darkErrorColor;
|
||||
private static Color warningColor;
|
||||
private static Color informationColor;
|
||||
|
||||
static {
|
||||
initColors();
|
||||
}
|
||||
|
||||
public SimulationWarningsPanel(final Simulation simulation) {
|
||||
super(new MigLayout("fill"));
|
||||
|
||||
WarningSet warnings = simulation.getSimulatedWarnings();
|
||||
List<Warning> criticalWarnings = warnings.getCriticalWarnings();
|
||||
List<Warning> normalWarnings = warnings.getNormalWarnings();
|
||||
List<Warning> informativeWarnings = warnings.getInformativeWarnings();
|
||||
|
||||
// Critical warnings
|
||||
JPanel criticalPanel = createWarningsPanel(criticalWarnings, Icons.WARNING_HIGH, trans.get("SimulationWarningsPanel.lbl.CriticalWarnings"), darkErrorColor);
|
||||
this.add(criticalPanel, "spanx, grow, wrap 3lp");
|
||||
|
||||
// Normal warnings
|
||||
JPanel normalPanel = createWarningsPanel(normalWarnings, Icons.WARNING_NORMAL, trans.get("SimulationWarningsPanel.lbl.NormalWarnings"), warningColor);
|
||||
this.add(normalPanel, "spanx, grow, wrap 5lp");
|
||||
|
||||
// Informative warnings
|
||||
//JPanel infoPanel = createWarningsPanel(informativeWarnings, Icons.WARNING_LOW, trans.get("SimulationWarningsPanel.lbl.InformativeWarnings"), informationColor);
|
||||
//this.add(infoPanel, "spanx, grow, wrap 5lp");
|
||||
|
||||
JPanel filler = new JPanel();
|
||||
this.add(filler, "grow, spanx, pushy");
|
||||
}
|
||||
|
||||
private static void initColors() {
|
||||
updateColors();
|
||||
UITheme.Theme.addUIThemeChangeListener(SimulationWarningsPanel::updateColors);
|
||||
}
|
||||
|
||||
private static void updateColors() {
|
||||
border = GUIUtil.getUITheme().getBorder();
|
||||
darkErrorColor = GUIUtil.getUITheme().getDarkErrorColor();
|
||||
warningColor = GUIUtil.getUITheme().getWarningColor();
|
||||
informationColor = GUIUtil.getUITheme().getInformationColor();
|
||||
}
|
||||
|
||||
private static JPanel createWarningsPanel(final List<Warning> warnings, final Icon icon, final String titleText, Color textColor) {
|
||||
JPanel panel = new JPanel(new MigLayout("fillx"));
|
||||
|
||||
// Title
|
||||
float size = 1.1f;
|
||||
StyledLabel title = new StyledLabel(warnings.size() + " " + titleText, size, StyledLabel.Style.BOLD);
|
||||
title.setFontColor(textColor);
|
||||
panel.add(title, "wrap, spanx");
|
||||
|
||||
if (warnings.isEmpty()) {
|
||||
return panel;
|
||||
}
|
||||
|
||||
// Warning list
|
||||
Warning[] w = warnings.toArray(new Warning[0]);
|
||||
final JList<Warning> warningList = new JList<>(w);
|
||||
warningList.setSelectionModel(new NoSelectionModel()); // Disable selection
|
||||
warningList.setCellRenderer(new BetterListCellRenderer(icon));
|
||||
JScrollPane warningPane = new JScrollPane(warningList);
|
||||
warningList.setBorder(border);
|
||||
panel.add(warningPane, "wrap, spanx, growx");
|
||||
|
||||
return panel;
|
||||
}
|
||||
|
||||
private static class NoSelectionModel extends DefaultListSelectionModel {
|
||||
|
||||
@Override
|
||||
public void setAnchorSelectionIndex(final int anchorIndex) {}
|
||||
|
||||
@Override
|
||||
public void setLeadAnchorNotificationEnabled(final boolean flag) {}
|
||||
|
||||
@Override
|
||||
public void setLeadSelectionIndex(final int leadIndex) {}
|
||||
|
||||
@Override
|
||||
public void setSelectionInterval(final int index0, final int index1) { }
|
||||
}
|
||||
}
|
@ -2,6 +2,7 @@ package net.sf.openrocket.gui.util;
|
||||
|
||||
|
||||
import javax.swing.DefaultListCellRenderer;
|
||||
import javax.swing.Icon;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JList;
|
||||
import java.awt.Color;
|
||||
@ -17,16 +18,41 @@ public class BetterListCellRenderer extends DefaultListCellRenderer {
|
||||
private static Color rowBackgroundLighterColor;
|
||||
private static Color textSelectionForegroundColor;
|
||||
private static Color textColor;
|
||||
private final Color textColorOverride;
|
||||
private final Icon icon;
|
||||
|
||||
static {
|
||||
initColors();
|
||||
}
|
||||
|
||||
public BetterListCellRenderer(Icon icon, Color textColor) {
|
||||
this.icon = icon;
|
||||
this.textColorOverride = textColor;
|
||||
}
|
||||
|
||||
public BetterListCellRenderer(Icon icon) {
|
||||
this(icon, null);
|
||||
}
|
||||
|
||||
public BetterListCellRenderer(Color textColor) {
|
||||
this(null, textColor);
|
||||
}
|
||||
|
||||
public BetterListCellRenderer() {
|
||||
this.icon = null;
|
||||
this.textColorOverride = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component getListCellRendererComponent(JList<?> list, Object value, int index,
|
||||
boolean isSelected, boolean cellHasFocus) {
|
||||
JLabel label = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
|
||||
|
||||
if (icon != null) {
|
||||
label.setIcon(icon);
|
||||
label.setIconTextGap(10);
|
||||
}
|
||||
|
||||
// Alternating row colors
|
||||
if (!isSelected) {
|
||||
if (index % 2 == 0) {
|
||||
@ -39,7 +65,7 @@ public class BetterListCellRenderer extends DefaultListCellRenderer {
|
||||
if (isSelected) {
|
||||
label.setForeground(textSelectionForegroundColor);
|
||||
} else {
|
||||
label.setForeground(textColor);
|
||||
label.setForeground(textColorOverride != null ? textColorOverride : textColor);
|
||||
}
|
||||
return label;
|
||||
}
|
||||
|
@ -230,7 +230,7 @@ public class UITheme {
|
||||
|
||||
@Override
|
||||
public Color getWarningColor() {
|
||||
return new Color(192, 135, 0);
|
||||
return new Color(217, 152, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
x
Reference in New Issue
Block a user