Merge remote-tracking branch 'upstream/master' into kruland-integration
Conflicts: core/resources/l10n/messages_fr.properties core/src/net/sf/openrocket/gui/dialogs/preferences/PreferencesDialog.java
This commit is contained in:
commit
701b8966a2
@ -1,4 +1,3 @@
|
|||||||
#
|
|
||||||
# French base translation file
|
# French base translation file
|
||||||
# Translated by Tripoli France
|
# Translated by Tripoli France
|
||||||
# Should you need to add new logical keys here is the proposed method
|
# Should you need to add new logical keys here is the proposed method
|
||||||
|
File diff suppressed because it is too large
Load Diff
1576
core/resources/l10n/messages_pt.properties
Normal file
1576
core/resources/l10n/messages_pt.properties
Normal file
File diff suppressed because it is too large
Load Diff
@ -62,23 +62,23 @@ import net.sf.openrocket.util.Utils;
|
|||||||
|
|
||||||
public class PreferencesDialog extends JDialog {
|
public class PreferencesDialog extends JDialog {
|
||||||
private static final LogHelper log = Application.getLogger();
|
private static final LogHelper log = Application.getLogger();
|
||||||
|
|
||||||
private final List<DefaultUnitSelector> unitSelectors = new ArrayList<DefaultUnitSelector>();
|
private final List<DefaultUnitSelector> unitSelectors = new ArrayList<DefaultUnitSelector>();
|
||||||
|
|
||||||
private File defaultDirectory = null;
|
private File defaultDirectory = null;
|
||||||
private static final Translator trans = Application.getTranslator();
|
private static final Translator trans = Application.getTranslator();
|
||||||
|
|
||||||
private final SwingPreferences preferences = (SwingPreferences) Application.getPreferences();
|
private final SwingPreferences preferences = (SwingPreferences) Application.getPreferences();
|
||||||
|
|
||||||
private PreferencesDialog(Window parent) {
|
private PreferencesDialog(Window parent) {
|
||||||
//// Preferences
|
//// Preferences
|
||||||
super(parent, trans.get("pref.dlg.title.Preferences"), Dialog.ModalityType.APPLICATION_MODAL);
|
super(parent, trans.get("pref.dlg.title.Preferences"), Dialog.ModalityType.APPLICATION_MODAL);
|
||||||
|
|
||||||
JPanel panel = new JPanel(new MigLayout("fill, gap unrel", "[grow]", "[grow][]"));
|
JPanel panel = new JPanel(new MigLayout("fill, gap unrel", "[grow]", "[grow][]"));
|
||||||
|
|
||||||
JTabbedPane tabbedPane = new JTabbedPane();
|
JTabbedPane tabbedPane = new JTabbedPane();
|
||||||
panel.add(tabbedPane, "grow, wrap");
|
panel.add(tabbedPane, "grow, wrap");
|
||||||
|
|
||||||
//// Units and Default units
|
//// Units and Default units
|
||||||
tabbedPane.addTab(trans.get("pref.dlg.tab.Units"), null, unitsPane(),
|
tabbedPane.addTab(trans.get("pref.dlg.tab.Units"), null, unitsPane(),
|
||||||
trans.get("pref.dlg.tab.Defaultunits"));
|
trans.get("pref.dlg.tab.Defaultunits"));
|
||||||
@ -101,26 +101,26 @@ public class PreferencesDialog extends JDialog {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
panel.add(close, "span, right, tag close");
|
panel.add(close, "span, right, tag close");
|
||||||
|
|
||||||
this.setContentPane(panel);
|
this.setContentPane(panel);
|
||||||
pack();
|
pack();
|
||||||
this.setLocationRelativeTo(null);
|
this.setLocationRelativeTo(null);
|
||||||
|
|
||||||
this.addWindowListener(new WindowAdapter() {
|
this.addWindowListener(new WindowAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void windowClosed(WindowEvent e) {
|
public void windowClosed(WindowEvent e) {
|
||||||
preferences.storeDefaultUnits();
|
preferences.storeDefaultUnits();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
GUIUtil.setDisposableDialogOptions(this, close);
|
GUIUtil.setDisposableDialogOptions(this, close);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private JPanel optionsPane() {
|
private JPanel optionsPane() {
|
||||||
JPanel panel = new JPanel(new MigLayout("fillx, ins 30lp n n n"));
|
JPanel panel = new JPanel(new MigLayout("fillx, ins 30lp n n n"));
|
||||||
|
|
||||||
|
|
||||||
//// Language selector
|
//// Language selector
|
||||||
Locale userLocale = null;
|
Locale userLocale = null;
|
||||||
{
|
{
|
||||||
@ -129,11 +129,11 @@ public class PreferencesDialog extends JDialog {
|
|||||||
}
|
}
|
||||||
List<Named<Locale>> locales = new ArrayList<Named<Locale>>();
|
List<Named<Locale>> locales = new ArrayList<Named<Locale>>();
|
||||||
for (Locale l : SwingPreferences.getSupportedLocales()) {
|
for (Locale l : SwingPreferences.getSupportedLocales()) {
|
||||||
locales.add(new Named<Locale>(l, l.getDisplayLanguage()));
|
locales.add(new Named<Locale>(l, l.getDisplayLanguage(l) + "/" + l.getDisplayLanguage()));
|
||||||
}
|
}
|
||||||
Collections.sort(locales);
|
Collections.sort(locales);
|
||||||
locales.add(0, new Named<Locale>(null, trans.get("languages.default")));
|
locales.add(0, new Named<Locale>(null, trans.get("languages.default")));
|
||||||
|
|
||||||
final JComboBox languageCombo = new JComboBox(locales.toArray());
|
final JComboBox languageCombo = new JComboBox(locales.toArray());
|
||||||
for (int i = 0; i < locales.size(); i++) {
|
for (int i = 0; i < locales.size(); i++) {
|
||||||
if (Utils.equals(userLocale, locales.get(i).get())) {
|
if (Utils.equals(userLocale, locales.get(i).get())) {
|
||||||
@ -151,10 +151,10 @@ public class PreferencesDialog extends JDialog {
|
|||||||
});
|
});
|
||||||
panel.add(new JLabel(trans.get("lbl.language")), "gapright para");
|
panel.add(new JLabel(trans.get("lbl.language")), "gapright para");
|
||||||
panel.add(languageCombo, "wrap rel, growx, sg combos");
|
panel.add(languageCombo, "wrap rel, growx, sg combos");
|
||||||
|
|
||||||
panel.add(new StyledLabel(trans.get("PreferencesDialog.lbl.languageEffect"), -3, Style.ITALIC), "span, wrap para*2");
|
panel.add(new StyledLabel(trans.get("PreferencesDialog.lbl.languageEffect"), -3, Style.ITALIC), "span, wrap para*2");
|
||||||
|
|
||||||
|
|
||||||
//// Position to insert new body components:
|
//// Position to insert new body components:
|
||||||
panel.add(new JLabel(trans.get("pref.dlg.lbl.Positiontoinsert")), "gapright para");
|
panel.add(new JLabel(trans.get("pref.dlg.lbl.Positiontoinsert")), "gapright para");
|
||||||
panel.add(new JComboBox(new PrefChoiseSelector(Preferences.BODY_COMPONENT_INSERT_POSITION_KEY,
|
panel.add(new JComboBox(new PrefChoiseSelector(Preferences.BODY_COMPONENT_INSERT_POSITION_KEY,
|
||||||
@ -164,7 +164,7 @@ public class PreferencesDialog extends JDialog {
|
|||||||
trans.get("pref.dlg.PrefChoiseSelector1"),
|
trans.get("pref.dlg.PrefChoiseSelector1"),
|
||||||
trans.get("pref.dlg.PrefChoiseSelector2"),
|
trans.get("pref.dlg.PrefChoiseSelector2"),
|
||||||
trans.get("pref.dlg.PrefChoiseSelector3"))), "wrap para, growx, sg combos");
|
trans.get("pref.dlg.PrefChoiseSelector3"))), "wrap para, growx, sg combos");
|
||||||
|
|
||||||
//// Confirm deletion of simulations:
|
//// Confirm deletion of simulations:
|
||||||
panel.add(new JLabel(trans.get("pref.dlg.lbl.Confirmdeletion")));
|
panel.add(new JLabel(trans.get("pref.dlg.lbl.Confirmdeletion")));
|
||||||
panel.add(new JComboBox(new PrefBooleanSelector(Preferences.CONFIRM_DELETE_SIMULATION,
|
panel.add(new JComboBox(new PrefBooleanSelector(Preferences.CONFIRM_DELETE_SIMULATION,
|
||||||
@ -172,7 +172,7 @@ public class PreferencesDialog extends JDialog {
|
|||||||
//// Confirm
|
//// Confirm
|
||||||
trans.get("pref.dlg.PrefBooleanSelector1"),
|
trans.get("pref.dlg.PrefBooleanSelector1"),
|
||||||
trans.get("pref.dlg.PrefBooleanSelector2"), true)), "wrap 40lp, growx, sg combos");
|
trans.get("pref.dlg.PrefBooleanSelector2"), true)), "wrap 40lp, growx, sg combos");
|
||||||
|
|
||||||
//// User-defined thrust curves:
|
//// User-defined thrust curves:
|
||||||
panel.add(new JLabel(trans.get("pref.dlg.lbl.User-definedthrust")), "spanx, wrap");
|
panel.add(new JLabel(trans.get("pref.dlg.lbl.User-definedthrust")), "spanx, wrap");
|
||||||
final JTextField field = new JTextField();
|
final JTextField field = new JTextField();
|
||||||
@ -190,17 +190,17 @@ public class PreferencesDialog extends JDialog {
|
|||||||
public void removeUpdate(DocumentEvent e) {
|
public void removeUpdate(DocumentEvent e) {
|
||||||
changed();
|
changed();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void insertUpdate(DocumentEvent e) {
|
public void insertUpdate(DocumentEvent e) {
|
||||||
changed();
|
changed();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void changedUpdate(DocumentEvent e) {
|
public void changedUpdate(DocumentEvent e) {
|
||||||
changed();
|
changed();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void changed() {
|
private void changed() {
|
||||||
String text = field.getText();
|
String text = field.getText();
|
||||||
List<File> list = new ArrayList<File>();
|
List<File> list = new ArrayList<File>();
|
||||||
@ -214,7 +214,7 @@ public class PreferencesDialog extends JDialog {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
panel.add(field, "w 100px, gapright unrel, spanx, growx, split");
|
panel.add(field, "w 100px, gapright unrel, spanx, growx, split");
|
||||||
|
|
||||||
//// Add button
|
//// Add button
|
||||||
JButton button = new JButton(trans.get("pref.dlg.but.add"));
|
JButton button = new JButton(trans.get("pref.dlg.but.add"));
|
||||||
button.addActionListener(new ActionListener() {
|
button.addActionListener(new ActionListener() {
|
||||||
@ -241,7 +241,7 @@ public class PreferencesDialog extends JDialog {
|
|||||||
if (defaultDirectory != null) {
|
if (defaultDirectory != null) {
|
||||||
chooser.setCurrentDirectory(defaultDirectory);
|
chooser.setCurrentDirectory(defaultDirectory);
|
||||||
}
|
}
|
||||||
|
|
||||||
//// Add
|
//// Add
|
||||||
int returnVal = chooser.showDialog(PreferencesDialog.this, trans.get("pref.dlg.Add"));
|
int returnVal = chooser.showDialog(PreferencesDialog.this, trans.get("pref.dlg.Add"));
|
||||||
if (returnVal == JFileChooser.APPROVE_OPTION) {
|
if (returnVal == JFileChooser.APPROVE_OPTION) {
|
||||||
@ -257,10 +257,10 @@ public class PreferencesDialog extends JDialog {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
panel.add(button, "gapright unrel");
|
panel.add(button, "gapright unrel");
|
||||||
|
|
||||||
//// Reset button
|
//// Reset button
|
||||||
button = new JButton(trans.get("pref.dlg.but.reset"));
|
button = new JButton(trans.get("pref.dlg.but.reset"));
|
||||||
|
|
||||||
button.addActionListener(new ActionListener() {
|
button.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
@ -270,18 +270,18 @@ public class PreferencesDialog extends JDialog {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
panel.add(button, "wrap");
|
panel.add(button, "wrap");
|
||||||
|
|
||||||
//// Add directories, RASP motor files (*.eng), RockSim engine files (*.rse) or ZIP archives separated by a semicolon (;) to load external thrust curves. Changes will take effect the next time you start OpenRocket.
|
//// Add directories, RASP motor files (*.eng), RockSim engine files (*.rse) or ZIP archives separated by a semicolon (;) to load external thrust curves. Changes will take effect the next time you start OpenRocket.
|
||||||
DescriptionArea desc = new DescriptionArea(trans.get("pref.dlg.DescriptionArea.Adddirectories"), 3, -3, false);
|
DescriptionArea desc = new DescriptionArea(trans.get("pref.dlg.DescriptionArea.Adddirectories"), 3, -3, false);
|
||||||
desc.setBackground(getBackground());
|
desc.setBackground(getBackground());
|
||||||
panel.add(desc, "spanx, growx, wrap 40lp");
|
panel.add(desc, "spanx, growx, wrap 40lp");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//// Check for software updates at startup
|
//// Check for software updates at startup
|
||||||
final JCheckBox softwareUpdateBox =
|
final JCheckBox softwareUpdateBox =
|
||||||
new JCheckBox(trans.get("pref.dlg.checkbox.Checkupdates"));
|
new JCheckBox(trans.get("pref.dlg.checkbox.Checkupdates"));
|
||||||
softwareUpdateBox.setSelected( preferences.getCheckUpdates());
|
softwareUpdateBox.setSelected(preferences.getCheckUpdates());
|
||||||
softwareUpdateBox.addActionListener(new ActionListener() {
|
softwareUpdateBox.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
@ -289,7 +289,7 @@ public class PreferencesDialog extends JDialog {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
panel.add(softwareUpdateBox);
|
panel.add(softwareUpdateBox);
|
||||||
|
|
||||||
//// Check now button
|
//// Check now button
|
||||||
button = new JButton(trans.get("pref.dlg.but.checknow"));
|
button = new JButton(trans.get("pref.dlg.but.checknow"));
|
||||||
//// Check for software updates now
|
//// Check for software updates now
|
||||||
@ -301,8 +301,7 @@ public class PreferencesDialog extends JDialog {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
panel.add(button, "right, wrap");
|
panel.add(button, "right, wrap");
|
||||||
|
|
||||||
|
|
||||||
final JCheckBox autoOpenDesignFile = new JCheckBox(trans.get("pref.dlg.but.openlast"));
|
final JCheckBox autoOpenDesignFile = new JCheckBox(trans.get("pref.dlg.but.openlast"));
|
||||||
autoOpenDesignFile.setSelected(preferences.isAutoOpenLastDesignOnStartupEnabled());
|
autoOpenDesignFile.setSelected(preferences.isAutoOpenLastDesignOnStartupEnabled());
|
||||||
autoOpenDesignFile.addActionListener(new ActionListener() {
|
autoOpenDesignFile.addActionListener(new ActionListener() {
|
||||||
@ -312,129 +311,129 @@ public class PreferencesDialog extends JDialog {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
panel.add(autoOpenDesignFile);
|
panel.add(autoOpenDesignFile);
|
||||||
|
|
||||||
return panel;
|
return panel;
|
||||||
}
|
}
|
||||||
|
|
||||||
private JPanel unitsPane() {
|
private JPanel unitsPane() {
|
||||||
JPanel panel = new JPanel(new MigLayout("", "[][]40lp[][]"));
|
JPanel panel = new JPanel(new MigLayout("", "[][]40lp[][]"));
|
||||||
JComboBox combo;
|
JComboBox combo;
|
||||||
|
|
||||||
//// Select your preferred units:
|
//// Select your preferred units:
|
||||||
panel.add(new JLabel(trans.get("pref.dlg.lbl.Selectprefunits")), "span, wrap paragraph");
|
panel.add(new JLabel(trans.get("pref.dlg.lbl.Selectprefunits")), "span, wrap paragraph");
|
||||||
|
|
||||||
|
|
||||||
//// Rocket dimensions:
|
//// Rocket dimensions:
|
||||||
panel.add(new JLabel(trans.get("pref.dlg.lbl.Rocketdimensions")));
|
panel.add(new JLabel(trans.get("pref.dlg.lbl.Rocketdimensions")));
|
||||||
combo = new JComboBox(new DefaultUnitSelector(UnitGroup.UNITS_LENGTH));
|
combo = new JComboBox(new DefaultUnitSelector(UnitGroup.UNITS_LENGTH));
|
||||||
panel.add(combo, "sizegroup boxes");
|
panel.add(combo, "sizegroup boxes");
|
||||||
|
|
||||||
//// Line density:
|
//// Line density:
|
||||||
panel.add(new JLabel(trans.get("pref.dlg.lbl.Linedensity")));
|
panel.add(new JLabel(trans.get("pref.dlg.lbl.Linedensity")));
|
||||||
combo = new JComboBox(new DefaultUnitSelector(UnitGroup.UNITS_DENSITY_LINE));
|
combo = new JComboBox(new DefaultUnitSelector(UnitGroup.UNITS_DENSITY_LINE));
|
||||||
panel.add(combo, "sizegroup boxes, wrap");
|
panel.add(combo, "sizegroup boxes, wrap");
|
||||||
|
|
||||||
|
|
||||||
//// Motor dimensions:
|
//// Motor dimensions:
|
||||||
panel.add(new JLabel(trans.get("pref.dlg.lbl.Motordimensions")));
|
panel.add(new JLabel(trans.get("pref.dlg.lbl.Motordimensions")));
|
||||||
combo = new JComboBox(new DefaultUnitSelector(UnitGroup.UNITS_MOTOR_DIMENSIONS));
|
combo = new JComboBox(new DefaultUnitSelector(UnitGroup.UNITS_MOTOR_DIMENSIONS));
|
||||||
panel.add(combo, "sizegroup boxes");
|
panel.add(combo, "sizegroup boxes");
|
||||||
|
|
||||||
//// Surface density:
|
//// Surface density:
|
||||||
panel.add(new JLabel(trans.get("pref.dlg.lbl.Surfacedensity")));
|
panel.add(new JLabel(trans.get("pref.dlg.lbl.Surfacedensity")));
|
||||||
combo = new JComboBox(new DefaultUnitSelector(UnitGroup.UNITS_DENSITY_SURFACE));
|
combo = new JComboBox(new DefaultUnitSelector(UnitGroup.UNITS_DENSITY_SURFACE));
|
||||||
panel.add(combo, "sizegroup boxes, wrap");
|
panel.add(combo, "sizegroup boxes, wrap");
|
||||||
|
|
||||||
|
|
||||||
//// Distance:
|
//// Distance:
|
||||||
panel.add(new JLabel(trans.get("pref.dlg.lbl.Distance")));
|
panel.add(new JLabel(trans.get("pref.dlg.lbl.Distance")));
|
||||||
combo = new JComboBox(new DefaultUnitSelector(UnitGroup.UNITS_DISTANCE));
|
combo = new JComboBox(new DefaultUnitSelector(UnitGroup.UNITS_DISTANCE));
|
||||||
panel.add(combo, "sizegroup boxes");
|
panel.add(combo, "sizegroup boxes");
|
||||||
|
|
||||||
//// Bulk density::
|
//// Bulk density::
|
||||||
panel.add(new JLabel(trans.get("pref.dlg.lbl.Bulkdensity")));
|
panel.add(new JLabel(trans.get("pref.dlg.lbl.Bulkdensity")));
|
||||||
combo = new JComboBox(new DefaultUnitSelector(UnitGroup.UNITS_DENSITY_BULK));
|
combo = new JComboBox(new DefaultUnitSelector(UnitGroup.UNITS_DENSITY_BULK));
|
||||||
panel.add(combo, "sizegroup boxes, wrap");
|
panel.add(combo, "sizegroup boxes, wrap");
|
||||||
|
|
||||||
|
|
||||||
//// Velocity:
|
//// Velocity:
|
||||||
panel.add(new JLabel(trans.get("pref.dlg.lbl.Velocity")));
|
panel.add(new JLabel(trans.get("pref.dlg.lbl.Velocity")));
|
||||||
combo = new JComboBox(new DefaultUnitSelector(UnitGroup.UNITS_VELOCITY));
|
combo = new JComboBox(new DefaultUnitSelector(UnitGroup.UNITS_VELOCITY));
|
||||||
panel.add(combo, "sizegroup boxes");
|
panel.add(combo, "sizegroup boxes");
|
||||||
|
|
||||||
//// Surface roughness:
|
//// Surface roughness:
|
||||||
panel.add(new JLabel(trans.get("pref.dlg.lbl.Surfaceroughness")));
|
panel.add(new JLabel(trans.get("pref.dlg.lbl.Surfaceroughness")));
|
||||||
combo = new JComboBox(new DefaultUnitSelector(UnitGroup.UNITS_ROUGHNESS));
|
combo = new JComboBox(new DefaultUnitSelector(UnitGroup.UNITS_ROUGHNESS));
|
||||||
panel.add(combo, "sizegroup boxes, wrap");
|
panel.add(combo, "sizegroup boxes, wrap");
|
||||||
|
|
||||||
|
|
||||||
//// Acceleration:
|
//// Acceleration:
|
||||||
panel.add(new JLabel(trans.get("pref.dlg.lbl.Acceleration")));
|
panel.add(new JLabel(trans.get("pref.dlg.lbl.Acceleration")));
|
||||||
combo = new JComboBox(new DefaultUnitSelector(UnitGroup.UNITS_ACCELERATION));
|
combo = new JComboBox(new DefaultUnitSelector(UnitGroup.UNITS_ACCELERATION));
|
||||||
panel.add(combo, "sizegroup boxes");
|
panel.add(combo, "sizegroup boxes");
|
||||||
|
|
||||||
//// Area:
|
//// Area:
|
||||||
panel.add(new JLabel(trans.get("pref.dlg.lbl.Area")));
|
panel.add(new JLabel(trans.get("pref.dlg.lbl.Area")));
|
||||||
combo = new JComboBox(new DefaultUnitSelector(UnitGroup.UNITS_AREA));
|
combo = new JComboBox(new DefaultUnitSelector(UnitGroup.UNITS_AREA));
|
||||||
panel.add(combo, "sizegroup boxes, wrap");
|
panel.add(combo, "sizegroup boxes, wrap");
|
||||||
|
|
||||||
|
|
||||||
//// Mass:
|
//// Mass:
|
||||||
panel.add(new JLabel(trans.get("pref.dlg.lbl.Mass")));
|
panel.add(new JLabel(trans.get("pref.dlg.lbl.Mass")));
|
||||||
combo = new JComboBox(new DefaultUnitSelector(UnitGroup.UNITS_MASS));
|
combo = new JComboBox(new DefaultUnitSelector(UnitGroup.UNITS_MASS));
|
||||||
panel.add(combo, "sizegroup boxes");
|
panel.add(combo, "sizegroup boxes");
|
||||||
|
|
||||||
//// Angle:
|
//// Angle:
|
||||||
panel.add(new JLabel(trans.get("pref.dlg.lbl.Angle")));
|
panel.add(new JLabel(trans.get("pref.dlg.lbl.Angle")));
|
||||||
combo = new JComboBox(new DefaultUnitSelector(UnitGroup.UNITS_ANGLE));
|
combo = new JComboBox(new DefaultUnitSelector(UnitGroup.UNITS_ANGLE));
|
||||||
panel.add(combo, "sizegroup boxes, wrap");
|
panel.add(combo, "sizegroup boxes, wrap");
|
||||||
|
|
||||||
|
|
||||||
//// Force:
|
//// Force:
|
||||||
panel.add(new JLabel(trans.get("pref.dlg.lbl.Force")));
|
panel.add(new JLabel(trans.get("pref.dlg.lbl.Force")));
|
||||||
combo = new JComboBox(new DefaultUnitSelector(UnitGroup.UNITS_FORCE));
|
combo = new JComboBox(new DefaultUnitSelector(UnitGroup.UNITS_FORCE));
|
||||||
panel.add(combo, "sizegroup boxes");
|
panel.add(combo, "sizegroup boxes");
|
||||||
|
|
||||||
//// Roll rate:
|
//// Roll rate:
|
||||||
panel.add(new JLabel(trans.get("pref.dlg.lbl.Rollrate")));
|
panel.add(new JLabel(trans.get("pref.dlg.lbl.Rollrate")));
|
||||||
combo = new JComboBox(new DefaultUnitSelector(UnitGroup.UNITS_ROLL));
|
combo = new JComboBox(new DefaultUnitSelector(UnitGroup.UNITS_ROLL));
|
||||||
panel.add(combo, "sizegroup boxes, wrap");
|
panel.add(combo, "sizegroup boxes, wrap");
|
||||||
|
|
||||||
|
|
||||||
//// Total impulse:
|
//// Total impulse:
|
||||||
panel.add(new JLabel(trans.get("pref.dlg.lbl.Totalimpulse")));
|
panel.add(new JLabel(trans.get("pref.dlg.lbl.Totalimpulse")));
|
||||||
combo = new JComboBox(new DefaultUnitSelector(UnitGroup.UNITS_IMPULSE));
|
combo = new JComboBox(new DefaultUnitSelector(UnitGroup.UNITS_IMPULSE));
|
||||||
panel.add(combo, "sizegroup boxes");
|
panel.add(combo, "sizegroup boxes");
|
||||||
|
|
||||||
//// Temperature:
|
//// Temperature:
|
||||||
panel.add(new JLabel(trans.get("pref.dlg.lbl.Temperature")));
|
panel.add(new JLabel(trans.get("pref.dlg.lbl.Temperature")));
|
||||||
combo = new JComboBox(new DefaultUnitSelector(UnitGroup.UNITS_TEMPERATURE));
|
combo = new JComboBox(new DefaultUnitSelector(UnitGroup.UNITS_TEMPERATURE));
|
||||||
panel.add(combo, "sizegroup boxes, wrap");
|
panel.add(combo, "sizegroup boxes, wrap");
|
||||||
|
|
||||||
//// Moment of inertia:
|
//// Moment of inertia:
|
||||||
panel.add(new JLabel(trans.get("pref.dlg.lbl.Momentofinertia")));
|
panel.add(new JLabel(trans.get("pref.dlg.lbl.Momentofinertia")));
|
||||||
combo = new JComboBox(new DefaultUnitSelector(UnitGroup.UNITS_INERTIA));
|
combo = new JComboBox(new DefaultUnitSelector(UnitGroup.UNITS_INERTIA));
|
||||||
panel.add(combo, "sizegroup boxes");
|
panel.add(combo, "sizegroup boxes");
|
||||||
|
|
||||||
//// Pressure:
|
//// Pressure:
|
||||||
panel.add(new JLabel(trans.get("pref.dlg.lbl.Pressure")));
|
panel.add(new JLabel(trans.get("pref.dlg.lbl.Pressure")));
|
||||||
combo = new JComboBox(new DefaultUnitSelector(UnitGroup.UNITS_PRESSURE));
|
combo = new JComboBox(new DefaultUnitSelector(UnitGroup.UNITS_PRESSURE));
|
||||||
panel.add(combo, "sizegroup boxes, wrap");
|
panel.add(combo, "sizegroup boxes, wrap");
|
||||||
|
|
||||||
|
|
||||||
//// Stability:
|
//// Stability:
|
||||||
panel.add(new JLabel(trans.get("pref.dlg.lbl.Stability")));
|
panel.add(new JLabel(trans.get("pref.dlg.lbl.Stability")));
|
||||||
combo = new JComboBox(new DefaultUnitSelector(UnitGroup.UNITS_STABILITY));
|
combo = new JComboBox(new DefaultUnitSelector(UnitGroup.UNITS_STABILITY));
|
||||||
panel.add(combo, "sizegroup boxes");
|
panel.add(combo, "sizegroup boxes");
|
||||||
|
|
||||||
//// Windspeed:
|
//// Windspeed:
|
||||||
panel.add(new JLabel(trans.get("pref.dlg.lbl.Windspeed")));
|
panel.add(new JLabel(trans.get("pref.dlg.lbl.Windspeed")));
|
||||||
combo = new JComboBox(new DefaultUnitSelector(UnitGroup.UNITS_WINDSPEED));
|
combo = new JComboBox(new DefaultUnitSelector(UnitGroup.UNITS_WINDSPEED));
|
||||||
panel.add(combo, "sizegroup boxes, wrap para");
|
panel.add(combo, "sizegroup boxes, wrap para");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//// Default metric button
|
//// Default metric button
|
||||||
JButton button = new JButton(trans.get("pref.dlg.but.defaultmetric"));
|
JButton button = new JButton(trans.get("pref.dlg.but.defaultmetric"));
|
||||||
button.addActionListener(new ActionListener() {
|
button.addActionListener(new ActionListener() {
|
||||||
@ -446,7 +445,7 @@ public class PreferencesDialog extends JDialog {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
panel.add(button, "spanx, split 2, grow");
|
panel.add(button, "spanx, split 2, grow");
|
||||||
|
|
||||||
//// Default imperial button
|
//// Default imperial button
|
||||||
button = new JButton(trans.get("pref.dlg.but.defaultimperial"));
|
button = new JButton(trans.get("pref.dlg.but.defaultimperial"));
|
||||||
button.addActionListener(new ActionListener() {
|
button.addActionListener(new ActionListener() {
|
||||||
@ -458,74 +457,74 @@ public class PreferencesDialog extends JDialog {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
panel.add(button, "grow, wrap para");
|
panel.add(button, "grow, wrap para");
|
||||||
|
|
||||||
//// The effects will take place the next time you open a window.
|
//// The effects will take place the next time you open a window.
|
||||||
panel.add(new StyledLabel(
|
panel.add(new StyledLabel(
|
||||||
trans.get("pref.dlg.lbl.effect1"), -2, Style.ITALIC),
|
trans.get("pref.dlg.lbl.effect1"), -2, Style.ITALIC),
|
||||||
"spanx, wrap");
|
"spanx, wrap");
|
||||||
|
|
||||||
|
|
||||||
return panel;
|
return panel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private JPanel decalEditorPane() {
|
private JPanel decalEditorPane() {
|
||||||
|
|
||||||
JPanel panel = new JPanel(new MigLayout("fillx, ins 30lp n n n"));
|
JPanel panel = new JPanel(new MigLayout("fillx, ins 30lp n n n"));
|
||||||
|
|
||||||
ButtonGroup execGroup = new ButtonGroup();
|
ButtonGroup execGroup = new ButtonGroup();
|
||||||
|
|
||||||
JRadioButton showPrompt = new JRadioButton(trans.get("EditDecalDialog.lbl.prompt"));
|
JRadioButton showPrompt = new JRadioButton(trans.get("EditDecalDialog.lbl.prompt"));
|
||||||
showPrompt.setSelected(!preferences.isDecalEditorPreferenceSet());
|
showPrompt.setSelected(!preferences.isDecalEditorPreferenceSet());
|
||||||
showPrompt.addItemListener( new ItemListener() {
|
showPrompt.addItemListener(new ItemListener() {
|
||||||
@Override
|
@Override
|
||||||
public void itemStateChanged(ItemEvent e) {
|
public void itemStateChanged(ItemEvent e) {
|
||||||
if ( ((JRadioButton) e.getItem()).isSelected() ) {
|
if (((JRadioButton) e.getItem()).isSelected()) {
|
||||||
preferences.clearDecalEditorPreference();
|
preferences.clearDecalEditorPreference();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
panel.add(showPrompt,"wrap");
|
panel.add(showPrompt, "wrap");
|
||||||
execGroup.add(showPrompt);
|
execGroup.add(showPrompt);
|
||||||
|
|
||||||
if (Desktop.getDesktop().isSupported(Desktop.Action.EDIT) ) {
|
if (Desktop.getDesktop().isSupported(Desktop.Action.EDIT)) {
|
||||||
|
|
||||||
JRadioButton systemRadio = new JRadioButton(trans.get("EditDecalDialog.lbl.system"));
|
JRadioButton systemRadio = new JRadioButton(trans.get("EditDecalDialog.lbl.system"));
|
||||||
systemRadio.setSelected( preferences.isDecalEditorPreferenceSystem() );
|
systemRadio.setSelected(preferences.isDecalEditorPreferenceSystem());
|
||||||
systemRadio.addItemListener( new ItemListener() {
|
systemRadio.addItemListener(new ItemListener() {
|
||||||
@Override
|
@Override
|
||||||
public void itemStateChanged(ItemEvent e) {
|
public void itemStateChanged(ItemEvent e) {
|
||||||
if ( ((JRadioButton) e.getItem()).isSelected() ) {
|
if (((JRadioButton) e.getItem()).isSelected()) {
|
||||||
preferences.setDecalEditorPreference(true, null);
|
preferences.setDecalEditorPreference(true, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
panel.add(systemRadio,"wrap");
|
panel.add(systemRadio, "wrap");
|
||||||
execGroup.add(systemRadio);
|
execGroup.add(systemRadio);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean commandLineIsSelected = preferences.isDecalEditorPreferenceSet() && ! preferences.isDecalEditorPreferenceSystem();
|
boolean commandLineIsSelected = preferences.isDecalEditorPreferenceSet() && !preferences.isDecalEditorPreferenceSystem();
|
||||||
final JRadioButton commandRadio = new JRadioButton(trans.get("EditDecalDialog.lbl.cmdline"));
|
final JRadioButton commandRadio = new JRadioButton(trans.get("EditDecalDialog.lbl.cmdline"));
|
||||||
commandRadio.setSelected(commandLineIsSelected);
|
commandRadio.setSelected(commandLineIsSelected);
|
||||||
panel.add(commandRadio,"wrap");
|
panel.add(commandRadio, "wrap");
|
||||||
execGroup.add(commandRadio);
|
execGroup.add(commandRadio);
|
||||||
|
|
||||||
final JTextArea commandText = new JTextArea();
|
final JTextArea commandText = new JTextArea();
|
||||||
commandText.setEnabled(commandLineIsSelected);
|
commandText.setEnabled(commandLineIsSelected);
|
||||||
commandText.setText( commandLineIsSelected ? preferences.getDecalEditorCommandLine() : "" );
|
commandText.setText(commandLineIsSelected ? preferences.getDecalEditorCommandLine() : "");
|
||||||
commandText.getDocument().addDocumentListener( new DocumentListener() {
|
commandText.getDocument().addDocumentListener(new DocumentListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void insertUpdate(DocumentEvent e) {
|
public void insertUpdate(DocumentEvent e) {
|
||||||
preferences.setDecalEditorPreference(false, commandText.getText());
|
preferences.setDecalEditorPreference(false, commandText.getText());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeUpdate(DocumentEvent e) {
|
public void removeUpdate(DocumentEvent e) {
|
||||||
preferences.setDecalEditorPreference(false, commandText.getText());
|
preferences.setDecalEditorPreference(false, commandText.getText());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void changedUpdate(DocumentEvent e) {
|
public void changedUpdate(DocumentEvent e) {
|
||||||
preferences.setDecalEditorPreference(false, commandText.getText());
|
preferences.setDecalEditorPreference(false, commandText.getText());
|
||||||
@ -533,58 +532,58 @@ public class PreferencesDialog extends JDialog {
|
|||||||
|
|
||||||
});
|
});
|
||||||
panel.add(commandText, "growx, wrap");
|
panel.add(commandText, "growx, wrap");
|
||||||
|
|
||||||
final JButton chooser = new JButton(trans.get("EditDecalDialog.btn.chooser"));
|
final JButton chooser = new JButton(trans.get("EditDecalDialog.btn.chooser"));
|
||||||
chooser.setEnabled(commandLineIsSelected);
|
chooser.setEnabled(commandLineIsSelected);
|
||||||
chooser.addActionListener( new ActionListener() {
|
chooser.addActionListener(new ActionListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
JFileChooser fc = new JFileChooser();
|
JFileChooser fc = new JFileChooser();
|
||||||
int action = fc.showOpenDialog(SwingUtilities.windowForComponent(PreferencesDialog.this));
|
int action = fc.showOpenDialog(SwingUtilities.windowForComponent(PreferencesDialog.this));
|
||||||
if ( action == JFileChooser.APPROVE_OPTION) {
|
if (action == JFileChooser.APPROVE_OPTION) {
|
||||||
String commandLine = fc.getSelectedFile().getAbsolutePath();
|
String commandLine = fc.getSelectedFile().getAbsolutePath();
|
||||||
commandText.setText(commandLine);
|
commandText.setText(commandLine);
|
||||||
preferences.setDecalEditorPreference(false, commandLine);
|
preferences.setDecalEditorPreference(false, commandLine);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
panel.add(chooser, "growx, wrap");
|
panel.add(chooser, "growx, wrap");
|
||||||
|
|
||||||
|
|
||||||
commandRadio.addChangeListener( new ChangeListener() {
|
commandRadio.addChangeListener(new ChangeListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void stateChanged(ChangeEvent e) {
|
public void stateChanged(ChangeEvent e) {
|
||||||
boolean enabled = commandRadio.isSelected();
|
boolean enabled = commandRadio.isSelected();
|
||||||
commandText.setEnabled(enabled);
|
commandText.setEnabled(enabled);
|
||||||
chooser.setEnabled(enabled);
|
chooser.setEnabled(enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return panel;
|
return panel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private class DefaultUnitSelector extends AbstractListModel implements ComboBoxModel {
|
private class DefaultUnitSelector extends AbstractListModel implements ComboBoxModel {
|
||||||
|
|
||||||
private final UnitGroup group;
|
private final UnitGroup group;
|
||||||
|
|
||||||
public DefaultUnitSelector(UnitGroup group) {
|
public DefaultUnitSelector(UnitGroup group) {
|
||||||
this.group = group;
|
this.group = group;
|
||||||
unitSelectors.add(this);
|
unitSelectors.add(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object getSelectedItem() {
|
public Object getSelectedItem() {
|
||||||
return group.getDefaultUnit();
|
return group.getDefaultUnit();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setSelectedItem(Object item) {
|
public void setSelectedItem(Object item) {
|
||||||
if (item == null) {
|
if (item == null) {
|
||||||
@ -596,39 +595,39 @@ public class PreferencesDialog extends JDialog {
|
|||||||
}
|
}
|
||||||
group.setDefaultUnit(group.getUnitIndex((Unit) item));
|
group.setDefaultUnit(group.getUnitIndex((Unit) item));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object getElementAt(int index) {
|
public Object getElementAt(int index) {
|
||||||
return group.getUnit(index);
|
return group.getUnit(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getSize() {
|
public int getSize() {
|
||||||
return group.getUnitCount();
|
return group.getUnitCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void fireChange() {
|
public void fireChange() {
|
||||||
this.fireContentsChanged(this, 0, this.getSize());
|
this.fireContentsChanged(this, 0, this.getSize());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private class PrefChoiseSelector extends AbstractListModel implements ComboBoxModel {
|
private class PrefChoiseSelector extends AbstractListModel implements ComboBoxModel {
|
||||||
private final String preference;
|
private final String preference;
|
||||||
private final String[] descriptions;
|
private final String[] descriptions;
|
||||||
|
|
||||||
public PrefChoiseSelector(String preference, String... descriptions) {
|
public PrefChoiseSelector(String preference, String... descriptions) {
|
||||||
this.preference = preference;
|
this.preference = preference;
|
||||||
this.descriptions = descriptions;
|
this.descriptions = descriptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object getSelectedItem() {
|
public Object getSelectedItem() {
|
||||||
return descriptions[preferences.getChoice(preference, descriptions.length, 0)];
|
return descriptions[preferences.getChoice(preference, descriptions.length, 0)];
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setSelectedItem(Object item) {
|
public void setSelectedItem(Object item) {
|
||||||
if (item == null) {
|
if (item == null) {
|
||||||
@ -646,27 +645,27 @@ public class PreferencesDialog extends JDialog {
|
|||||||
if (index >= descriptions.length) {
|
if (index >= descriptions.length) {
|
||||||
throw new IllegalArgumentException("Illegal argument " + item);
|
throw new IllegalArgumentException("Illegal argument " + item);
|
||||||
}
|
}
|
||||||
|
|
||||||
preferences.putChoice(preference, index);
|
preferences.putChoice(preference, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object getElementAt(int index) {
|
public Object getElementAt(int index) {
|
||||||
return descriptions[index];
|
return descriptions[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getSize() {
|
public int getSize() {
|
||||||
return descriptions.length;
|
return descriptions.length;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private class PrefBooleanSelector extends AbstractListModel implements ComboBoxModel {
|
private class PrefBooleanSelector extends AbstractListModel implements ComboBoxModel {
|
||||||
private final String preference;
|
private final String preference;
|
||||||
private final String trueDesc, falseDesc;
|
private final String trueDesc, falseDesc;
|
||||||
private final boolean def;
|
private final boolean def;
|
||||||
|
|
||||||
public PrefBooleanSelector(String preference, String falseDescription,
|
public PrefBooleanSelector(String preference, String falseDescription,
|
||||||
String trueDescription, boolean defaultState) {
|
String trueDescription, boolean defaultState) {
|
||||||
this.preference = preference;
|
this.preference = preference;
|
||||||
@ -674,7 +673,7 @@ public class PreferencesDialog extends JDialog {
|
|||||||
this.falseDesc = falseDescription;
|
this.falseDesc = falseDescription;
|
||||||
this.def = defaultState;
|
this.def = defaultState;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object getSelectedItem() {
|
public Object getSelectedItem() {
|
||||||
if (preferences.getBoolean(preference, def)) {
|
if (preferences.getBoolean(preference, def)) {
|
||||||
@ -683,7 +682,7 @@ public class PreferencesDialog extends JDialog {
|
|||||||
return falseDesc;
|
return falseDesc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setSelectedItem(Object item) {
|
public void setSelectedItem(Object item) {
|
||||||
if (item == null) {
|
if (item == null) {
|
||||||
@ -693,7 +692,7 @@ public class PreferencesDialog extends JDialog {
|
|||||||
if (!(item instanceof String)) {
|
if (!(item instanceof String)) {
|
||||||
throw new IllegalArgumentException("Illegal argument " + item);
|
throw new IllegalArgumentException("Illegal argument " + item);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (trueDesc.equals(item)) {
|
if (trueDesc.equals(item)) {
|
||||||
preferences.putBoolean(preference, true);
|
preferences.putBoolean(preference, true);
|
||||||
} else if (falseDesc.equals(item)) {
|
} else if (falseDesc.equals(item)) {
|
||||||
@ -702,44 +701,44 @@ public class PreferencesDialog extends JDialog {
|
|||||||
throw new IllegalArgumentException("Illegal argument " + item);
|
throw new IllegalArgumentException("Illegal argument " + item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object getElementAt(int index) {
|
public Object getElementAt(int index) {
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0:
|
case 0:
|
||||||
return def ? trueDesc : falseDesc;
|
return def ? trueDesc : falseDesc;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
return def ? falseDesc : trueDesc;
|
return def ? falseDesc : trueDesc;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw new IndexOutOfBoundsException("Boolean asked for index=" + index);
|
throw new IndexOutOfBoundsException("Boolean asked for index=" + index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getSize() {
|
public int getSize() {
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void checkForUpdates() {
|
private void checkForUpdates() {
|
||||||
final UpdateInfoRetriever retriever = new UpdateInfoRetriever();
|
final UpdateInfoRetriever retriever = new UpdateInfoRetriever();
|
||||||
retriever.start();
|
retriever.start();
|
||||||
|
|
||||||
|
|
||||||
// Progress dialog
|
// Progress dialog
|
||||||
final JDialog dialog1 = new JDialog(this, ModalityType.APPLICATION_MODAL);
|
final JDialog dialog1 = new JDialog(this, ModalityType.APPLICATION_MODAL);
|
||||||
JPanel panel = new JPanel(new MigLayout());
|
JPanel panel = new JPanel(new MigLayout());
|
||||||
|
|
||||||
//// Checking for updates...
|
//// Checking for updates...
|
||||||
panel.add(new JLabel(trans.get("pref.dlg.lbl.Checkingupdates")), "wrap");
|
panel.add(new JLabel(trans.get("pref.dlg.lbl.Checkingupdates")), "wrap");
|
||||||
|
|
||||||
JProgressBar bar = new JProgressBar();
|
JProgressBar bar = new JProgressBar();
|
||||||
bar.setIndeterminate(true);
|
bar.setIndeterminate(true);
|
||||||
panel.add(bar, "growx, wrap para");
|
panel.add(bar, "growx, wrap para");
|
||||||
|
|
||||||
//// Cancel button
|
//// Cancel button
|
||||||
JButton cancel = new JButton(trans.get("dlg.but.cancel"));
|
JButton cancel = new JButton(trans.get("dlg.but.cancel"));
|
||||||
cancel.addActionListener(new ActionListener() {
|
cancel.addActionListener(new ActionListener() {
|
||||||
@ -750,14 +749,14 @@ public class PreferencesDialog extends JDialog {
|
|||||||
});
|
});
|
||||||
panel.add(cancel, "right");
|
panel.add(cancel, "right");
|
||||||
dialog1.add(panel);
|
dialog1.add(panel);
|
||||||
|
|
||||||
GUIUtil.setDisposableDialogOptions(dialog1, cancel);
|
GUIUtil.setDisposableDialogOptions(dialog1, cancel);
|
||||||
|
|
||||||
|
|
||||||
// Timer to monitor progress
|
// Timer to monitor progress
|
||||||
final Timer timer = new Timer(100, null);
|
final Timer timer = new Timer(100, null);
|
||||||
final long startTime = System.currentTimeMillis();
|
final long startTime = System.currentTimeMillis();
|
||||||
|
|
||||||
ActionListener listener = new ActionListener() {
|
ActionListener listener = new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
@ -769,12 +768,12 @@ public class PreferencesDialog extends JDialog {
|
|||||||
};
|
};
|
||||||
timer.addActionListener(listener);
|
timer.addActionListener(listener);
|
||||||
timer.start();
|
timer.start();
|
||||||
|
|
||||||
|
|
||||||
// Wait for action
|
// Wait for action
|
||||||
dialog1.setVisible(true);
|
dialog1.setVisible(true);
|
||||||
|
|
||||||
|
|
||||||
// Check result
|
// Check result
|
||||||
UpdateInfo info = retriever.getUpdateInfo();
|
UpdateInfo info = retriever.getUpdateInfo();
|
||||||
if (info == null) {
|
if (info == null) {
|
||||||
@ -800,14 +799,14 @@ public class PreferencesDialog extends JDialog {
|
|||||||
preferences.putString(SwingPreferences.LAST_UPDATE, info.getLatestVersion());
|
preferences.putString(SwingPreferences.LAST_UPDATE, info.getLatestVersion());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//////// Singleton implementation ////////
|
//////// Singleton implementation ////////
|
||||||
|
|
||||||
private static PreferencesDialog dialog = null;
|
private static PreferencesDialog dialog = null;
|
||||||
|
|
||||||
public static void showPreferences(Window parent) {
|
public static void showPreferences(Window parent) {
|
||||||
if (dialog != null) {
|
if (dialog != null) {
|
||||||
dialog.dispose();
|
dialog.dispose();
|
||||||
@ -815,6 +814,6 @@ public class PreferencesDialog extends JDialog {
|
|||||||
dialog = new PreferencesDialog(parent);
|
dialog = new PreferencesDialog(parent);
|
||||||
dialog.setVisible(true);
|
dialog.setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ public class SwingPreferences extends net.sf.openrocket.startup.Preferences {
|
|||||||
private static final List<Locale> SUPPORTED_LOCALES;
|
private static final List<Locale> SUPPORTED_LOCALES;
|
||||||
static {
|
static {
|
||||||
List<Locale> list = new ArrayList<Locale>();
|
List<Locale> list = new ArrayList<Locale>();
|
||||||
for (String lang : new String[] { "en", "de", "es", "fr", "it", "ru", "cs", "pl" }) {
|
for (String lang : new String[] { "en", "de", "es", "fr", "it", "ru", "cs", "pl", "ja", "pt" }) {
|
||||||
list.add(new Locale(lang));
|
list.add(new Locale(lang));
|
||||||
}
|
}
|
||||||
SUPPORTED_LOCALES = Collections.unmodifiableList(list);
|
SUPPORTED_LOCALES = Collections.unmodifiableList(list);
|
||||||
@ -225,17 +225,17 @@ public class SwingPreferences extends net.sf.openrocket.startup.Preferences {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public File getDefaultUserComponentDirectory() {
|
public File getDefaultUserComponentDirectory() {
|
||||||
|
|
||||||
File compdir = new File(SystemInfo.getUserApplicationDirectory(), "Components");
|
File compdir = new File(SystemInfo.getUserApplicationDirectory(), "Components");
|
||||||
|
|
||||||
if (!compdir.isDirectory()) {
|
if (!compdir.isDirectory()) {
|
||||||
compdir.mkdirs();
|
compdir.mkdirs();
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !compdir.isDirectory() ) {
|
if (!compdir.isDirectory()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if( !compdir.canRead() ) {
|
if (!compdir.canRead()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return compdir;
|
return compdir;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user