Merge pull request #13 from soupwizard/fix-build-warnings-add-overrides
fix about 100 build warnings by add @Override, couple other warning fixes
This commit is contained in:
commit
58183fc2b6
@ -22,6 +22,7 @@ public abstract class AbstractMotorLoader implements MotorLoader {
|
|||||||
* This method delegates the reading to the loaded from the Reader using the charset
|
* This method delegates the reading to the loaded from the Reader using the charset
|
||||||
* returned by {@link #getDefaultCharset()}.
|
* returned by {@link #getDefaultCharset()}.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public List<Motor> load(InputStream stream, String filename) throws IOException {
|
public List<Motor> load(InputStream stream, String filename) throws IOException {
|
||||||
return load(new InputStreamReader(stream, getDefaultCharset()), filename);
|
return load(new InputStreamReader(stream, getDefaultCharset()), filename);
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,7 @@ public interface MotorLoader extends Loader<Motor> {
|
|||||||
* @return a list of motors contained in the file.
|
* @return a list of motors contained in the file.
|
||||||
* @throws IOException if an I/O exception occurs of the file format is invalid.
|
* @throws IOException if an I/O exception occurs of the file format is invalid.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public List<Motor> load(InputStream stream, String filename) throws IOException;
|
public List<Motor> load(InputStream stream, String filename) throws IOException;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -98,6 +98,7 @@ class BodyTubeHandler extends BaseHandler<BodyTube> {
|
|||||||
*
|
*
|
||||||
* @return BULK
|
* @return BULK
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public Material.Type getMaterialType() {
|
public Material.Type getMaterialType() {
|
||||||
return Material.Type.BULK;
|
return Material.Type.BULK;
|
||||||
}
|
}
|
||||||
|
@ -187,6 +187,7 @@ class MassObjectHandler extends PositionDependentHandler<MassObject> {
|
|||||||
*
|
*
|
||||||
* @param position the OpenRocket position
|
* @param position the OpenRocket position
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void setRelativePosition(RocketComponent.Position position) {
|
public void setRelativePosition(RocketComponent.Position position) {
|
||||||
current.setRelativePosition(position);
|
current.setRelativePosition(position);
|
||||||
}
|
}
|
||||||
|
@ -147,6 +147,7 @@ class NoseConeHandler extends BaseHandler<NoseCone> {
|
|||||||
*
|
*
|
||||||
* @return BULK
|
* @return BULK
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public Material.Type getMaterialType() {
|
public Material.Type getMaterialType() {
|
||||||
return Material.Type.BULK;
|
return Material.Type.BULK;
|
||||||
}
|
}
|
||||||
|
@ -113,6 +113,7 @@ class ParachuteHandler extends RecoveryDeviceHandler<Parachute> {
|
|||||||
*
|
*
|
||||||
* @return a component
|
* @return a component
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public Parachute getComponent() {
|
public Parachute getComponent() {
|
||||||
return chute;
|
return chute;
|
||||||
}
|
}
|
||||||
|
@ -61,6 +61,7 @@ public abstract class RecoveryDeviceHandler<C extends RecoveryDevice> extends Po
|
|||||||
* @param rawDensity the density as specified in the Rocksim design file
|
* @param rawDensity the density as specified in the Rocksim design file
|
||||||
* @return a value in OpenRocket SURFACE density units
|
* @return a value in OpenRocket SURFACE density units
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
protected double computeDensity(RocksimDensityType type, double rawDensity) {
|
protected double computeDensity(RocksimDensityType type, double rawDensity) {
|
||||||
|
|
||||||
double result;
|
double result;
|
||||||
|
@ -151,6 +151,7 @@ class TransitionHandler extends BaseHandler<Transition> {
|
|||||||
*
|
*
|
||||||
* @return BULK
|
* @return BULK
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public Material.Type getMaterialType() {
|
public Material.Type getMaterialType() {
|
||||||
return Material.Type.BULK;
|
return Material.Type.BULK;
|
||||||
}
|
}
|
||||||
|
@ -24,10 +24,15 @@ public abstract class TextFieldListener implements ActionListener, FocusListener
|
|||||||
|
|
||||||
public abstract void setText(String text);
|
public abstract void setText(String text);
|
||||||
|
|
||||||
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
setText(field.getText());
|
setText(field.getText());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void focusGained(FocusEvent e) { }
|
public void focusGained(FocusEvent e) { }
|
||||||
|
|
||||||
|
@Override
|
||||||
public void focusLost(FocusEvent e) {
|
public void focusLost(FocusEvent e) {
|
||||||
setText(field.getText());
|
setText(field.getText());
|
||||||
}
|
}
|
||||||
|
@ -60,6 +60,7 @@ public class ColorChooser extends JPanel {
|
|||||||
final JButton button = new JButton(COLOR_CHOOSER_BUTTON_LABEL);
|
final JButton button = new JButton(COLOR_CHOOSER_BUTTON_LABEL);
|
||||||
|
|
||||||
ActionListener actionListener = new ActionListener() {
|
ActionListener actionListener = new ActionListener() {
|
||||||
|
@Override
|
||||||
public void actionPerformed (ActionEvent actionEvent) {
|
public void actionPerformed (ActionEvent actionEvent) {
|
||||||
chooser.updateUI();
|
chooser.updateUI();
|
||||||
|
|
||||||
@ -71,6 +72,7 @@ public class ColorChooser extends JPanel {
|
|||||||
// Wait until current event dispatching completes before showing
|
// Wait until current event dispatching completes before showing
|
||||||
// dialog
|
// dialog
|
||||||
Runnable showDialog = new Runnable() {
|
Runnable showDialog = new Runnable() {
|
||||||
|
@Override
|
||||||
public void run () {
|
public void run () {
|
||||||
dialog.show();
|
dialog.show();
|
||||||
}
|
}
|
||||||
@ -84,6 +86,7 @@ public class ColorChooser extends JPanel {
|
|||||||
// Add listener on model to detect changes to selected color
|
// Add listener on model to detect changes to selected color
|
||||||
ColorSelectionModel model = chooser.getSelectionModel();
|
ColorSelectionModel model = chooser.getSelectionModel();
|
||||||
model.addChangeListener(new ChangeListener() {
|
model.addChangeListener(new ChangeListener() {
|
||||||
|
@Override
|
||||||
public void stateChanged (ChangeEvent evt) {
|
public void stateChanged (ChangeEvent evt) {
|
||||||
ColorSelectionModel model = (ColorSelectionModel) evt.getSource();
|
ColorSelectionModel model = (ColorSelectionModel) evt.getSource();
|
||||||
// Get the new color value
|
// Get the new color value
|
||||||
|
@ -244,10 +244,12 @@ public class UnitSelector extends StyledLabel implements StateChangeListener, Mo
|
|||||||
|
|
||||||
//////// ItemListener handling ////////
|
//////// ItemListener handling ////////
|
||||||
|
|
||||||
|
@Override
|
||||||
public void addItemListener(ItemListener listener) {
|
public void addItemListener(ItemListener listener) {
|
||||||
itemListeners.add(listener);
|
itemListeners.add(listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void removeItemListener(ItemListener listener) {
|
public void removeItemListener(ItemListener listener) {
|
||||||
itemListeners.remove(listener);
|
itemListeners.remove(listener);
|
||||||
}
|
}
|
||||||
@ -301,6 +303,7 @@ public class UnitSelector extends StyledLabel implements StateChangeListener, Mo
|
|||||||
unit = u;
|
unit = u;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
setSelectedUnit(unit);
|
setSelectedUnit(unit);
|
||||||
}
|
}
|
||||||
@ -316,23 +319,28 @@ public class UnitSelector extends StyledLabel implements StateChangeListener, Mo
|
|||||||
|
|
||||||
//////// Mouse handling ////////
|
//////// Mouse handling ////////
|
||||||
|
|
||||||
|
@Override
|
||||||
public void mouseClicked(MouseEvent e) {
|
public void mouseClicked(MouseEvent e) {
|
||||||
if (unitGroup.getUnitCount() > 1)
|
if (unitGroup.getUnitCount() > 1)
|
||||||
popup();
|
popup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void mouseEntered(MouseEvent e) {
|
public void mouseEntered(MouseEvent e) {
|
||||||
if (unitGroup.getUnitCount() > 1)
|
if (unitGroup.getUnitCount() > 1)
|
||||||
setBorder(withinBorder);
|
setBorder(withinBorder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void mouseExited(MouseEvent e) {
|
public void mouseExited(MouseEvent e) {
|
||||||
setBorder(normalBorder);
|
setBorder(normalBorder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void mousePressed(MouseEvent e) {
|
public void mousePressed(MouseEvent e) {
|
||||||
} // Ignore
|
} // Ignore
|
||||||
|
|
||||||
|
@Override
|
||||||
public void mouseReleased(MouseEvent e) {
|
public void mouseReleased(MouseEvent e) {
|
||||||
} // Ignore
|
} // Ignore
|
||||||
|
|
||||||
|
@ -461,6 +461,7 @@ public class ComponentAnalysisDialog extends JDialog implements ChangeListener {
|
|||||||
//Close button
|
//Close button
|
||||||
button = new JButton(trans.get("dlg.but.close"));
|
button = new JButton(trans.get("dlg.but.close"));
|
||||||
button.addActionListener(new ActionListener() {
|
button.addActionListener(new ActionListener() {
|
||||||
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
ComponentAnalysisDialog.this.dispose();
|
ComponentAnalysisDialog.this.dispose();
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,7 @@ public abstract class Caret implements FigureElement {
|
|||||||
/**
|
/**
|
||||||
* Paints the caret to the Graphics2D element.
|
* Paints the caret to the Graphics2D element.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void paint(Graphics2D g2, double scale) {
|
public void paint(Graphics2D g2, double scale) {
|
||||||
Area caret = getCaret();
|
Area caret = getCaret();
|
||||||
AffineTransform t = new AffineTransform(1.0/scale, 0, 0, 1.0/scale, x, y);
|
AffineTransform t = new AffineTransform(1.0/scale, 0, 0, 1.0/scale, x, y);
|
||||||
@ -39,6 +40,7 @@ public abstract class Caret implements FigureElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
public void paint(Graphics2D g2, double scale, Rectangle visible) {
|
public void paint(Graphics2D g2, double scale, Rectangle visible) {
|
||||||
throw new UnsupportedOperationException("paint() with rectangle unsupported.");
|
throw new UnsupportedOperationException("paint() with rectangle unsupported.");
|
||||||
}
|
}
|
||||||
|
@ -188,6 +188,7 @@ public class ComponentAddButtons extends JPanel implements Scrollable {
|
|||||||
viewport.addChangeListener(new ChangeListener() {
|
viewport.addChangeListener(new ChangeListener() {
|
||||||
private int oldWidth = -1;
|
private int oldWidth = -1;
|
||||||
|
|
||||||
|
@Override
|
||||||
public void stateChanged(ChangeEvent e) {
|
public void stateChanged(ChangeEvent e) {
|
||||||
Dimension d = ComponentAddButtons.this.viewport.getExtentSize();
|
Dimension d = ComponentAddButtons.this.viewport.getExtentSize();
|
||||||
if (d.width != oldWidth) {
|
if (d.width != oldWidth) {
|
||||||
@ -356,6 +357,7 @@ public class ComponentAddButtons extends JPanel implements Scrollable {
|
|||||||
* Updates the enabled status of the button.
|
* Updates the enabled status of the button.
|
||||||
* TODO: LOW: What about updates to the rocket tree?
|
* TODO: LOW: What about updates to the rocket tree?
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void valueChanged(TreeSelectionEvent e) {
|
public void valueChanged(TreeSelectionEvent e) {
|
||||||
updateEnabled();
|
updateEnabled();
|
||||||
}
|
}
|
||||||
|
@ -148,16 +148,22 @@ public class ComponentIcons {
|
|||||||
icons[0] = new ImageIcon(bi, desc);
|
icons[0] = new ImageIcon(bi, desc);
|
||||||
|
|
||||||
// Create disabled icon
|
// Create disabled icon
|
||||||
if (false) { // Fade using alpha
|
boolean useAlphaFade = false; // don't use fade to alpha yet
|
||||||
|
if (useAlphaFade) { // Fade using alpha
|
||||||
|
|
||||||
int rgb[] = bi2.getRGB(0, 0, bi2.getWidth(), bi2.getHeight(), null, 0, bi2.getWidth());
|
/* TODO This code to do fade using alpha had been dead code inside a "if (false) {" block.
|
||||||
for (int i = 0; i < rgb.length; i++) {
|
* Eclipse would give a build warning about dead code, so this code has been commented out
|
||||||
final int alpha = (rgb[i] >> 24) & 0xFF;
|
* but left here for future use; am assuming it was dead code because it wasn't working correctly
|
||||||
rgb[i] = (rgb[i] & 0xFFFFFF) | (alpha / 3) << 24;
|
* but that it will be useful in the future.
|
||||||
|
*/
|
||||||
//rgb[i] = (rgb[i]&0xFFFFFF) | ((rgb[i]>>1)&0x3F000000);
|
// int rgb[] = bi2.getRGB(0, 0, bi2.getWidth(), bi2.getHeight(), null, 0, bi2.getWidth());
|
||||||
}
|
// for (int i = 0; i < rgb.length; i++) {
|
||||||
bi2.setRGB(0, 0, bi2.getWidth(), bi2.getHeight(), rgb, 0, bi2.getWidth());
|
// final int alpha = (rgb[i] >> 24) & 0xFF;
|
||||||
|
// rgb[i] = (rgb[i] & 0xFFFFFF) | (alpha / 3) << 24;
|
||||||
|
//
|
||||||
|
// //rgb[i] = (rgb[i]&0xFFFFFF) | ((rgb[i]>>1)&0x3F000000);
|
||||||
|
// }
|
||||||
|
// bi2.setRGB(0, 0, bi2.getWidth(), bi2.getHeight(), rgb, 0, bi2.getWidth());
|
||||||
|
|
||||||
} else { // Raster alpha
|
} else { // Raster alpha
|
||||||
|
|
||||||
|
@ -34,6 +34,7 @@ public final class MRUDesignFileAction extends JMenu {
|
|||||||
parent = theParent;
|
parent = theParent;
|
||||||
MRUDesignFile opts = MRUDesignFile.getInstance();
|
MRUDesignFile opts = MRUDesignFile.getInstance();
|
||||||
opts.addPropertyChangeListener(new PropertyChangeListener() {
|
opts.addPropertyChangeListener(new PropertyChangeListener() {
|
||||||
|
@Override
|
||||||
public void propertyChange(PropertyChangeEvent evt) {
|
public void propertyChange(PropertyChangeEvent evt) {
|
||||||
if (!evt.getPropertyName().equals(MRUDesignFile.MRU_FILE_LIST_PROPERTY)) {
|
if (!evt.getPropertyName().equals(MRUDesignFile.MRU_FILE_LIST_PROPERTY)) {
|
||||||
return;
|
return;
|
||||||
@ -68,6 +69,7 @@ public final class MRUDesignFileAction extends JMenu {
|
|||||||
*/
|
*/
|
||||||
private Action createAction(String file) {
|
private Action createAction(String file) {
|
||||||
Action action = new AbstractAction() {
|
Action action = new AbstractAction() {
|
||||||
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
String command = e.getActionCommand();
|
String command = e.getActionCommand();
|
||||||
if (BasicFrame.open(new File(command), parent)) {
|
if (BasicFrame.open(new File(command), parent)) {
|
||||||
|
@ -276,6 +276,7 @@ public class RocketActions {
|
|||||||
/////// Action classes
|
/////// Action classes
|
||||||
|
|
||||||
private abstract class RocketAction extends AbstractAction implements ClipboardListener {
|
private abstract class RocketAction extends AbstractAction implements ClipboardListener {
|
||||||
|
@Override
|
||||||
public abstract void clipboardChanged();
|
public abstract void clipboardChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,6 +70,7 @@ public class UndoRedoAction extends AbstractAction implements UndoRedoListener {
|
|||||||
|
|
||||||
|
|
||||||
// Set all the values correctly (name and enabled/disabled status)
|
// Set all the values correctly (name and enabled/disabled status)
|
||||||
|
@Override
|
||||||
public void setAllValues() {
|
public void setAllValues() {
|
||||||
String name, desc;
|
String name, desc;
|
||||||
boolean actionEnabled;
|
boolean actionEnabled;
|
||||||
|
@ -145,6 +145,7 @@ public class ButtonColumn extends AbstractCellEditor
|
|||||||
//
|
//
|
||||||
// Implement TableCellRenderer interface
|
// Implement TableCellRenderer interface
|
||||||
//
|
//
|
||||||
|
@Override
|
||||||
public Component getTableCellRendererComponent(
|
public Component getTableCellRendererComponent(
|
||||||
JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
|
JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
|
||||||
{
|
{
|
||||||
@ -194,6 +195,7 @@ public class ButtonColumn extends AbstractCellEditor
|
|||||||
/*
|
/*
|
||||||
* The button has been pressed. Stop editing and invoke the custom Action
|
* The button has been pressed. Stop editing and invoke the custom Action
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void actionPerformed(ActionEvent e)
|
public void actionPerformed(ActionEvent e)
|
||||||
{
|
{
|
||||||
int row = table.convertRowIndexToModel( table.getEditingRow() );
|
int row = table.convertRowIndexToModel( table.getEditingRow() );
|
||||||
@ -216,6 +218,7 @@ public class ButtonColumn extends AbstractCellEditor
|
|||||||
* the mouse to another cell before releasing it, the editor is still
|
* the mouse to another cell before releasing it, the editor is still
|
||||||
* active. Make sure editing is stopped when the mouse is released.
|
* active. Make sure editing is stopped when the mouse is released.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void mousePressed(MouseEvent e)
|
public void mousePressed(MouseEvent e)
|
||||||
{
|
{
|
||||||
if (table.isEditing()
|
if (table.isEditing()
|
||||||
@ -223,6 +226,7 @@ public class ButtonColumn extends AbstractCellEditor
|
|||||||
isButtonColumnEditor = true;
|
isButtonColumnEditor = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void mouseReleased(MouseEvent e)
|
public void mouseReleased(MouseEvent e)
|
||||||
{
|
{
|
||||||
if (isButtonColumnEditor
|
if (isButtonColumnEditor
|
||||||
@ -232,7 +236,12 @@ public class ButtonColumn extends AbstractCellEditor
|
|||||||
isButtonColumnEditor = false;
|
isButtonColumnEditor = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void mouseClicked(MouseEvent e) {}
|
public void mouseClicked(MouseEvent e) {}
|
||||||
public void mouseEntered(MouseEvent e) {}
|
|
||||||
|
@Override
|
||||||
|
public void mouseEntered(MouseEvent e) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void mouseExited(MouseEvent e) {}
|
public void mouseExited(MouseEvent e) {}
|
||||||
}
|
}
|
||||||
|
@ -107,6 +107,7 @@ public class ComponentPresetEditor extends JPanel implements PresetResultListene
|
|||||||
add(scrollPane, "cell 0 0 6 1,grow");
|
add(scrollPane, "cell 0 0 6 1,grow");
|
||||||
|
|
||||||
table.addMouseListener(new MouseAdapter() {
|
table.addMouseListener(new MouseAdapter() {
|
||||||
|
@Override
|
||||||
public void mouseClicked(MouseEvent e) {
|
public void mouseClicked(MouseEvent e) {
|
||||||
JTable target = (JTable) e.getSource();
|
JTable target = (JTable) e.getSource();
|
||||||
int selectedColumn = table.getColumnModel().getColumnIndexAtX(target.getSelectedColumn());
|
int selectedColumn = table.getColumnModel().getColumnIndexAtX(target.getSelectedColumn());
|
||||||
@ -200,6 +201,7 @@ public class ComponentPresetEditor extends JPanel implements PresetResultListene
|
|||||||
JMenuItem mntmExit = new JMenuItem("Close");
|
JMenuItem mntmExit = new JMenuItem("Close");
|
||||||
mnFile.add(mntmExit);
|
mnFile.add(mntmExit);
|
||||||
mntmExit.addActionListener(new ActionListener() {
|
mntmExit.addActionListener(new ActionListener() {
|
||||||
|
@Override
|
||||||
public void actionPerformed(ActionEvent arg0) {
|
public void actionPerformed(ActionEvent arg0) {
|
||||||
Window w = SwingUtilities.getWindowAncestor(ComponentPresetEditor.this);
|
Window w = SwingUtilities.getWindowAncestor(ComponentPresetEditor.this);
|
||||||
w.dispose();
|
w.dispose();
|
||||||
@ -303,6 +305,7 @@ public class ComponentPresetEditor extends JPanel implements PresetResultListene
|
|||||||
associated.clear();
|
associated.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void removeRow(int row) {
|
public void removeRow(int row) {
|
||||||
super.removeRow(row);
|
super.removeRow(row);
|
||||||
associated.remove(row);
|
associated.remove(row);
|
||||||
@ -312,6 +315,7 @@ public class ComponentPresetEditor extends JPanel implements PresetResultListene
|
|||||||
return associated.get(row);
|
return associated.get(row);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isCellEditable(int rowIndex, int mColIndex) {
|
public boolean isCellEditable(int rowIndex, int mColIndex) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -375,8 +379,9 @@ public class ComponentPresetEditor extends JPanel implements PresetResultListene
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
|
String fileName = (file == null) ? "(file is null, can't get name)" : file.getName();
|
||||||
JOptionPane.showMessageDialog(ComponentPresetEditor.this, "Unable to open OpenRocket component file: " +
|
JOptionPane.showMessageDialog(ComponentPresetEditor.this, "Unable to open OpenRocket component file: " +
|
||||||
file.getName() + " Invalid format. " + e.getMessage());
|
fileName + " Invalid format. " + e.getMessage());
|
||||||
editContext.setOpenedFile(null);
|
editContext.setOpenedFile(null);
|
||||||
editContext.setEditingSelected(false);
|
editContext.setEditingSelected(false);
|
||||||
return false;
|
return false;
|
||||||
|
@ -25,6 +25,7 @@ public class ImagePreviewPanel extends JPanel
|
|||||||
bg = getBackground();
|
bg = getBackground();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void propertyChange(PropertyChangeEvent e) {
|
public void propertyChange(PropertyChangeEvent e) {
|
||||||
String propertyName = e.getPropertyName();
|
String propertyName = e.getPropertyName();
|
||||||
|
|
||||||
@ -42,15 +43,18 @@ public class ImagePreviewPanel extends JPanel
|
|||||||
* Make reasonably sure we have an image format that AWT can
|
* Make reasonably sure we have an image format that AWT can
|
||||||
* handle so we don't try to draw something silly.
|
* handle so we don't try to draw something silly.
|
||||||
*/
|
*/
|
||||||
if ((name != null) &&
|
if (name != null) {
|
||||||
name.toLowerCase().endsWith(".jpg") ||
|
String nameLower = name.toLowerCase();
|
||||||
name.toLowerCase().endsWith(".jpeg") ||
|
if (nameLower.endsWith(".jpg") ||
|
||||||
name.toLowerCase().endsWith(".gif") ||
|
nameLower.endsWith(".jpeg") ||
|
||||||
name.toLowerCase().endsWith(".png")) {
|
nameLower.endsWith(".gif") ||
|
||||||
icon = new ImageIcon(name);
|
nameLower.endsWith(".png")) {
|
||||||
image = icon.getImage();
|
|
||||||
scaleImage();
|
icon = new ImageIcon(name);
|
||||||
repaint();
|
image = icon.getImage();
|
||||||
|
scaleImage();
|
||||||
|
repaint();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -86,6 +90,7 @@ public class ImagePreviewPanel extends JPanel
|
|||||||
image = image.getScaledInstance(width, height, Image.SCALE_DEFAULT);
|
image = image.getScaledInstance(width, height, Image.SCALE_DEFAULT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void paintComponent(Graphics g) {
|
public void paintComponent(Graphics g) {
|
||||||
g.setColor(bg);
|
g.setColor(bg);
|
||||||
|
|
||||||
|
@ -8,52 +8,52 @@ package net.sf.openrocket.gui.print;
|
|||||||
*/
|
*/
|
||||||
public enum PrintUnit {
|
public enum PrintUnit {
|
||||||
FOOT {
|
FOOT {
|
||||||
public double toInches(double d) { return d*12; }
|
@Override public double toInches(double d) { return d*12; }
|
||||||
public double toMillis(double d) { return d/FEET_PER_MM; }
|
@Override public double toMillis(double d) { return d/FEET_PER_MM; }
|
||||||
public double toCentis(double d) { return d/(FEET_PER_MM*TEN); }
|
@Override public double toCentis(double d) { return d/(FEET_PER_MM*TEN); }
|
||||||
public double toMeters(double d) { return d/(FEET_PER_MM*TEN*TEN*TEN); }
|
@Override public double toMeters(double d) { return d/(FEET_PER_MM*TEN*TEN*TEN); }
|
||||||
public double toPoints(double d) { return (d * POINTS_PER_INCH * 12); }
|
@Override public double toPoints(double d) { return (d * POINTS_PER_INCH * 12); }
|
||||||
public double convert(double d, PrintUnit u) { return u.toInches(d)/12; }
|
@Override public double convert(double d, PrintUnit u) { return u.toInches(d)/12; }
|
||||||
},
|
},
|
||||||
INCHES {
|
INCHES {
|
||||||
public double toInches(double d) { return d; }
|
@Override public double toInches(double d) { return d; }
|
||||||
public double toMillis(double d) { return d/INCHES_PER_MM; }
|
@Override public double toMillis(double d) { return d/INCHES_PER_MM; }
|
||||||
public double toCentis(double d) { return d/(INCHES_PER_MM*TEN); }
|
@Override public double toCentis(double d) { return d/(INCHES_PER_MM*TEN); }
|
||||||
public double toMeters(double d) { return d/(INCHES_PER_MM*TEN*TEN*TEN); }
|
@Override public double toMeters(double d) { return d/(INCHES_PER_MM*TEN*TEN*TEN); }
|
||||||
public double toPoints(double d) { return (d * POINTS_PER_INCH); }
|
@Override public double toPoints(double d) { return (d * POINTS_PER_INCH); }
|
||||||
public double convert(double d, PrintUnit u) { return u.toInches(d); }
|
@Override public double convert(double d, PrintUnit u) { return u.toInches(d); }
|
||||||
},
|
},
|
||||||
MILLIMETERS {
|
MILLIMETERS {
|
||||||
public double toInches(double d) { return d * INCHES_PER_MM; }
|
@Override public double toInches(double d) { return d * INCHES_PER_MM; }
|
||||||
public double toMillis(double d) { return d; }
|
@Override public double toMillis(double d) { return d; }
|
||||||
public double toCentis(double d) { return d/TEN; }
|
@Override public double toCentis(double d) { return d/TEN; }
|
||||||
public double toMeters(double d) { return d/(TEN*TEN*TEN); }
|
@Override public double toMeters(double d) { return d/(TEN*TEN*TEN); }
|
||||||
public double toPoints(double d) { return INCHES.toPoints(toInches(d)); }
|
@Override public double toPoints(double d) { return INCHES.toPoints(toInches(d)); }
|
||||||
public double convert(double d, PrintUnit u) { return u.toMillis(d); }
|
@Override public double convert(double d, PrintUnit u) { return u.toMillis(d); }
|
||||||
},
|
},
|
||||||
CENTIMETERS {
|
CENTIMETERS {
|
||||||
public double toInches(double d) { return d * INCHES_PER_MM * TEN; }
|
@Override public double toInches(double d) { return d * INCHES_PER_MM * TEN; }
|
||||||
public double toMillis(double d) { return d * TEN; }
|
@Override public double toMillis(double d) { return d * TEN; }
|
||||||
public double toCentis(double d) { return d; }
|
@Override public double toCentis(double d) { return d; }
|
||||||
public double toMeters(double d) { return d/(TEN*TEN); }
|
@Override public double toMeters(double d) { return d/(TEN*TEN); }
|
||||||
public double toPoints(double d) { return INCHES.toPoints(toInches(d)); }
|
@Override public double toPoints(double d) { return INCHES.toPoints(toInches(d)); }
|
||||||
public double convert(double d, PrintUnit u) { return u.toCentis(d); }
|
@Override public double convert(double d, PrintUnit u) { return u.toCentis(d); }
|
||||||
},
|
},
|
||||||
METERS {
|
METERS {
|
||||||
public double toInches(double d) { return d * INCHES_PER_MM * TEN * TEN * TEN; }
|
@Override public double toInches(double d) { return d * INCHES_PER_MM * TEN * TEN * TEN; }
|
||||||
public double toMillis(double d) { return d * TEN * TEN * TEN; }
|
@Override public double toMillis(double d) { return d * TEN * TEN * TEN; }
|
||||||
public double toCentis(double d) { return d * TEN * TEN; }
|
@Override public double toCentis(double d) { return d * TEN * TEN; }
|
||||||
public double toMeters(double d) { return d; }
|
@Override public double toMeters(double d) { return d; }
|
||||||
public double toPoints(double d) { return INCHES.toPoints(toInches(d)); }
|
@Override public double toPoints(double d) { return INCHES.toPoints(toInches(d)); }
|
||||||
public double convert(double d, PrintUnit u) { return u.toMeters(d); }
|
@Override public double convert(double d, PrintUnit u) { return u.toMeters(d); }
|
||||||
},
|
},
|
||||||
POINTS {
|
POINTS {
|
||||||
public double toInches(double d) { return d/POINTS_PER_INCH; }
|
@Override public double toInches(double d) { return d/POINTS_PER_INCH; }
|
||||||
public double toMillis(double d) { return d/(POINTS_PER_INCH * INCHES_PER_MM); }
|
@Override public double toMillis(double d) { return d/(POINTS_PER_INCH * INCHES_PER_MM); }
|
||||||
public double toCentis(double d) { return toMillis(d)/TEN; }
|
@Override public double toCentis(double d) { return toMillis(d)/TEN; }
|
||||||
public double toMeters(double d) { return toMillis(d)/(TEN*TEN*TEN); }
|
@Override public double toMeters(double d) { return toMillis(d)/(TEN*TEN*TEN); }
|
||||||
public double toPoints(double d) { return d; }
|
@Override public double toPoints(double d) { return d; }
|
||||||
public double convert(double d, PrintUnit u) { return u.toPoints(d); }
|
@Override public double convert(double d, PrintUnit u) { return u.toPoints(d); }
|
||||||
};
|
};
|
||||||
|
|
||||||
// Handy constants for conversion methods
|
// Handy constants for conversion methods
|
||||||
|
@ -71,6 +71,7 @@ public class CheckBoxNode {
|
|||||||
*
|
*
|
||||||
* @return the text label
|
* @return the text label
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String toString () {
|
public String toString () {
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
@ -103,6 +103,7 @@ public class CheckTreeSelectionModel extends DefaultTreeSelectionModel {
|
|||||||
*
|
*
|
||||||
* @param pPaths an array of paths
|
* @param pPaths an array of paths
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void setSelectionPaths (TreePath[] pPaths) {
|
public void setSelectionPaths (TreePath[] pPaths) {
|
||||||
TreePath selected[] = getSelectionPaths();
|
TreePath selected[] = getSelectionPaths();
|
||||||
for (TreePath aSelected : selected) {
|
for (TreePath aSelected : selected) {
|
||||||
@ -118,6 +119,7 @@ public class CheckTreeSelectionModel extends DefaultTreeSelectionModel {
|
|||||||
*
|
*
|
||||||
* @param paths an array of tree path nodes
|
* @param paths an array of tree path nodes
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void addSelectionPaths (TreePath[] paths) {
|
public void addSelectionPaths (TreePath[] paths) {
|
||||||
// deselect all descendants of paths[]
|
// deselect all descendants of paths[]
|
||||||
for (TreePath path : paths) {
|
for (TreePath path : paths) {
|
||||||
@ -195,6 +197,7 @@ public class CheckTreeSelectionModel extends DefaultTreeSelectionModel {
|
|||||||
*
|
*
|
||||||
* @param paths the array of path nodes
|
* @param paths the array of path nodes
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void removeSelectionPaths (TreePath[] paths) {
|
public void removeSelectionPaths (TreePath[] paths) {
|
||||||
for (TreePath path : paths) {
|
for (TreePath path : paths) {
|
||||||
if (path.getPathCount() == 1) {
|
if (path.getPathCount() == 1) {
|
||||||
|
@ -43,6 +43,7 @@ public class Rule extends PrintableComponent {
|
|||||||
*
|
*
|
||||||
* @param g the opaque graphics context
|
* @param g the opaque graphics context
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void paintComponent(Graphics g) {
|
public void paintComponent(Graphics g) {
|
||||||
Graphics2D g2 = (Graphics2D) g;
|
Graphics2D g2 = (Graphics2D) g;
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@ public abstract class InterpolatingAtmosphericModel implements AtmosphericModel
|
|||||||
private AtmosphericConditions[] levels = null;
|
private AtmosphericConditions[] levels = null;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
public AtmosphericConditions getConditions(double altitude) {
|
public AtmosphericConditions getConditions(double altitude) {
|
||||||
if (levels == null)
|
if (levels == null)
|
||||||
computeLayers();
|
computeLayers();
|
||||||
|
@ -106,5 +106,6 @@ public interface SimulationModifier extends ChangeSource {
|
|||||||
* another rocket instance (e.g. the same modification on another rocket component that
|
* another rocket instance (e.g. the same modification on another rocket component that
|
||||||
* has the same component ID).
|
* has the same component ID).
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public boolean equals(Object obj);
|
public boolean equals(Object obj);
|
||||||
}
|
}
|
||||||
|
@ -395,6 +395,7 @@ public class BodyTube extends SymmetricComponent implements MotorMount, Coaxial
|
|||||||
fireComponentChangeEvent(ComponentChangeEvent.MOTOR_CHANGE);
|
fireComponentChangeEvent(ComponentChangeEvent.MOTOR_CHANGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
@Override
|
@Override
|
||||||
public int getMotorCount() {
|
public int getMotorCount() {
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -52,6 +52,7 @@ public class EventQueue extends PriorityQueue<FlightEvent> implements Monitorabl
|
|||||||
return super.remove(o);
|
return super.remove(o);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getModID() {
|
public int getModID() {
|
||||||
return modID;
|
return modID;
|
||||||
}
|
}
|
||||||
|
@ -67,5 +67,6 @@ public interface SimulationComputationListener extends SimulationListener {
|
|||||||
|
|
||||||
public double postSimpleThrustCalculation(SimulationStatus status, double thrust) throws SimulationException;
|
public double postSimpleThrustCalculation(SimulationStatus status, double thrust) throws SimulationException;
|
||||||
|
|
||||||
|
@Override
|
||||||
public FlightDataType[] getFlightDataTypes();
|
public FlightDataType[] getFlightDataTypes();
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@ public class DampingMoment extends AbstractSimulationListener {
|
|||||||
private static final FlightDataType type = FlightDataType.getType("Damping moment coefficient", "Cdm", UnitGroup.UNITS_COEFFICIENT);
|
private static final FlightDataType type = FlightDataType.getType("Damping moment coefficient", "Cdm", UnitGroup.UNITS_COEFFICIENT);
|
||||||
private static final FlightDataType[] typeList = {type};
|
private static final FlightDataType[] typeList = {type};
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getName(){
|
public String getName(){
|
||||||
return "Damping moment listener";
|
return "Damping moment listener";
|
||||||
}
|
}
|
||||||
@ -33,6 +34,7 @@ public class DampingMoment extends AbstractSimulationListener {
|
|||||||
/**
|
/**
|
||||||
* Return a list of any flight data types this listener creates.
|
* Return a list of any flight data types this listener creates.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public FlightDataType[] getFlightDataTypes(){
|
public FlightDataType[] getFlightDataTypes(){
|
||||||
return typeList;
|
return typeList;
|
||||||
}
|
}
|
||||||
|
@ -42,15 +42,16 @@ public class SerializeMotors {
|
|||||||
if (iterator == null) {
|
if (iterator == null) {
|
||||||
System.out.println("Can't find resources-src/thrustcurves directory");
|
System.out.println("Can't find resources-src/thrustcurves directory");
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
}
|
} else {
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
Pair<String, InputStream> f = iterator.next();
|
Pair<String, InputStream> f = iterator.next();
|
||||||
String fileName = f.getU();
|
String fileName = f.getU();
|
||||||
InputStream is = f.getV();
|
InputStream is = f.getV();
|
||||||
|
|
||||||
List<Motor> motors = loader.load(is, fileName);
|
List<Motor> motors = loader.load(is, fileName);
|
||||||
|
|
||||||
allMotors.addAll(motors);
|
allMotors.addAll(motors);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
oos.writeObject(allMotors);
|
oos.writeObject(allMotors);
|
||||||
|
@ -16,18 +16,22 @@ public class FixedUnitGroup extends UnitGroup {
|
|||||||
this.unitString = unitString;
|
this.unitString = unitString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getUnitCount(){
|
public int getUnitCount(){
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Unit getDefaultUnit(){
|
public Unit getDefaultUnit(){
|
||||||
return new GeneralUnit(1, unitString);
|
return new GeneralUnit(1, unitString);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Unit getSIUnit(){
|
public Unit getSIUnit(){
|
||||||
return new GeneralUnit(1, unitString);
|
return new GeneralUnit(1, unitString);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean contains(Unit u){
|
public boolean contains(Unit u){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user