Merge remote-tracking branch 'refs/remotes/origin/store-more-initial-data' into store-more-initial-data

This commit is contained in:
JoePfeiffer 2024-06-06 11:18:13 -06:00
commit 7b0637e800
13 changed files with 36 additions and 129 deletions

@ -1 +1 @@
Subproject commit 93054dc2b40d5196433b1d91c636cee2e9dda424
Subproject commit 48eb2172d58c0db6042bd847a782835df056b287

View File

@ -1,23 +0,0 @@
package info.openrocket.core.file.configuration;
import java.util.ArrayList;
import java.util.List;
public class XmlContainerElement extends XmlElement {
private final ArrayList<XmlElement> subelements = new ArrayList<XmlElement>();
public XmlContainerElement(String name) {
super(name);
}
public void addElement(XmlElement element) {
subelements.add(element);
}
@SuppressWarnings("unchecked")
public List<XmlElement> getElements() {
return (List<XmlElement>) subelements.clone();
}
}

View File

@ -1,27 +0,0 @@
package info.openrocket.core.file.configuration;
/**
* A simple XML element that contains textual content.
*
* @author Sampo Niskanen <sampo.niskanen@iki.fi>
*/
public class XmlContentElement extends XmlElement {
private String content = "";
public XmlContentElement(String name) {
super(name);
}
public String getContent() {
return content;
}
public void setContent(String content) {
if (content == null) {
throw new IllegalArgumentException("XML content cannot be null");
}
this.content = content;
}
}

View File

@ -1,43 +0,0 @@
package info.openrocket.core.file.configuration;
import java.util.HashMap;
import java.util.Map;
/**
* A base simple XML element. A simple XML element can contain either other XML
* elements
* (XmlContainerElement) or textual content (XmlContentElement), but not both.
*
* @author Sampo Niskanen <sampo.niskanen@iki.fi>
*/
public abstract class XmlElement {
private final String name;
private final HashMap<String, String> attributes = new HashMap<String, String>();
public XmlElement(String name) {
this.name = name;
}
public String getName() {
return name;
}
public void setAttribute(String key, String value) {
attributes.put(key, value);
}
public void removeAttribute(String key) {
attributes.remove(key);
}
public String getAttribute(String key) {
return attributes.get(key);
}
@SuppressWarnings("unchecked")
public Map<String, String> getAttributes() {
return (Map<String, String>) attributes.clone();
}
}

View File

