Merge pull request #27 from openrocket/unstable

Unstable
This commit is contained in:
ChrisMickelson 2018-04-08 19:39:01 -05:00 committed by GitHub
commit 9c396f2f7b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 44 additions and 36 deletions

View File

@ -33,6 +33,7 @@ import net.sf.openrocket.l10n.Translator;
import net.sf.openrocket.logging.Markers;
import net.sf.openrocket.rocketcomponent.BodyComponent;
import net.sf.openrocket.rocketcomponent.BodyTube;
import net.sf.openrocket.rocketcomponent.ComponentChangeEvent;
import net.sf.openrocket.rocketcomponent.EllipticalFinSet;
import net.sf.openrocket.rocketcomponent.FinSet;
import net.sf.openrocket.rocketcomponent.FreeformFinSet;
@ -400,18 +401,22 @@ public class ScaleDialog extends JDialog {
panel.add(scaleMassValues, "span, wrap para*3");
// Buttons
// Scale / Accept Buttons
JButton scale = new JButton(trans.get("button.scale"));
scale.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
doScale();
ScaleDialog.this.document.getRocket().fireComponentChangeEvent( ComponentChangeEvent.AEROMASS_CHANGE);
ScaleDialog.this.setVisible(false);
}
});
panel.add(scale, "span, split, right, gap para");
// Cancel Button
JButton cancel = new JButton(trans.get("button.cancel"));
cancel.addActionListener(new ActionListener() {
@Override

View File

@ -106,7 +106,7 @@ public class ComponentPresetChooserDialog extends JDialog {
sub.add(filterLabel, "gapright para");
filterText = new JTextField();
sub.add(filterText, "growx");
sub.add(filterText, "width 50:320, growx");
filterText.getDocument().addDocumentListener(new DocumentListener() {
@Override
public void changedUpdate(DocumentEvent e) {
@ -174,7 +174,7 @@ public class ComponentPresetChooserDialog extends JDialog {
private JPanel getFilterCheckboxes() {
SymmetricComponent sc;
JPanel panel = new JPanel(new MigLayout("fill, ins 0"));
JPanel panel = new JPanel(new MigLayout("ins 0"));
/*
* Add show all compatible check box.

View File

@ -684,30 +684,33 @@ public class BasicFrame extends JFrame {
menu.getAccessibleContext().setAccessibleDescription(trans.get("main.menu.analyze.desc"));
menubar.add(menu);
//// Component analysis
item = new JMenuItem(trans.get("main.menu.analyze.componentAnalysis"), KeyEvent.VK_C);
//// Analyze the rocket components separately
item.getAccessibleContext().setAccessibleDescription(trans.get("main.menu.analyze.componentAnalysis.desc"));
item.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
log.info(Markers.USER_MARKER, "Component analysis selected");
ComponentAnalysisDialog.showDialog(rocketpanel);
}
});
menu.add(item);
//// Optimize
item = new JMenuItem(trans.get("main.menu.analyze.optimization"), KeyEvent.VK_O);
item.getAccessibleContext().setAccessibleDescription(trans.get("main.menu.analyze.optimization.desc"));
item.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
log.info(Markers.USER_MARKER, "Rocket optimization selected");
new GeneralOptimizationDialog(document, BasicFrame.this).setVisible(true);
}
});
menu.add(item);
// TODO: reimplement this
// //// Component analysis
// item = new JMenuItem(trans.get("main.menu.analyze.componentAnalysis"), KeyEvent.VK_C);
// //// Analyze the rocket components separately
// item.getAccessibleContext().setAccessibleDescription(trans.get("main.menu.analyze.componentAnalysis.desc"));
// item.addActionListener(new ActionListener() {
// @Override
// public void actionPerformed(ActionEvent e) {
// log.info(Markers.USER_MARKER, "Component analysis selected");
// ComponentAnalysisDialog.showDialog(rocketpanel);
// }
// });
// menu.add(item);
// TODO: reimplement this dialog
// //// Optimize
// item = new JMenuItem(trans.get("main.menu.analyze.optimization"), KeyEvent.VK_O);
// item.getAccessibleContext().setAccessibleDescription(trans.get("main.menu.analyze.optimization.desc"));
// item.addActionListener(new ActionListener() {
// @Override
// public void actionPerformed(ActionEvent e) {
// log.info(Markers.USER_MARKER, "Rocket optimization selected");
// new GeneralOptimizationDialog(document, BasicFrame.this).setVisible(true);
// }
// });
// menu.add(item);
//// Custom expressions
item = new JMenuItem(trans.get("main.menu.analyze.customExpressions"), KeyEvent.VK_E);

View File

@ -50,11 +50,14 @@ public class ExampleDesignFile implements Comparable<ExampleDesignFile> {
logger.debug("Cannot find jar file, trying to load from directory");
designs = getDirFileNames();
}
if (designs == null || designs.length == 0) {
return null;
if (designs == null ){
return new ExampleDesignFile[0];
}
if( 0 < designs.length ) {
Arrays.sort(designs);
}
Arrays.sort(designs);
return designs;
}

View File

@ -120,10 +120,7 @@ public class IntegrationTest {
checkUndoState(null, null);
InnerTube mmt = (InnerTube)config.getRocket().getChild(0).getChild(1).getChild(2);
System.err.println(String.format("IntegrationTest::testSimpleRocket(...)...."));
System.err.println(String.format(" Config: %s", config.toDebug() ));
System.err.println(String.format(" motor config: %s", mmt.getMotorConfig( config.getId() ).toDescription() ));
// Compute cg+cp + altitude
// double cgx, double mass, double cpx, double cna)
checkCgCp(0.248, 0.0645, 0.320, 12.0);