@ -392,14 +392,14 @@ public class FlightDataType implements Comparable<FlightDataType> {
// if something has changed, then we need to remove the old one
// otherwise, just return what we found
if (!u.equals(type.getUnitGroup())) {
oldPriority = type.groupPriority;
oldPriority = type.priority;
EXISTING_TYPES.remove(type);
log.info("Unitgroup of type " + type.getName() +
", has changed from " + type.getUnitGroup().toString() +
" to " + u.toString() +
". Removing old version.");
} else if (!s.equals(type.getName())) {
oldPriority = type.groupPriority;
oldPriority = type.priority;
EXISTING_TYPES.remove(type);
log.info("Name of type " + type.getName() + ", has changed to " + s + ". Removing old version.");
} else {
@ -459,7 +459,7 @@ public class FlightDataType implements Comparable<FlightDataType> {
private final String symbol;
private final UnitGroup units;
private final FlightDataTypeGroup group;
private final int groupPriority;
private final int priority;
private final int hashCode;
private FlightDataType(String typeName, String symbol, UnitGroup units, FlightDataTypeGroup group, int priority) {
@ -471,7 +471,7 @@ public class FlightDataType implements Comparable<FlightDataType> {
this.symbol = symbol;
this.units = units;
this.group = group;
this.groupPriority = priority;
this.priority = priority;
this.hashCode = this.name.toLowerCase(Locale.ENGLISH).hashCode();
}
@ -492,7 +492,7 @@ public class FlightDataType implements Comparable<FlightDataType> {
}
public int getGroupPriority() {
return groupPriority;
return group.getPriority();
}
@Override
@ -501,10 +501,10 @@ public class FlightDataType implements Comparable<FlightDataType> {
}
@Override
public boolean equals(Object other) {
if (!(other instanceof FlightDataType))
public boolean equals(Object o) {
if (!(o instanceof FlightDataType))
return false;
return this.name.equalsIgnoreCase(((FlightDataType) other).name);
return this.compareTo((FlightDataType) o) == 0;
}
@Override
@ -514,8 +514,11 @@ public class FlightDataType implements Comparable<FlightDataType> {
@Override
public int compareTo(FlightDataType o) {
if (this.groupPriority != o.groupPriority)
return this.groupPriority - o.groupPriority;
return this.name.compareToIgnoreCase(o.name);
final int groupCompare = this.getGroup().compareTo(o.getGroup());
if (groupCompare != 0) {
return groupCompare;
}
return this.priority - o.priority;
}
}

View File

@ -3,7 +3,7 @@ package info.openrocket.core.simulation;
import info.openrocket.core.l10n.Translator;
import info.openrocket.core.startup.Application;
public class FlightDataTypeGroup {
public class FlightDataTypeGroup implements Comparable<FlightDataTypeGroup> {
private static final Translator trans = Application.getTranslator();
public static final FlightDataTypeGroup TIME = new FlightDataTypeGroup(trans.get("FlightDataTypeGroup.GROUP_TIME"), 0);
@ -56,4 +56,16 @@ public class FlightDataTypeGroup {
public String toString() {
return getName();
}
@Override
public boolean equals(Object o) {
if (!(o instanceof FlightDataTypeGroup))
return false;
return this.compareTo((FlightDataTypeGroup) o) == 0;
}
@Override
public int compareTo(FlightDataTypeGroup o) {
return this.priority - o.priority;
}
}

View File

@ -40,7 +40,6 @@ open module info.openrocket.core {
exports info.openrocket.core.document.attachments;
exports info.openrocket.core.document.events;
exports info.openrocket.core.file;
exports info.openrocket.core.file.configuration;
exports info.openrocket.core.file.iterator;
exports info.openrocket.core.file.motor;
exports info.openrocket.core.file.openrocket;

View File

@ -343,8 +343,8 @@ pref.dlg.RockSimfiles = RockSim engine files (*.rse)
pref.dlg.ZIParchives = ZIP archives (*.zip)
pref.dlg.checkbox.Checkupdates = Always check for software updates at startup
pref.dlg.checkbox.Checkupdates.ttip = Check for software updates every time you start up OpenRocket
pref.dlg.checkbox.CheckBetaupdates = Also check for beta releases
pref.dlg.checkbox.CheckBetaupdates.ttip = If checked, beta release updates are also notified. If unchecked, only official releases are considered.
pref.dlg.checkbox.CheckBetaupdates = Also check for pre-releases
pref.dlg.checkbox.CheckBetaupdates.ttip = If checked, pre-release (e.g. beta releases) updates are also notified. If unchecked, only official releases are considered.
pref.dlg.ttip.Checkupdatesnow = Check for software updates now
pref.dlg.lbl.Selectprefunits = Select your preferred units:
pref.dlg.lbl.Rocketinfofontsize = Size of text in rocket design panel:
@ -493,13 +493,13 @@ simedtdlg.lbl.Length = Length:
simedtdlg.lbl.ttip.Length = The length of the launch rod.
simedtdlg.checkbox.Intowind = Always launch directly up-wind or down-wind
simedtdlg.checkbox.ttip.Intowind1 = <html>Makes the launch rod point into the wind.<br>
simedtdlg.checkbox.ttip.Intowind2 = A zero launchrod angle will point directly up. <br>
simedtdlg.checkbox.ttip.Intowind3 = A negative launchrod angle will launch with the wind.<br>If you uncheck this box you can point the launchrod any direction you please.
simedtdlg.checkbox.ttip.Intowind2 = A zero launch rod angle will point directly up (vertical). <br>
simedtdlg.checkbox.ttip.Intowind3 = A negative launch rod angle will launch with the wind.<br>
simedtdlg.checkbox.ttip.Intowind4 = If you uncheck this box you can point the launchrod any direction you please.
simedtdlg.lbl.Angle = Angle:
simedtdlg.lbl.ttip.Angle = <html>The angle of the launch rod from vertical.<br> Positive angles point North of launch.
simedtdlg.lbl.ttip.Angle = <html>The angle of the launch rod from vertical.<br> If set to always launch up-wind or down-wind, positive angles are up-wind, negative angles down-wind.<br> If set for a manual direction, positive angles towards the direction axis.<br> E.g. if direction is set to 90° (East of the wind), positive angles will point the launch rod East. Negative angles will point the rod West.
simedtdlg.lbl.Direction = Direction:
simedtdlg.lbl.ttip.Direction1 = <html>Direction of the launch rod relative to the wind.<br>
simedtdlg.lbl.ttip.Direction1 = <html>Direction of the launch rod relative to the wind direction.<br> E.g. 90° is East of the wind direction. <br>
simedtdlg.lbl.ttip.Direction2 = -
simedtdlg.lbl.ttip.Direction3 = 0 is North.
simedtdlg.border.Simopt = Simulator options

View File

@ -76,19 +76,6 @@ public class DesignPreferencesPanel extends PreferencesPanel {
spin.setEditor(new SpinnerEditor(spin));
this.add(spin, "wrap");
final JCheckBox autoOpenDesignFile = new JCheckBox(
trans.get("pref.dlg.but.openlast"));
autoOpenDesignFile.setSelected(preferences
.isAutoOpenLastDesignOnStartupEnabled());
autoOpenDesignFile.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
preferences.setAutoOpenLastDesignOnStartup(autoOpenDesignFile
.isSelected());
}
});
this.add(autoOpenDesignFile, "wrap, growx, span 2");
// // Always open leftmost tab when opening a component edit dialog
final JCheckBox alwaysOpenLeftmostTab = new JCheckBox(
trans.get("pref.dlg.checkbox.AlwaysOpenLeftmost"));

View File

@ -46,7 +46,6 @@ public final class ExampleDesignFileAction extends JMenu {
"Pods--powered with recovery deployment",
null,
// Examples demonstrating customized functionality
"Presets",
"Simulation extensions",
"Simulation scripting"
};