[Minor] Cleaned up warnings

- Mostly un-parameterized generics
- adding 'serialVersionUID' member fields where javac complained
This commit is contained in:
Daniel_M_Williams 2016-01-03 18:09:51 -05:00
parent e174e4f0f6
commit e51f7a2827
124 changed files with 439 additions and 402 deletions

View File

@ -22,7 +22,8 @@ public class Example {
// A function which calculates the mean of an array and scales it
CustomFunction meanFn = new CustomFunction("mean",2) {
public Variable applyFunction(List<Variable> vars) {
@Override
public Variable applyFunction(List<Variable> vars) {
double[] vals;
double scale;

View File

@ -100,6 +100,7 @@ public final class PostfixExpression extends AbstractExpression implements Calcu
/**
* delegate the calculation of a simple expression
*/
@Override
public Variable calculate() throws IllegalArgumentException {
final Stack<Variable> stack = new Stack<Variable>();
@ -110,6 +111,7 @@ public final class PostfixExpression extends AbstractExpression implements Calcu
}
@Override
public void setVariable(Variable value) {
variables.add(value);
}

View File

@ -91,6 +91,7 @@ public class Variable {
return start;
}
@Override
public String toString(){
if ( arrayValue.length > 1 ){
String out = name + " is Array (length " + new Integer(arrayValue.length).toString() + ") : {";

View File

@ -4,11 +4,7 @@ import java.util.HashSet;
public class VariableSet extends HashSet<Variable> {
/**
*
*/
private static final long serialVersionUID = -4212803364398351279L;
@Override
public boolean add(Variable v){
Variable previous = getVariableNamed(v.getName());
if ( previous != null ){

View File

@ -9,11 +9,11 @@ import net.sf.openrocket.appearance.DecalImage;
import net.sf.openrocket.util.StateChangeListener;
class ResourceDecalImage implements DecalImage {
public class ResourceDecalImage implements DecalImage {
final String resource;
ResourceDecalImage(final String resource) {
public ResourceDecalImage(final String resource) {
this.resource = resource;
}

View File

@ -25,11 +25,7 @@ import net.sf.openrocket.util.ChangeSource;
import net.sf.openrocket.util.FileUtils;
import net.sf.openrocket.util.StateChangeListener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class DecalRegistry {
private static Logger log = LoggerFactory.getLogger(DecalRegistry.class);
DecalRegistry() {
}
@ -116,6 +112,7 @@ public class DecalRegistry {
this.delegate = delegate;
}
@Override
public String getName() {
return name != null ? name : delegate.getName();
}
@ -133,6 +130,7 @@ public class DecalRegistry {
* @throws FileNotFoundException
* @throws IOException
*/
@Override
public InputStream getBytes() throws FileNotFoundException, IOException {
// First check if the decal is located on the file system
File exportedFile = getFileSystemLocation();

View File

@ -147,7 +147,6 @@ public class GeneralRocketLoader {
// Check for ZIP (for future compatibility)
if (buffer[0] == ZIP_SIGNATURE[0] && buffer[1] == ZIP_SIGNATURE[1]) {
OpenRocketDocument doc;
isContainer = true;
setAttachmentFactory();
// Search for entry with name *.ork
@ -159,11 +158,11 @@ public class GeneralRocketLoader {
}
if (entry.getName().matches(".*\\.[oO][rR][kK]$")) {
loadRocket(in);
return;
} else if (entry.getName().matches(".*\\.[rR][kK][tT]$")) {
loadRocket(in);
return;
}
in.close();
return;
}
}

View File

@ -18,20 +18,11 @@ import net.sf.openrocket.document.OpenRocketDocument;
import net.sf.openrocket.document.Simulation;
import net.sf.openrocket.document.StorageOptions;
import net.sf.openrocket.file.RocketSaver;
import net.sf.openrocket.rocketcomponent.AxialStage;
import net.sf.openrocket.rocketcomponent.DeploymentConfiguration.DeployEvent;
import net.sf.openrocket.rocketcomponent.FinSet;
import net.sf.openrocket.rocketcomponent.FlightConfigurableComponent;
import net.sf.openrocket.rocketcomponent.FlightConfiguration;
import net.sf.openrocket.rocketcomponent.FlightConfigurationId;
import net.sf.openrocket.rocketcomponent.MotorMount;
import net.sf.openrocket.rocketcomponent.ParallelStage;
import net.sf.openrocket.rocketcomponent.PodSet;
import net.sf.openrocket.rocketcomponent.RailButton;
import net.sf.openrocket.rocketcomponent.RecoveryDevice;
import net.sf.openrocket.rocketcomponent.Rocket;
import net.sf.openrocket.rocketcomponent.RocketComponent;
import net.sf.openrocket.rocketcomponent.TubeCoupler;
import net.sf.openrocket.rocketcomponent.TubeFinSet;
import net.sf.openrocket.simulation.FlightData;
import net.sf.openrocket.simulation.FlightDataBranch;
@ -43,7 +34,6 @@ import net.sf.openrocket.simulation.extension.SimulationExtension;
import net.sf.openrocket.util.BugException;
import net.sf.openrocket.util.BuildProperties;
import net.sf.openrocket.util.Config;
import net.sf.openrocket.util.MathUtil;
import net.sf.openrocket.util.Reflection;
import net.sf.openrocket.util.TextUtil;

View File

@ -10,12 +10,9 @@ import net.sf.openrocket.file.DocumentLoadingContext;
import net.sf.openrocket.file.simplesax.AbstractElementHandler;
import net.sf.openrocket.file.simplesax.ElementHandler;
import net.sf.openrocket.file.simplesax.PlainTextHandler;
import net.sf.openrocket.optimization.rocketoptimization.OptimizableParameter;
import net.sf.openrocket.rocketcomponent.FlightConfiguration;
import net.sf.openrocket.rocketcomponent.FlightConfigurationId;
import net.sf.openrocket.rocketcomponent.FlightConfigurableParameterSet;
import net.sf.openrocket.rocketcomponent.Rocket;
import net.sf.openrocket.util.Named;
class MotorConfigurationHandler extends AbstractElementHandler {
@SuppressWarnings("unused")

View File

@ -127,8 +127,7 @@ class NoseConeHandler extends BaseHandler<NoseCone> {
if (noseCone.isFilled()) {
noseCone.setAftShoulderThickness(noseCone.getAftShoulderRadius());
}
else {
} else {
noseCone.setThickness(thickness);
noseCone.setAftShoulderThickness(thickness);
}
@ -149,6 +148,7 @@ class NoseConeHandler extends BaseHandler<NoseCone> {
*
* @return BULK
*/
@Override
public Material.Type getMaterialType() {
return Material.Type.BULK;
}

View File

@ -9,7 +9,6 @@ import net.sf.openrocket.aerodynamics.WarningSet;
import net.sf.openrocket.file.DocumentLoadingContext;
import net.sf.openrocket.file.rocksim.RocksimCommonConstants;
import net.sf.openrocket.file.rocksim.RocksimLocationMode;
import net.sf.openrocket.rocketcomponent.RadiusRingComponent;
import net.sf.openrocket.rocketcomponent.RocketComponent;
import org.xml.sax.SAXException;

View File

@ -153,6 +153,7 @@ class TransitionHandler extends BaseHandler<Transition> {
*
* @return BULK
*/
@Override
public Material.Type getMaterialType() {
return Material.Type.BULK;
}

View File

@ -23,7 +23,8 @@ public abstract class Material implements Comparable<Material> {
public enum Type {
LINE("Databases.materials.types.Line", UnitGroup.UNITS_DENSITY_LINE),
SURFACE("Databases.materials.types.Surface", UnitGroup.UNITS_DENSITY_SURFACE),
BULK("Databases.materials.types.Bulk", UnitGroup.UNITS_DENSITY_BULK);
BULK("Databases.materials.types.Bulk", UnitGroup.UNITS_DENSITY_BULK),
CUSTOM("Databases.materials.types.Custom", UnitGroup.UNITS_DENSITY_BULK);
private final String name;
private final UnitGroup units;
@ -85,6 +86,18 @@ public abstract class Material implements Comparable<Material> {
}
}
public static class Custom extends Material {
Custom(String name, double density, boolean userDefined) {
super(name, density, userDefined);
}
@Override
public Type getType() {
return Type.CUSTOM;
}
}
private final String name;
@ -187,6 +200,9 @@ public abstract class Material implements Comparable<Material> {
case BULK:
return new Material.Bulk(name, density, userDefined);
case CUSTOM:
return new Material.Custom(name, density, userDefined);
default:
throw new IllegalArgumentException("Unknown material type: " + type);

View File

@ -7,7 +7,6 @@ import net.sf.openrocket.material.Material;
import net.sf.openrocket.preset.ComponentPreset;
import net.sf.openrocket.startup.Application;
import net.sf.openrocket.unit.UnitGroup;
import net.sf.openrocket.util.Coordinate;
/**
* Class of components with well-defined physical appearance and which have an effect on

View File

@ -1,6 +1,5 @@
package net.sf.openrocket.rocketcomponent;
import net.sf.openrocket.util.ChangeSource;
/**
* Interface for a parameter object that can be configured per

View File

@ -33,7 +33,6 @@ public abstract class RadiusRingComponent extends RingComponent implements Coaxi
@Override
public double getOuterRadius() {
if (outerRadiusAutomatic && getParent() instanceof RadialParent) {
RocketComponent parent = getParent();
double pos1 = this.toRelative(Coordinate.NUL, parent)[0].x;
double pos2 = this.toRelative(new Coordinate(getLength()), parent)[0].x;
pos1 = MathUtil.clamp(pos1, 0, parent.getLength());

View File

@ -29,7 +29,7 @@ import net.sf.openrocket.util.UniqueID;
*
* @author Sampo Niskanen <sampo.niskanen@iki.fi>
*/
@SuppressWarnings("serial")
public class Rocket extends RocketComponent {
private static final Logger log = LoggerFactory.getLogger(Rocket.class);
private static final Translator trans = Application.getTranslator();

View File

@ -1101,20 +1101,6 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
return this.position;
}
/**
* @deprecated kept around as example code. instead use getLocations
* @return
*/
@Deprecated
private Coordinate getAbsoluteVector() {
if (null == this.parent) {
// == improperly initialized components OR the root Rocket instance
return Coordinate.ZERO;
} else {
return this.getAbsoluteVector().add(this.getOffset());
}
}
/**
* Returns coordinates of this component's instances in relation to this.parent.
* <p>

View File

@ -49,7 +49,6 @@ public class Sleeve extends RingComponent {
public double getInnerRadius() {
// Implement parent inner radius automation
if (isInnerRadiusAutomatic() && getParent() instanceof RadialParent) {
RocketComponent parent = getParent();
double pos1 = this.toRelative(Coordinate.NUL, parent)[0].x;
double pos2 = this.toRelative(new Coordinate(getLength()), parent)[0].x;
pos1 = MathUtil.clamp(pos1, 0, parent.getLength());

View File

@ -1,14 +1,9 @@
package net.sf.openrocket.rocketcomponent;
import java.util.EventObject;
import java.util.List;
import net.sf.openrocket.l10n.Translator;
import net.sf.openrocket.simulation.FlightEvent;
import net.sf.openrocket.startup.Application;
import net.sf.openrocket.util.ArrayList;
import net.sf.openrocket.util.MathUtil;
import net.sf.openrocket.util.StateChangeListener;
public class StageSeparationConfiguration implements FlightConfigurableParameter<StageSeparationConfiguration> {

View File

@ -38,7 +38,6 @@ public abstract class ThicknessRingComponent extends RingComponent {
@Override
public double getOuterRadius() {
if (isOuterRadiusAutomatic() && getParent() instanceof RadialParent) {
RocketComponent parent = getParent();
double pos1 = this.toRelative(Coordinate.NUL, parent)[0].x;
double pos2 = this.toRelative(new Coordinate(getLength()), parent)[0].x;
pos1 = MathUtil.clamp(pos1, 0, parent.getLength());

View File

@ -6,8 +6,6 @@ import net.sf.openrocket.masscalc.MassCalculator;
import net.sf.openrocket.masscalc.MassCalculator.MassCalcType;
import net.sf.openrocket.masscalc.MassData;
import net.sf.openrocket.models.atmosphere.AtmosphericConditions;
import net.sf.openrocket.motor.MotorConfiguration;
import net.sf.openrocket.rocketcomponent.FlightConfiguration;
import net.sf.openrocket.simulation.exception.SimulationException;
import net.sf.openrocket.simulation.listeners.SimulationListenerHelper;
import net.sf.openrocket.util.BugException;

View File

@ -21,7 +21,6 @@ import net.sf.openrocket.rocketcomponent.MotorMount;
import net.sf.openrocket.rocketcomponent.RecoveryDevice;
import net.sf.openrocket.rocketcomponent.RocketComponent;
import net.sf.openrocket.rocketcomponent.StageSeparationConfiguration;
import net.sf.openrocket.simulation.FlightEvent.Type;
import net.sf.openrocket.simulation.exception.MotorIgnitionException;
import net.sf.openrocket.simulation.exception.SimulationException;
import net.sf.openrocket.simulation.exception.SimulationLaunchException;

View File

@ -6,7 +6,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import de.congrace.exp4j.Calculable;
import de.congrace.exp4j.ExpressionBuilder;
import de.congrace.exp4j.Variable;
import net.sf.openrocket.document.OpenRocketDocument;
import net.sf.openrocket.logging.Markers;

View File

@ -1,11 +1,6 @@
package net.sf.openrocket.file.openrocket.importt;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.util.Arrays;
import java.util.List;
import net.sf.openrocket.file.openrocket.OpenRocketSaver;
import net.sf.openrocket.util.BaseTestCase.BaseTestCase;

View File

@ -4,7 +4,6 @@ import static org.junit.Assert.assertEquals;
import org.junit.Test;
import net.sf.openrocket.simulation.MotorState;
import net.sf.openrocket.util.Coordinate;
import net.sf.openrocket.util.Inertia;

View File

@ -40,6 +40,7 @@ import net.sf.openrocket.util.StateChangeListener;
* @author Sampo Niskanen <sampo.niskanen@iki.fi>
*/
public class BooleanModel extends AbstractAction implements StateChangeListener, Invalidatable {
private static final long serialVersionUID = -7299680391506320196L;
private static final Logger log = LoggerFactory.getLogger(BooleanModel.class);
private final ChangeSource source;

View File

@ -5,6 +5,7 @@ import java.awt.event.MouseEvent;
import javax.swing.JTable;
import javax.swing.table.JTableHeader;
@SuppressWarnings("serial")
public class ColumnTable extends JTable {
public ColumnTable( ColumnTableModel model ) {

View File

@ -6,6 +6,7 @@ import javax.swing.table.TableColumnModel;
import net.sf.openrocket.startup.Application;
@SuppressWarnings("serial")
public abstract class ColumnTableModel extends AbstractTableModel {
private final Column[] columns;

View File

@ -16,13 +16,15 @@ import net.sf.openrocket.file.FileSystemAttachmentFactory;
import net.sf.openrocket.gui.util.SwingPreferences;
import net.sf.openrocket.l10n.Translator;
import net.sf.openrocket.startup.Application;
import net.sf.openrocket.appearance.defaults.ResourceDecalImage;
public class DecalModel extends AbstractListModel implements ComboBoxModel {
public class DecalModel extends AbstractListModel<DecalImage> implements ComboBoxModel<DecalImage> {
private static final long serialVersionUID = -3922419344990421156L;
private static final Translator trans = Application.getTranslator();
private static final String NONE_SELECTED = trans.get("lbl.select");
private static final String SELECT_FILE = trans.get("lbl.choose");
private static final ResourceDecalImage NONE_SELECTED = new ResourceDecalImage(trans.get("lbl.select"));
private static final ResourceDecalImage SELECT_FILE = new ResourceDecalImage(trans.get("lbl.choose"));
private final OpenRocketDocument document;
private final Component parent;
@ -45,7 +47,7 @@ public class DecalModel extends AbstractListModel implements ComboBoxModel {
}
@Override
public Object getElementAt(int index) {
public DecalImage getElementAt(int index) {
if (index <= 0) {
return NONE_SELECTED;
}

View File

@ -64,6 +64,7 @@ public class DoubleModel implements StateChangeListener, ChangeSource, Invalidat
* This is still the design, but now extends AbstractSpinnerModel to allow other characters
* to be entered so that fractional units and expressions can be used.
*/
@SuppressWarnings("serial")
public class ValueSpinnerModel extends AbstractSpinnerModel implements Invalidatable {
private ExpressionParser parser = new ExpressionParser();
@ -443,6 +444,7 @@ public class DoubleModel implements StateChangeListener, ChangeSource, Invalidat
//////////// Action model ////////////
@SuppressWarnings("serial")
private class AutomaticActionModel extends AbstractAction implements StateChangeListener, Invalidatable {
private boolean oldValue = false;

View File

@ -19,10 +19,12 @@ import net.sf.openrocket.rocketcomponent.RocketComponent;
import net.sf.openrocket.startup.Application;
import net.sf.openrocket.util.Reflection;
public class MaterialModel extends AbstractListModel implements
ComboBoxModel, ComponentChangeListener, DatabaseListener<Material> {
private final String custom;
public class MaterialModel extends AbstractListModel<Material> implements
ComboBoxModel<Material>, ComponentChangeListener, DatabaseListener<Material> {
private static final long serialVersionUID = 4552478532933113655L;
private final Material custom;
private final Component parentUIComponent;
@ -47,7 +49,7 @@ public class MaterialModel extends AbstractListModel implements
this.parentUIComponent = parent;
this.rocketComponent = component;
this.type = type;
this.custom = trans.get ("Material.CUSTOM");
this.custom = Material.newMaterial( Material.Type.CUSTOM, trans.get ("Material.CUSTOM"), 1.0, true );
switch (type) {
case LINE:
@ -128,7 +130,7 @@ public class MaterialModel extends AbstractListModel implements
}
@Override
public Object getElementAt(int index) {
public Material getElementAt(int index) {
if (index == database.size()) {
return custom;
} else if (index >= database.size()+1) {

View File

@ -11,6 +11,7 @@ import javax.swing.plaf.basic.BasicSliderUI;
* @author Sampo Niskanen <sampo.niskanen@iki.fi>
*/
@SuppressWarnings("serial")
public class BasicSlider extends JSlider {
public BasicSlider(BoundedRangeModel brm) {

View File

@ -12,8 +12,8 @@ import javax.swing.tree.TreeModel;
import javax.swing.tree.TreeNode;
import javax.swing.tree.TreePath;
@SuppressWarnings("serial")
public class BasicTree extends JTree {
public BasicTree() {
super();

View File

@ -7,6 +7,7 @@ import javax.swing.table.AbstractTableModel;
/*
* TODO: LOW: This is currently unused.
*/
@SuppressWarnings("serial")
public abstract class CollectionTable<T> extends JTable {
private final String[] columnNames;

View File

@ -24,6 +24,7 @@ import java.awt.event.ActionListener;
*
* The chosen color may be retrieved via a call to getCurrentColor.
*/
@SuppressWarnings("serial")
public class ColorChooser extends JPanel {
private static final String COLOR_CHOOSER_BUTTON_LABEL = "Color";

View File

@ -22,6 +22,7 @@ import net.sf.openrocket.logging.Markers;
*
* @author Sampo Niskanen <sampo.niskanen@iki.fi>
*/
@SuppressWarnings("serial")
public class ColorChooserButton extends JButton {
private static final Logger log = LoggerFactory.getLogger(ColorChooserButton.class);

View File

@ -16,6 +16,7 @@ import net.sf.openrocket.startup.Preferences;
*
* @author Sampo Niskanen <sampo.niskanen@iki.fi>
*/
@SuppressWarnings("serial")
public class CsvOptionPanel extends JPanel {
private static final Translator trans = Application.getTranslator();
@ -25,9 +26,9 @@ public class CsvOptionPanel extends JPanel {
private final String baseClassName;
private final JComboBox fieldSeparator;
private final JComboBox<String> fieldSeparator;
private final JCheckBox[] options;
private final JComboBox commentCharacter;
private final JComboBox<String> commentCharacter;
/**
* Sole constructor.
@ -57,7 +58,7 @@ public class CsvOptionPanel extends JPanel {
label.setToolTipText(tip);
panel.add(label, "gapright unrel");
fieldSeparator = new JComboBox(new String[] { ",", ";", SPACE, TAB });
fieldSeparator = new JComboBox<String>(new String[] { ",", ";", SPACE, TAB });
fieldSeparator.setEditable(true);
fieldSeparator.setSelectedItem(Application.getPreferences().getString(Preferences.EXPORT_FIELD_SEPARATOR, ","));
fieldSeparator.setToolTipText(tip);
@ -90,7 +91,7 @@ public class CsvOptionPanel extends JPanel {
label.setToolTipText(tip);
panel.add(label, "split 2, gapright unrel");
commentCharacter = new JComboBox(new String[] { "#", "%", ";" });
commentCharacter = new JComboBox<String>(new String[] { "#", "%", ";" });
commentCharacter.setEditable(true);
commentCharacter.setSelectedItem(Application.getPreferences().getString(Preferences.EXPORT_COMMENT_CHARACTER, "#"));
commentCharacter.setToolTipText(tip);

View File

@ -11,6 +11,7 @@ import javax.swing.JScrollPane;
import javax.swing.ScrollPaneConstants;
import javax.swing.SwingUtilities;
@SuppressWarnings("serial")
public class DescriptionArea extends JScrollPane {
private final JEditorPane editorPane;

View File

@ -11,6 +11,7 @@ import javax.swing.table.TableCellEditor;
import net.sf.openrocket.gui.SpinnerEditor;
import net.sf.openrocket.gui.adaptors.DoubleModel;
@SuppressWarnings("serial")
public class DoubleCellEditor extends AbstractCellEditor implements TableCellEditor {
private final JSpinner editor;

View File

@ -33,6 +33,7 @@ import net.sf.openrocket.startup.Application;
import net.sf.openrocket.unit.Unit;
import net.sf.openrocket.unit.UnitGroup;
@SuppressWarnings("serial")
public class SimulationExportPanel extends JPanel {
private static final String SPACE = "SPACE";

View File

@ -23,10 +23,11 @@ import net.sf.openrocket.unit.UnitGroup;
public abstract class UnitCellEditor extends AbstractCellEditor
implements TableCellEditor, ActionListener {
private final JComboBox editor;
private static final long serialVersionUID = 8319509695751912662L;
private final JComboBox<Unit> editor;
public UnitCellEditor() {
editor = new JComboBox();
editor = new JComboBox<Unit>();
editor.setEditable(false);
editor.addActionListener(this);
}

View File

@ -17,6 +17,7 @@ import net.sf.openrocket.gui.adaptors.DoubleModel;
*
* @author Sampo Niskanen <sampo.niskanen@iki.fi>
*/
@SuppressWarnings("serial")
public class CompassPointer extends CompassRose implements Resettable {
private static final Color PRIMARY_POINTER_COLOR = new Color(1.0f, 0.2f, 0.2f);

View File

@ -20,6 +20,7 @@ import net.sf.openrocket.startup.Application;
*
* @author Sampo Niskanen <sampo.niskanen@iki.fi>
*/
@SuppressWarnings("serial")
public class CompassRose extends JComponent {
private static final Translator trans = Application.getTranslator();

View File

@ -31,6 +31,7 @@ import net.sf.openrocket.util.MathUtil;
*
* @author Sampo Niskanen <sampo.niskanen@iki.fi>
*/
@SuppressWarnings("serial")
public class CompassSelectionButton extends FlatButton implements Resettable {
private static final Translator trans = Application.getTranslator();

View File

@ -11,6 +11,7 @@ import net.sf.openrocket.util.MathUtil;
*
* @author Sampo Niskanen <sampo.niskanen@iki.fi>
*/
@SuppressWarnings("serial")
public class CompassSelector extends CompassPointer {
private final DoubleModel model;

View File

@ -51,6 +51,8 @@ import net.sf.openrocket.util.LineStyle;
import net.sf.openrocket.util.StateChangeListener;
public class AppearancePanel extends JPanel {
private static final long serialVersionUID = 2709187552673202019L;
private static final Translator trans = Application.getTranslator();
private EditDecalHelper editDecalHelper = Application.getInjector()
@ -159,7 +161,7 @@ public class AppearancePanel extends JPanel {
final JButton colorButton = new JButton(new ColorIcon(ab.getPaint()));
final DecalModel decalModel = new DecalModel(this, document, ab);
final JComboBox textureDropDown = new JComboBox(decalModel);
final JComboBox<DecalImage> textureDropDown = new JComboBox<DecalImage>(decalModel);
ab.addChangeListener(new StateChangeListener() {
@Override
@ -248,7 +250,7 @@ public class AppearancePanel extends JPanel {
System.arraycopy(LineStyle.values(), 0, list, 1,
LineStyle.values().length);
JComboBox combo = new JComboBox(new EnumModel<LineStyle>(c,
final JComboBox<LineStyle> combo = new JComboBox<LineStyle>(new EnumModel<LineStyle>(c,
"LineStyle",
// // Default style
list, trans.get("LineStyle.Defaultstyle")));
@ -382,7 +384,7 @@ public class AppearancePanel extends JPanel {
EdgeMode[] list = new EdgeMode[EdgeMode.values().length];
System.arraycopy(EdgeMode.values(), 0, list, 0,
EdgeMode.values().length);
JComboBox combo = new JComboBox(new EnumModel<EdgeMode>(ab,
JComboBox<EdgeMode> combo = new JComboBox<EdgeMode>(new EnumModel<EdgeMode>(ab,
"EdgeMode", list));
mDefault.addEnableComponent(combo, false);
add(combo);

View File

@ -20,6 +20,7 @@ import net.sf.openrocket.rocketcomponent.RocketComponent;
import net.sf.openrocket.startup.Application;
import net.sf.openrocket.unit.UnitGroup;
@SuppressWarnings("serial")
public class BodyTubeConfig extends RocketComponentConfig {
private DoubleModel maxLength;

View File

@ -10,6 +10,7 @@ import net.sf.openrocket.startup.Application;
@SuppressWarnings("serial")
public class BulkheadConfig extends RingComponentConfig {
private static final Translator trans = Application.getTranslator();

View File

@ -10,6 +10,7 @@ import net.sf.openrocket.startup.Application;
@SuppressWarnings("serial")
public class CenteringRingConfig extends RingComponentConfig {
private static final Translator trans = Application.getTranslator();

View File

@ -1,28 +1,10 @@
package net.sf.openrocket.gui.configdialog;
import javax.swing.ComboBoxModel;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JSpinner;
import net.miginfocom.swing.MigLayout;
import net.sf.openrocket.document.OpenRocketDocument;
import net.sf.openrocket.gui.SpinnerEditor;
import net.sf.openrocket.gui.adaptors.DoubleModel;
import net.sf.openrocket.gui.adaptors.EnumModel;
import net.sf.openrocket.gui.adaptors.IntegerModel;
import net.sf.openrocket.gui.components.UnitSelector;
import net.sf.openrocket.l10n.Translator;
import net.sf.openrocket.rocketcomponent.AxialStage;
import net.sf.openrocket.rocketcomponent.ComponentAssembly;
import net.sf.openrocket.rocketcomponent.RocketComponent;
import net.sf.openrocket.startup.Application;
import net.sf.openrocket.unit.UnitGroup;
@SuppressWarnings("serial")
public class ComponentAssemblyConfig extends RocketComponentConfig {
private static final long serialVersionUID = -944969957186522471L;
private static final Translator trans = Application.getTranslator();
public ComponentAssemblyConfig(OpenRocketDocument document, RocketComponent component) {
super(document, component);

View File

@ -23,6 +23,7 @@ import net.sf.openrocket.rocketcomponent.RocketComponent;
import net.sf.openrocket.startup.Application;
import net.sf.openrocket.unit.UnitGroup;
@SuppressWarnings("serial")
public class EllipticalFinSetConfig extends FinSetConfig {
private static final Translator trans = Application.getTranslator();
@ -31,12 +32,10 @@ public class EllipticalFinSetConfig extends FinSetConfig {
DoubleModel m;
JSpinner spin;
JComboBox combo;
JPanel mainPanel = new JPanel(new MigLayout());
JPanel panel = new JPanel(new MigLayout("gap rel unrel", "[][65lp::][30lp::]", ""));
//// Number of fins
@ -111,7 +110,7 @@ public class EllipticalFinSetConfig extends FinSetConfig {
//// Position relative to:
panel.add(new JLabel(trans.get("EllipticalFinSetCfg.Positionrelativeto")));
combo = new JComboBox(
JComboBox<RocketComponent.Position> positionCombo= new JComboBox<RocketComponent.Position>(
new EnumModel<RocketComponent.Position>(component, "RelativePosition",
new RocketComponent.Position[] {
RocketComponent.Position.TOP,
@ -119,7 +118,7 @@ public class EllipticalFinSetConfig extends FinSetConfig {
RocketComponent.Position.BOTTOM,
RocketComponent.Position.ABSOLUTE
}));
panel.add(combo, "spanx, growx, wrap");
panel.add(positionCombo, "spanx, growx, wrap");
//// plus
panel.add(new JLabel(trans.get("EllipticalFinSetCfg.plus")), "right");
@ -150,9 +149,9 @@ public class EllipticalFinSetConfig extends FinSetConfig {
//// Cross section
//// Fin cross section:
panel.add(new JLabel(trans.get("EllipticalFinSetCfg.FincrossSection")), "span, split");
combo = new JComboBox(
JComboBox<FinSet.CrossSection> sectionCombo = new JComboBox<FinSet.CrossSection>(
new EnumModel<FinSet.CrossSection>(component, "CrossSection"));
panel.add(combo, "growx, wrap unrel");
panel.add( sectionCombo, "growx, wrap unrel");
//// Thickness:

View File

@ -56,7 +56,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class FreeformFinSetConfig extends FinSetConfig {
private static final long serialVersionUID = 2504130276828826021L;
private static final Logger log = LoggerFactory.getLogger(FreeformFinSetConfig.class);
private static final Translator trans = Application.getTranslator();
@ -86,7 +86,6 @@ public class FreeformFinSetConfig extends FinSetConfig {
DoubleModel m;
JSpinner spin;
JComboBox combo;
JPanel mainPanel = new JPanel(new MigLayout("fill"));
@ -139,9 +138,10 @@ public class FreeformFinSetConfig extends FinSetConfig {
//// Position relative to:
panel.add(new JLabel(trans.get("FreeformFinSetCfg.lbl.Posrelativeto")));
combo = new JComboBox(new EnumModel<RocketComponent.Position>(component, "RelativePosition", new RocketComponent.Position[] { RocketComponent.Position.TOP, RocketComponent.Position.MIDDLE,
RocketComponent.Position.BOTTOM, RocketComponent.Position.ABSOLUTE }));
panel.add(combo, "spanx 3, growx, wrap");
JComboBox<RocketComponent.Position> positionCombo = new JComboBox<RocketComponent.Position>(
new EnumModel<RocketComponent.Position>(component, "RelativePosition", new RocketComponent.Position[] {
RocketComponent.Position.TOP, RocketComponent.Position.MIDDLE, RocketComponent.Position.BOTTOM, RocketComponent.Position.ABSOLUTE }));
panel.add(positionCombo, "spanx 3, growx, wrap");
//// plus
panel.add(new JLabel(trans.get("FreeformFinSetCfg.lbl.plus")), "right");
@ -169,8 +169,8 @@ public class FreeformFinSetConfig extends FinSetConfig {
//// Cross section
//// Fin cross section:
panel.add(new JLabel(trans.get("FreeformFinSetCfg.lbl.FincrossSection")), "span, split");
combo = new JComboBox(new EnumModel<FinSet.CrossSection>(component, "CrossSection"));
panel.add(combo, "growx, wrap unrel");
JComboBox<FinSet.CrossSection> sectionCombo = new JComboBox<FinSet.CrossSection>(new EnumModel<FinSet.CrossSection>(component, "CrossSection"));
panel.add(sectionCombo, "growx, wrap unrel");
//// Thickness:
@ -312,6 +312,8 @@ public class FreeformFinSetConfig extends FinSetConfig {
private class FinPointScrollPane extends ScaleScrollPane {
private static final long serialVersionUID = 2232218393756983666L;
private static final int ANY_MASK = (MouseEvent.ALT_DOWN_MASK | MouseEvent.ALT_GRAPH_DOWN_MASK | MouseEvent.META_DOWN_MASK | MouseEvent.CTRL_DOWN_MASK | MouseEvent.SHIFT_DOWN_MASK);
private int dragIndex = -1;
@ -480,6 +482,11 @@ public class FreeformFinSetConfig extends FinSetConfig {
private class FinPointTableModel extends AbstractTableModel {
/**
*
*/
private static final long serialVersionUID = 4803736958177227852L;
@Override
public int getColumnCount() {
return Columns.values().length;

View File

@ -19,9 +19,9 @@ import net.sf.openrocket.rocketcomponent.RocketComponent;
import net.sf.openrocket.startup.Application;
import net.sf.openrocket.unit.UnitGroup;
@SuppressWarnings("serial")
public class LaunchLugConfig extends RocketComponentConfig {
private MotorConfig motorConfigPane = null;
private static final Translator trans = Application.getTranslator();
public LaunchLugConfig(OpenRocketDocument d, RocketComponent c) {
@ -111,7 +111,7 @@ public class LaunchLugConfig extends RocketComponentConfig {
//// Position relative to:
panel.add(new JLabel(trans.get("LaunchLugCfg.lbl.Posrelativeto")));
JComboBox combo = new JComboBox(
JComboBox<RocketComponent.Position> positionCombo = new JComboBox<RocketComponent.Position>(
new EnumModel<RocketComponent.Position>(component, "RelativePosition",
new RocketComponent.Position[] {
RocketComponent.Position.TOP,
@ -119,7 +119,7 @@ public class LaunchLugConfig extends RocketComponentConfig {
RocketComponent.Position.BOTTOM,
RocketComponent.Position.ABSOLUTE
}));
panel.add(combo, "spanx, growx, wrap");
panel.add( positionCombo, "spanx, growx, wrap");
//// plus
panel.add(new JLabel(trans.get("LaunchLugCfg.lbl.plus")), "right");

View File

@ -89,10 +89,10 @@ public class ParachuteConfig extends RecoveryDeviceConfig {
//// Material:
panel.add(new JLabel(trans.get("ParachuteCfg.lbl.Material")));
JComboBox<?> combo = new JComboBox(new MaterialModel(panel, component,
JComboBox<Material> surfaceMaterialCombo = new JComboBox<Material>(new MaterialModel(panel, component,
Material.Type.SURFACE));
combo.setToolTipText(trans.get("ParachuteCfg.combo.MaterialModel"));
panel.add(combo, "spanx 3, growx, wrap 30lp");
surfaceMaterialCombo.setToolTipText(trans.get("ParachuteCfg.combo.MaterialModel"));
panel.add( surfaceMaterialCombo, "spanx 3, growx, wrap 30lp");
@ -122,9 +122,9 @@ public class ParachuteConfig extends RecoveryDeviceConfig {
//// Material:
panel.add(new JLabel(trans.get("ParachuteCfg.lbl.Material")));
combo = new JComboBox(new MaterialModel(panel, component, Material.Type.LINE,
JComboBox<Material> shroudMaterialCombo = new JComboBox<Material>(new MaterialModel(panel, component, Material.Type.LINE,
"LineMaterial"));
panel.add(combo, "spanx 3, growx, wrap");
panel.add( shroudMaterialCombo, "spanx 3, growx, wrap");
@ -138,7 +138,7 @@ public class ParachuteConfig extends RecoveryDeviceConfig {
//// Position relative to:
panel.add(new JLabel(trans.get("ParachuteCfg.lbl.Posrelativeto")));
combo = new JComboBox<RocketComponent.Position>(
JComboBox<RocketComponent.Position> positionCombo = new JComboBox<RocketComponent.Position>(
new EnumModel<RocketComponent.Position>(component, "RelativePosition",
new RocketComponent.Position[] {
RocketComponent.Position.TOP,
@ -146,7 +146,7 @@ public class ParachuteConfig extends RecoveryDeviceConfig {
RocketComponent.Position.BOTTOM,
RocketComponent.Position.ABSOLUTE
}));
panel.add(combo, "spanx, growx, wrap");
panel.add( positionCombo, "spanx, growx, wrap");
//// plus
panel.add(new JLabel(trans.get("ParachuteCfg.lbl.plus")), "right");
@ -199,12 +199,12 @@ public class ParachuteConfig extends RecoveryDeviceConfig {
DeploymentConfiguration deploymentConfig = parachute.getDeploymentConfigurations().getDefault();
// this issues a warning because EnumModel ipmlements ComboBoxModel without a parameter...
ComboBoxModel<DeploymentConfiguration.DeployEvent> deployOptionsModel = new EnumModel<DeploymentConfiguration.DeployEvent>(deploymentConfig, "DeployEvent");
combo = new JComboBox<DeploymentConfiguration.DeployEvent>( deployOptionsModel );
JComboBox<DeploymentConfiguration.DeployEvent> eventCombo = new JComboBox<DeploymentConfiguration.DeployEvent>( deployOptionsModel );
if( (component.getStageNumber() + 1 ) == d.getRocket().getStageCount() ){
// This is the bottom stage: Restrict deployment options.
combo.removeItem( DeployEvent.LOWER_STAGE_SEPARATION );
eventCombo.removeItem( DeployEvent.LOWER_STAGE_SEPARATION );
}
panel.add(combo, "spanx 3, growx, wrap");
panel.add(eventCombo, "spanx 3, growx, wrap");
// ... and delay
//// plus

View File

@ -14,14 +14,14 @@ import net.sf.openrocket.gui.adaptors.EnumModel;
import net.sf.openrocket.gui.adaptors.IntegerModel;
import net.sf.openrocket.gui.components.UnitSelector;
import net.sf.openrocket.l10n.Translator;
import net.sf.openrocket.rocketcomponent.AxialStage;
import net.sf.openrocket.rocketcomponent.ComponentAssembly;
import net.sf.openrocket.rocketcomponent.RocketComponent;
import net.sf.openrocket.startup.Application;
import net.sf.openrocket.unit.UnitGroup;
@SuppressWarnings("serial")
public class PodSetConfig extends RocketComponentConfig {
private static final long serialVersionUID = -944969957186522471L;
private static final Translator trans = Application.getTranslator();
public PodSetConfig(OpenRocketDocument document, RocketComponent component) {

View File

@ -53,7 +53,8 @@ import net.sf.openrocket.unit.UnitGroup;
import net.sf.openrocket.util.Invalidatable;
public class RocketComponentConfig extends JPanel {
private static final long serialVersionUID = -2925484062132243982L;
private static final Translator trans = Application.getTranslator();
protected final OpenRocketDocument document;
@ -62,7 +63,7 @@ public class RocketComponentConfig extends JPanel {
private final List<Invalidatable> invalidatables = new ArrayList<Invalidatable>();
private JComboBox presetComboBox;
private JComboBox<?> presetComboBox;
private PresetModel presetModel;
protected final JTextField componentNameField;
@ -224,10 +225,10 @@ public class RocketComponentConfig extends JPanel {
label.setToolTipText(trans.get("RocketCompCfg.lbl.ttip.componentmaterialaffects"));
subPanel.add(label, "spanx 4, wrap rel");
JComboBox combo = new JComboBox(new MaterialModel(subPanel, component, type, partName));
JComboBox<Material> materialCombo = new JComboBox<Material>(new MaterialModel(subPanel, component, type, partName));
//// The component material affects the weight of the component.
combo.setToolTipText(trans.get("RocketCompCfg.combo.ttip.componentmaterialaffects"));
subPanel.add(combo, "spanx 4, growx, wrap paragraph");
materialCombo.setToolTipText(trans.get("RocketCompCfg.combo.ttip.componentmaterialaffects"));
subPanel.add(materialCombo, "spanx 4, growx, wrap paragraph");
if (component instanceof ExternalComponent) {
@ -239,9 +240,10 @@ public class RocketComponentConfig extends JPanel {
label.setToolTipText(tip);
subPanel.add(label, "spanx 4, wmin 220lp, wrap rel");
combo = new JComboBox(new EnumModel<ExternalComponent.Finish>(component, "Finish"));
combo.setToolTipText(tip);
subPanel.add(combo, "spanx 4, growx, split");
JComboBox<ExternalComponent.Finish> finishCombo = new JComboBox<ExternalComponent.Finish>(
new EnumModel<ExternalComponent.Finish>(component, "Finish"));
finishCombo.setToolTipText(tip);
subPanel.add( finishCombo, "spanx 4, growx, split");
//// Set for all
JButton button = new JButton(trans.get("RocketCompCfg.but.Setforall"));

View File

@ -31,6 +31,7 @@ import net.sf.openrocket.startup.Application;
import net.sf.openrocket.unit.UnitGroup;
public class StreamerConfig extends RecoveryDeviceConfig {
private static final long serialVersionUID = -4445736703470494588L;
private static final Translator trans = Application.getTranslator();
public StreamerConfig(OpenRocketDocument d, final RocketComponent component) {
@ -92,11 +93,11 @@ public class StreamerConfig extends RecoveryDeviceConfig {
//// Material:
panel.add(new JLabel(trans.get("StreamerCfg.lbl.Material")));
JComboBox combo = new JComboBox(new MaterialModel(panel, component,
JComboBox<Material> streamerMaterialCombo = new JComboBox<Material>(new MaterialModel(panel, component,
Material.Type.SURFACE));
//// The component material affects the weight of the component.
combo.setToolTipText(trans.get("StreamerCfg.combo.ttip.MaterialModel"));
panel.add(combo, "spanx 3, growx, wrap 20lp");
streamerMaterialCombo.setToolTipText(trans.get("StreamerCfg.combo.ttip.MaterialModel"));
panel.add(streamerMaterialCombo, "spanx 3, growx, wrap 20lp");
@ -138,7 +139,7 @@ public class StreamerConfig extends RecoveryDeviceConfig {
//// Position relative to:
panel.add(new JLabel(trans.get("StreamerCfg.lbl.Posrelativeto")));
combo = new JComboBox(
JComboBox<RocketComponent.Position> positionCombo = new JComboBox<RocketComponent.Position>(
new EnumModel<RocketComponent.Position>(component, "RelativePosition",
new RocketComponent.Position[] {
RocketComponent.Position.TOP,
@ -146,7 +147,7 @@ public class StreamerConfig extends RecoveryDeviceConfig {
RocketComponent.Position.BOTTOM,
RocketComponent.Position.ABSOLUTE
}));
panel.add(combo, "spanx, growx, wrap");
panel.add( positionCombo, "spanx, growx, wrap");
//// plus
panel.add(new JLabel(trans.get("StreamerCfg.lbl.plus")), "right");
@ -196,12 +197,12 @@ public class StreamerConfig extends RecoveryDeviceConfig {
panel.add(new JLabel(trans.get("StreamerCfg.lbl.Deploysat") + " " + CommonStrings.dagger), "");
DeploymentConfiguration deploymentConfig = streamer.getDeploymentConfigurations().getDefault();
combo = new JComboBox(new EnumModel<DeploymentConfiguration.DeployEvent>(deploymentConfig, "DeployEvent"));
JComboBox<DeploymentConfiguration.DeployEvent> eventCombo = new JComboBox<DeploymentConfiguration.DeployEvent>(new EnumModel<DeploymentConfiguration.DeployEvent>(deploymentConfig, "DeployEvent"));
if( (component.getStageNumber() + 1 ) == d.getRocket().getStageCount() ){
// This is the bottom stage. restrict deployment options.
combo.removeItem( DeployEvent.LOWER_STAGE_SEPARATION );
eventCombo.removeItem( DeployEvent.LOWER_STAGE_SEPARATION );
}
panel.add(combo, "spanx 3, growx, wrap");
panel.add( eventCombo, "spanx 3, growx, wrap");
// ... and delay
//// plus

View File

@ -26,9 +26,10 @@ import net.sf.openrocket.startup.Application;
import net.sf.openrocket.unit.UnitGroup;
public class TransitionConfig extends RocketComponentConfig {
private static final long serialVersionUID = -1851275950604625741L;
private static final Translator trans = Application.getTranslator();
private JComboBox typeBox;
private JComboBox<Transition.Shape> typeBox;
//private JLabel description;
private JLabel shapeLabel;
@ -59,7 +60,7 @@ public class TransitionConfig extends RocketComponentConfig {
Transition.Shape selected = ((Transition) component).getType();
Transition.Shape[] typeList = Transition.Shape.values();
typeBox = new JComboBox(typeList);
typeBox = new JComboBox<Transition.Shape>(typeList);
typeBox.setEditable(false);
typeBox.setSelectedItem(selected);
typeBox.addActionListener(new ActionListener() {

View File

@ -26,6 +26,7 @@ import net.sf.openrocket.unit.UnitGroup;
public class TrapezoidFinSetConfig extends FinSetConfig {
private static final long serialVersionUID = -4870745241749769842L;
private static final Translator trans = Application.getTranslator();
public TrapezoidFinSetConfig(OpenRocketDocument d, final RocketComponent component) {
@ -33,7 +34,6 @@ public class TrapezoidFinSetConfig extends FinSetConfig {
DoubleModel m;
JSpinner spin;
JComboBox combo;
JPanel mainPanel = new JPanel(new MigLayout());
@ -167,7 +167,7 @@ public class TrapezoidFinSetConfig extends FinSetConfig {
//// Position relative to:
panel.add(new JLabel(trans.get("TrapezoidFinSetCfg.lbl.Posrelativeto")));
combo = new JComboBox(
JComboBox<RocketComponent.Position> positionCombo = new JComboBox<RocketComponent.Position>(
new EnumModel<RocketComponent.Position>(component, "RelativePosition",
new RocketComponent.Position[] {
RocketComponent.Position.TOP,
@ -175,7 +175,7 @@ public class TrapezoidFinSetConfig extends FinSetConfig {
RocketComponent.Position.BOTTOM,
RocketComponent.Position.ABSOLUTE
}));
panel.add(combo, "spanx, growx, wrap");
panel.add(positionCombo, "spanx, growx, wrap");
//// plus
panel.add(new JLabel(trans.get("TrapezoidFinSetCfg.lbl.plus")), "right");
@ -206,9 +206,9 @@ public class TrapezoidFinSetConfig extends FinSetConfig {
//// Fin cross section:
panel.add(new JLabel(trans.get("TrapezoidFinSetCfg.lbl.FincrossSection")));
combo = new JComboBox(
JComboBox<FinSet.CrossSection> sectionCombo = new JComboBox<FinSet.CrossSection>(
new EnumModel<FinSet.CrossSection>(component, "CrossSection"));
panel.add(combo, "span, growx, wrap");
panel.add( sectionCombo, "span, growx, wrap");
//// Thickness:

View File

@ -22,8 +22,7 @@ import net.sf.openrocket.startup.Application;
import net.sf.openrocket.unit.UnitGroup;
public class TubeFinSetConfig extends RocketComponentConfig {
private MotorConfig motorConfigPane = null;
private static final long serialVersionUID = 508482875624928676L;
private static final Translator trans = Application.getTranslator();
public TubeFinSetConfig(OpenRocketDocument d, RocketComponent c) {
@ -125,7 +124,7 @@ public class TubeFinSetConfig extends RocketComponentConfig {
//// Position relative to:
panel.add(new JLabel(trans.get("LaunchLugCfg.lbl.Posrelativeto")));
JComboBox combo = new JComboBox(
JComboBox<RocketComponent.Position> positionCombo = new JComboBox<RocketComponent.Position>(
new EnumModel<RocketComponent.Position>(component, "RelativePosition",
new RocketComponent.Position[] {
RocketComponent.Position.TOP,
@ -133,7 +132,7 @@ public class TubeFinSetConfig extends RocketComponentConfig {
RocketComponent.Position.BOTTOM,
RocketComponent.Position.ABSOLUTE
}));
panel.add(combo, "spanx, growx, wrap");
panel.add(positionCombo, "spanx, growx, wrap");
//// plus
panel.add(new JLabel(trans.get("LaunchLugCfg.lbl.plus")), "right");

View File

@ -10,12 +10,10 @@ import net.sf.openrocket.gui.util.GUIUtil;
import net.sf.openrocket.l10n.Translator;
import net.sf.openrocket.startup.Application;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@SuppressWarnings("serial")
public class CustomExpressionDialog extends JDialog {
private static final Translator trans = Application.getTranslator();
private static final Logger log = LoggerFactory.getLogger(CustomExpressionDialog.class);
@SuppressWarnings("unused")
private final Window parentWindow;

View File

@ -32,6 +32,7 @@ import net.sf.openrocket.logging.Markers;
import net.sf.openrocket.simulation.customexpression.CustomExpression;
import net.sf.openrocket.startup.Application;
@SuppressWarnings("serial")
public class CustomExpressionPanel extends JPanel {
private static final Logger log = LoggerFactory.getLogger(CustomExpressionPanel.class);

View File

@ -29,6 +29,7 @@ import net.sf.openrocket.startup.Application;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@SuppressWarnings("serial")
public class OperatorSelector extends JDialog {
private static final Translator trans = Application.getTranslator();

View File

@ -34,6 +34,7 @@ import org.slf4j.LoggerFactory;
*
*/
@SuppressWarnings("serial")
public class VariableSelector extends JDialog {
private static final Translator trans = Application.getTranslator();
@ -43,6 +44,7 @@ public class VariableSelector extends JDialog {
private final VariableTableModel tableModel;
private final ExpressionBuilderDialog parentBuilder;
@SuppressWarnings("serial")
public VariableSelector(Window parent, final ExpressionBuilderDialog parentBuilder, final OpenRocketDocument doc){
super(parent, trans.get("CustomVariableSelector.title"), JDialog.ModalityType.DOCUMENT_MODAL);

View File

@ -21,6 +21,7 @@ import net.sf.openrocket.startup.Application;
import net.sf.openrocket.util.BuildProperties;
import net.sf.openrocket.util.Chars;
@SuppressWarnings("serial")
public class AboutDialog extends JDialog {
public static final String OPENROCKET_URL = "http://openrocket.sourceforge.net/";

View File

@ -42,6 +42,7 @@ import net.sf.openrocket.util.JarUtil;
import com.jogamp.opengl.JoglVersion;
@SuppressWarnings("serial")
public class BugReportDialog extends JDialog {
private static final String REPORT_EMAIL = "openrocket-bugs@lists.sourceforge.net";

View File

@ -59,6 +59,7 @@ import net.sf.openrocket.logging.StackTraceWriter;
import net.sf.openrocket.startup.Application;
import net.sf.openrocket.util.NumericComparator;
@SuppressWarnings("serial")
public class DebugLogDialog extends JDialog {
private static final Logger log = LoggerFactory.getLogger(DebugLogDialog.class);
@ -107,6 +108,7 @@ public class DebugLogDialog extends JDialog {
private final SelectableLabel messageLabel;
private final JTextArea stackTraceLabel;
@SuppressWarnings("serial")
public DebugLogDialog(Window parent) {
//// OpenRocket debug log
super(parent, trans.get("debuglogdlg.OpenRocketdebuglog"));

View File

@ -66,7 +66,7 @@ import net.sf.openrocket.util.Reflection.Method;
* @author Sampo Niskanen <sampo.niskanen@iki.fi>
*/
public class ScaleDialog extends JDialog {
private static final long serialVersionUID = -8558418577377862794L;
private static final Logger log = LoggerFactory.getLogger(ScaleDialog.class);
private static final Translator trans = Application.getTranslator();
@ -204,7 +204,7 @@ public class ScaleDialog extends JDialog {
private final RocketComponent selection;
private final boolean onlySelection;
private JComboBox selectionOption;
private JComboBox<String> selectionOption;
private JCheckBox scaleMassValues;
private boolean changing = false;
@ -330,7 +330,7 @@ public class ScaleDialog extends JDialog {
label.setToolTipText(tip);
panel.add(label, "span, split, gapright unrel");
selectionOption = new JComboBox(options.toArray());
selectionOption = new JComboBox<String>(options.toArray(new String[0]));
selectionOption.setEditable(false);
selectionOption.setToolTipText(tip);
panel.add(selectionOption, "growx, wrap para*2");

View File

@ -32,6 +32,7 @@ import net.sf.openrocket.rocketcomponent.Rocket;
import net.sf.openrocket.startup.Application;
import net.sf.openrocket.unit.UnitGroup;
@SuppressWarnings("serial")
public class DeploymentSelectionDialog extends JDialog {
private static final Translator trans = Application.getTranslator();

View File

@ -12,9 +12,9 @@ import net.miginfocom.swing.MigLayout;
import net.sf.openrocket.gui.util.GUIUtil;
import net.sf.openrocket.rocketcomponent.Rocket;
@SuppressWarnings("serial")
public abstract class MotorMountConfigurationPanel extends JPanel {
private final Rocket rocket;
private final Component parent;

View File

@ -23,16 +23,14 @@ import net.sf.openrocket.gui.util.GUIUtil;
import net.sf.openrocket.l10n.Translator;
import net.sf.openrocket.rocketcomponent.AxialStage;
import net.sf.openrocket.rocketcomponent.FlightConfigurationId;
import net.sf.openrocket.rocketcomponent.FlightConfigurableParameterSet;
import net.sf.openrocket.rocketcomponent.Rocket;
import net.sf.openrocket.rocketcomponent.StageSeparationConfiguration;
import net.sf.openrocket.rocketcomponent.StageSeparationConfiguration.SeparationEvent;
import net.sf.openrocket.startup.Application;
import net.sf.openrocket.unit.UnitGroup;
@SuppressWarnings("serial")
public class SeparationSelectionDialog extends JDialog {
private static final long serialVersionUID = 5121844286782432500L;
private static final Translator trans = Application.getTranslator();
@ -74,8 +72,7 @@ public class SeparationSelectionDialog extends JDialog {
overrideButton.setSelected(true);
}
@SuppressWarnings("unchecked")
final JComboBox<?> event = new JComboBox<SeparationEvent>(new EnumModel<SeparationEvent>(newConfiguration, "SeparationEvent"));
final JComboBox<SeparationEvent> event = new JComboBox<SeparationEvent>(new EnumModel<SeparationEvent>(newConfiguration, "SeparationEvent"));
event.setSelectedItem(newConfiguration.getSeparationEvent());
panel.add(event, "wrap rel");

View File

@ -34,6 +34,7 @@ import org.jfree.chart.title.TextTitle;
import org.jfree.data.xy.XYSeries;
import org.jfree.data.xy.XYSeriesCollection;
@SuppressWarnings("serial")
class MotorInformationPanel extends JPanel {
private static final int ZOOM_ICON_POSITION_NEGATIVE_X = 50;

View File

@ -63,6 +63,8 @@ import net.sf.openrocket.util.BugException;
import net.sf.openrocket.utils.MotorCorrelation;
public class ThrustCurveMotorSelectionPanel extends JPanel implements MotorSelector {
private static final long serialVersionUID = -8737784181512143155L;
private static final Logger log = LoggerFactory.getLogger(ThrustCurveMotorSelectionPanel.class);
private static final Translator trans = Application.getTranslator();
@ -87,9 +89,9 @@ public class ThrustCurveMotorSelectionPanel extends JPanel implements MotorSelec
private final JTextField searchField;
private final JLabel curveSelectionLabel;
private final JComboBox curveSelectionBox;
private final DefaultComboBoxModel curveSelectionModel;
private final JComboBox delayBox;
private final JComboBox<MotorHolder> curveSelectionBox;
private final DefaultComboBoxModel<MotorHolder> curveSelectionModel;
private final JComboBox<String> delayBox;
private final MotorInformationPanel motorInformationPanel;
private final MotorFilterPanel motorFilterPanel;
@ -130,6 +132,8 @@ public class ThrustCurveMotorSelectionPanel extends JPanel implements MotorSelec
}
motorFilterPanel = new MotorFilterPanel(allManufacturers, rowFilter) {
private static final long serialVersionUID = 8441555209804602238L;
@Override
public void onSelectionChanged() {
sorter.sort();
@ -147,13 +151,15 @@ public class ThrustCurveMotorSelectionPanel extends JPanel implements MotorSelec
curveSelectionLabel = new JLabel(trans.get("TCMotorSelPan.lbl.Selectthrustcurve"));
panel.add(curveSelectionLabel);
curveSelectionModel = new DefaultComboBoxModel();
curveSelectionBox = new JComboBox(curveSelectionModel);
curveSelectionBox.setRenderer(new CurveSelectionRenderer(curveSelectionBox.getRenderer()));
curveSelectionModel = new DefaultComboBoxModel<MotorHolder>();
curveSelectionBox = new JComboBox<MotorHolder>(curveSelectionModel);
@SuppressWarnings("unchecked")
ListCellRenderer<MotorHolder> lcr = (ListCellRenderer<MotorHolder>) curveSelectionBox.getRenderer();
curveSelectionBox.setRenderer(new CurveSelectionRenderer(lcr));
curveSelectionBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
Object value = curveSelectionBox.getSelectedItem();
MotorHolder value = (MotorHolder)curveSelectionBox.getSelectedItem();
if (value != null) {
select(((MotorHolder) value).getMotor());
}
@ -166,13 +172,13 @@ public class ThrustCurveMotorSelectionPanel extends JPanel implements MotorSelec
{
panel.add(new JLabel(trans.get("TCMotorSelPan.lbl.Ejectionchargedelay")));
delayBox = new JComboBox();
delayBox = new JComboBox<String>();
delayBox.setEditable(true);
delayBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
JComboBox cb = (JComboBox) e.getSource();
String sel = (String) cb.getSelectedItem();
String sel = (String) delayBox.getSelectedItem();
//// None
if (sel.equalsIgnoreCase(trans.get("TCMotorSelPan.equalsIgnoreCase.None"))) {
selectedDelay = Motor.PLUGGED;
@ -554,7 +560,7 @@ public class ThrustCurveMotorSelectionPanel extends JPanel implements MotorSelec
if (selectedMotor == null) {
//// None
delayBox.setModel(new DefaultComboBoxModel(new String[] { trans.get("TCMotorSelPan.delayBox.None") }));
delayBox.setModel(new DefaultComboBoxModel<String>(new String[] { trans.get("TCMotorSelPan.delayBox.None") }));
delayBox.setSelectedIndex(0);
} else {
@ -567,7 +573,7 @@ public class ThrustCurveMotorSelectionPanel extends JPanel implements MotorSelec
//// None
delayStrings[i] = ThrustCurveMotor.getDelayString(delays.get(i), trans.get("TCMotorSelPan.delayBox.None"));
}
delayBox.setModel(new DefaultComboBoxModel(delayStrings));
delayBox.setModel(new DefaultComboBoxModel<String>(delayStrings));
if (reset) {
@ -601,16 +607,16 @@ public class ThrustCurveMotorSelectionPanel extends JPanel implements MotorSelec
//////////////////////
private class CurveSelectionRenderer implements ListCellRenderer {
private class CurveSelectionRenderer implements ListCellRenderer<MotorHolder> {
private final ListCellRenderer renderer;
private final ListCellRenderer<MotorHolder> renderer;
public CurveSelectionRenderer(ListCellRenderer renderer) {
public CurveSelectionRenderer(ListCellRenderer<MotorHolder> renderer) {
this.renderer = renderer;
}
@Override
public Component getListCellRendererComponent(JList list, Object value, int index,
public Component getListCellRendererComponent(JList<? extends MotorHolder> list, MotorHolder value, int index,
boolean isSelected, boolean cellHasFocus) {
Component c = renderer.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);

View File

@ -11,7 +11,6 @@ import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;
import java.text.Collator;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
@ -20,6 +19,7 @@ import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Vector;
import javax.swing.BorderFactory;
import javax.swing.DefaultComboBoxModel;
@ -88,7 +88,6 @@ import net.sf.openrocket.optimization.rocketoptimization.goals.MaximizationGoal;
import net.sf.openrocket.optimization.rocketoptimization.goals.MinimizationGoal;
import net.sf.openrocket.optimization.rocketoptimization.goals.ValueSeekGoal;
import net.sf.openrocket.optimization.services.OptimizationServiceHelper;
import net.sf.openrocket.rocketcomponent.FlightConfiguration;
import net.sf.openrocket.rocketcomponent.FlightConfigurationId;
import net.sf.openrocket.rocketcomponent.Rocket;
import net.sf.openrocket.rocketcomponent.RocketComponent;
@ -108,11 +107,10 @@ import net.sf.openrocket.util.TextUtil;
* @author Sampo Niskanen <sampo.niskanen@iki.fi>
*/
public class GeneralOptimizationDialog extends JDialog {
private static final long serialVersionUID = -355058777898063291L;
private static final Logger log = LoggerFactory.getLogger(GeneralOptimizationDialog.class);
private static final Translator trans = Application.getTranslator();
private static final Collator collator = Collator.getInstance();
private static final String GOAL_MAXIMIZE = trans.get("goal.maximize");
private static final String GOAL_MINIMIZE = trans.get("goal.minimize");
private static final String GOAL_SEEK = trans.get("goal.seek");
@ -141,7 +139,7 @@ public class GeneralOptimizationDialog extends JDialog {
private final SimulationModifierTree availableModifierTree;
private final JComboBox<String> simulationSelectionCombo;
private final JComboBox<?> optimizationParameterCombo;
private final JComboBox<Named<OptimizableParameter>> optimizationParameterCombo;
private final JComboBox<?> optimizationGoalCombo;
private final JSpinner optimizationGoalSpinner;
@ -241,6 +239,11 @@ public class GeneralOptimizationDialog extends JDialog {
selectedModifierTable.setDefaultEditor(Double.class, new DoubleCellEditor());
selectedModifierTable.setDefaultEditor(Unit.class, new UnitCellEditor() {
/**
*
*/
private static final long serialVersionUID = -2316208862654205128L;
@Override
protected UnitGroup getUnitGroup(Unit value, int row, int column) {
return selectedModifiers.get(row).getUnitGroup();
@ -389,7 +392,7 @@ public class GeneralOptimizationDialog extends JDialog {
disableComponents.add(label);
sub.add(label, "");
optimizationParameterCombo = new JComboBox<String>();
optimizationParameterCombo = new JComboBox<Named<OptimizableParameter>>();
optimizationParameterCombo.setToolTipText(tip);
populateParameters();
optimizationParameterCombo.addActionListener(clearHistoryActionListener);
@ -998,12 +1001,12 @@ public class GeneralOptimizationDialog extends JDialog {
current = trans.get("MaximumAltitudeParameter.name");
}
List<Named<OptimizableParameter>> parameters = new ArrayList<Named<OptimizableParameter>>();
Vector<Named<OptimizableParameter>> parameters = new Vector<Named<OptimizableParameter>>();
for (OptimizableParameter p : optimizationParameters) {
parameters.add(new Named<OptimizableParameter>(p, p.getName()));
}
optimizationParameterCombo.setModel(new DefaultComboBoxModel(parameters.toArray()));
optimizationParameterCombo.setModel(new DefaultComboBoxModel<Named<OptimizableParameter>>( parameters ));
for (int i = 0; i < parameters.size(); i++) {
if (parameters.get(i).toString().equals(current)) {
@ -1340,6 +1343,10 @@ public class GeneralOptimizationDialog extends JDialog {
*/
private class ParameterSelectionTableModel extends AbstractTableModel {
/**
*
*/
private static final long serialVersionUID = -8724716503904686656L;
private static final int PARAMETER = 0;
private static final int CURRENT = 1;
private static final int MIN = 2;
@ -1467,6 +1474,8 @@ public class GeneralOptimizationDialog extends JDialog {
}
private class DoubleCellRenderer extends DefaultTableCellRenderer {
private static final long serialVersionUID = 448529130732718803L;
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
boolean hasFocus, int row, int column) {
@ -1484,51 +1493,51 @@ public class GeneralOptimizationDialog extends JDialog {
}
private static class SimulationModifierComparator implements Comparator<SimulationModifier> {
@Override
public int compare(SimulationModifier mod1, SimulationModifier mod2) {
Object rel1 = mod1.getRelatedObject();
Object rel2 = mod2.getRelatedObject();
/*
* Primarily order by related object:
*
* - RocketComponents first
* - Two RocketComponents are ordered based on their position in the rocket
*/
if (!rel1.equals(rel2)) {
if (rel1 instanceof RocketComponent) {
if (rel2 instanceof RocketComponent) {
RocketComponent root = ((RocketComponent) rel1).getRoot();
for (RocketComponent c : root) {
if (c.equals(rel1)) {
return -1;
}
if (c.equals(rel2)) {
return 1;
}
}
throw new BugException("Error sorting modifiers, mod1=" + mod1 + " rel1=" + rel1 +
" mod2=" + mod2 + " rel2=" + rel2);
} else {
return -1;
}
} else {
if (rel2 instanceof RocketComponent) {
return 1;
}
}
}
// Secondarily sort by name
return collator.compare(mod1.getName(), mod2.getName());
}
}
// private static class SimulationModifierComparator implements Comparator<SimulationModifier> {
//
// @Override
// public int compare(SimulationModifier mod1, SimulationModifier mod2) {
// Object rel1 = mod1.getRelatedObject();
// Object rel2 = mod2.getRelatedObject();
//
// /*
// * Primarily order by related object:
// *
// * - RocketComponents first
// * - Two RocketComponents are ordered based on their position in the rocket
// */
// if (!rel1.equals(rel2)) {
//
// if (rel1 instanceof RocketComponent) {
// if (rel2 instanceof RocketComponent) {
//
// RocketComponent root = ((RocketComponent) rel1).getRoot();
// for (RocketComponent c : root) {
// if (c.equals(rel1)) {
// return -1;
// }
// if (c.equals(rel2)) {
// return 1;
// }
// }
//
// throw new BugException("Error sorting modifiers, mod1=" + mod1 + " rel1=" + rel1 +
// " mod2=" + mod2 + " rel2=" + rel2);
//
// } else {
// return -1;
// }
// } else {
// if (rel2 instanceof RocketComponent) {
// return 1;
// }
// }
//
// }
//
// // Secondarily sort by name
// return collator.compare(mod1.getName(), mod2.getName());
// }
// }
}

View File

@ -31,6 +31,7 @@ import net.sf.openrocket.util.TextUtil;
*
* @author Sampo Niskanen <sampo.niskanen@iki.fi>
*/
@SuppressWarnings("serial")
public class SimulationModifierTree extends BasicTree {
private final List<SimulationModifier> selectedModifiers;

View File

@ -13,6 +13,7 @@ import net.sf.openrocket.startup.Preferences;
* @author cpearls
*
*/
@SuppressWarnings("serial")
public class DisplayPreferencesPanel extends PreferencesPanel {
public DisplayPreferencesPanel() {
super(new MigLayout("fillx"));

View File

@ -40,6 +40,7 @@ import net.sf.openrocket.util.BuildProperties;
import net.sf.openrocket.util.Named;
import net.sf.openrocket.util.Utils;
@SuppressWarnings("serial")
public class GeneralPreferencesPanel extends PreferencesPanel {
public GeneralPreferencesPanel(JDialog parent) {

View File

@ -31,6 +31,7 @@ import net.sf.openrocket.startup.Preferences;
import com.itextpdf.text.Font;
@SuppressWarnings("serial")
public class GraphicsPreferencesPanel extends PreferencesPanel {
public GraphicsPreferencesPanel(JDialog parent) {

View File

@ -34,6 +34,7 @@ import net.sf.openrocket.startup.Application;
import net.sf.openrocket.unit.UnitGroup;
import net.sf.openrocket.unit.Value;
@SuppressWarnings("serial")
public class MaterialEditPanel extends JPanel {
private final JTable table;

View File

@ -19,6 +19,7 @@ import net.sf.openrocket.startup.Application;
import net.sf.openrocket.unit.Unit;
import net.sf.openrocket.unit.UnitGroup;
@SuppressWarnings("serial")
public abstract class PreferencesPanel extends JPanel {
protected static final Logger log = LoggerFactory.getLogger(PreferencesDialog.class);

View File

@ -1,6 +1,5 @@
package net.sf.openrocket.gui.dialogs.preferences;
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@ -9,30 +8,27 @@ import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JSpinner;
import javax.swing.ListCellRenderer;
import net.miginfocom.swing.MigLayout;
import net.sf.openrocket.gui.SpinnerEditor;
import net.sf.openrocket.gui.adaptors.DoubleModel;
import net.sf.openrocket.gui.adaptors.EnumModel;
import net.sf.openrocket.gui.components.BasicSlider;
import net.sf.openrocket.gui.components.UnitSelector;
import net.sf.openrocket.gui.util.Icons;
import net.sf.openrocket.simulation.RK4SimulationStepper;
import net.sf.openrocket.simulation.listeners.SimulationListener;
import net.sf.openrocket.unit.UnitGroup;
import net.sf.openrocket.util.GeodeticComputationStrategy;
public class SimulationPreferencesPanel extends PreferencesPanel {
private static final long serialVersionUID = 7983195730016979888L;
/*
* private GeodeticComputationStrategy geodeticComputation =
* GeodeticComputationStrategy.SPHERICAL;
*/
public SimulationPreferencesPanel() {
super(new MigLayout("fill"));
@ -62,7 +58,7 @@ public class SimulationPreferencesPanel extends PreferencesPanel {
});
this.add(automaticallyRunSimsBox, "wrap, growx, sg combos ");
GeodeticComputationStrategy geodeticComputation = GeodeticComputationStrategy.SPHERICAL;
//GeodeticComputationStrategy geodeticComputation = GeodeticComputationStrategy.SPHERICAL;
JPanel sub, subsub;
String tip;
@ -112,7 +108,7 @@ public class SimulationPreferencesPanel extends PreferencesPanel {
EnumModel<GeodeticComputationStrategy> gcsModel = new EnumModel<GeodeticComputationStrategy>(
preferences, "GeodeticComputation");
final JComboBox gcsCombo = new JComboBox(gcsModel);
final JComboBox<GeodeticComputationStrategy> gcsCombo = new JComboBox<GeodeticComputationStrategy>(gcsModel);
ActionListener gcsTTipListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
@ -233,47 +229,47 @@ public class SimulationPreferencesPanel extends PreferencesPanel {
*/
}
private class ListenerCellRenderer extends JLabel implements
ListCellRenderer {
@Override
public Component getListCellRendererComponent(JList list, Object value,
int index, boolean isSelected, boolean cellHasFocus) {
String s = value.toString();
setText(s);
// Attempt instantiating, catch any exceptions
Exception ex = null;
try {
Class<?> c = Class.forName(s);
@SuppressWarnings("unused")
SimulationListener l = (SimulationListener) c.newInstance();
} catch (Exception e) {
ex = e;
}
if (ex == null) {
setIcon(Icons.SIMULATION_LISTENER_OK);
// // Listener instantiated successfully.
setToolTipText("Listener instantiated successfully.");
} else {
setIcon(Icons.SIMULATION_LISTENER_ERROR);
// // <html>Unable to instantiate listener due to exception:<br>
setToolTipText("<html>Unable to instantiate listener due to exception:<br>"
+ ex.toString());
}
if (isSelected) {
setBackground(list.getSelectionBackground());
setForeground(list.getSelectionForeground());
} else {
setBackground(list.getBackground());
setForeground(list.getForeground());
}
setOpaque(true);
return this;
}
}
// private class ListenerCellRenderer extends JLabel implements
// ListCellRenderer {
//
// @Override
// public Component getListCellRendererComponent(JList list, Object value,
// int index, boolean isSelected, boolean cellHasFocus) {
// String s = value.toString();
// setText(s);
//
// // Attempt instantiating, catch any exceptions
// Exception ex = null;
// try {
// Class<?> c = Class.forName(s);
// @SuppressWarnings("unused")
// SimulationListener l = (SimulationListener) c.newInstance();
// } catch (Exception e) {
// ex = e;
// }
//
// if (ex == null) {
// setIcon(Icons.SIMULATION_LISTENER_OK);
// // // Listener instantiated successfully.
// setToolTipText("Listener instantiated successfully.");
// } else {
// setIcon(Icons.SIMULATION_LISTENER_ERROR);
// // // <html>Unable to instantiate listener due to exception:<br>
// setToolTipText("<html>Unable to instantiate listener due to exception:<br>"
// + ex.toString());
// }
//
// if (isSelected) {
// setBackground(list.getSelectionBackground());
// setForeground(list.getSelectionForeground());
// } else {
// setBackground(list.getBackground());
// setForeground(list.getForeground());
// }
// setOpaque(true);
// return this;
// }
// }
/*
* private class ListenerListModel extends AbstractListModel {

View File

@ -37,6 +37,7 @@ import net.sf.openrocket.util.Chars;
/**
* Dialog shown for selecting a preset component.
*/
@SuppressWarnings("serial")
public class ComponentPresetChooserDialog extends JDialog {
private static final Translator trans = Application.getTranslator();

View File

@ -33,6 +33,7 @@ import net.sf.openrocket.unit.UnitGroup;
import net.sf.openrocket.unit.Value;
import net.sf.openrocket.util.AlphanumComparator;
@SuppressWarnings("serial")
public class ComponentPresetTable extends JTable {
private static final Translator trans = Application.getTranslator();

View File

@ -12,6 +12,7 @@ import net.sf.openrocket.unit.Unit;
import net.sf.openrocket.unit.UnitGroup;
import net.sf.openrocket.unit.Value;
@SuppressWarnings("serial")
public abstract class ComponentPresetTableColumn extends TableColumn {
private static final Translator trans = Application.getTranslator();

View File

@ -200,14 +200,15 @@ public class PhotoSettingsConfig extends JTabbedPane {
add(new JLabel(trans.get("PhotoSettingsConfig.lbl.skyImage")));
add(new JComboBox(new DefaultComboBoxModel(new Object[] { null, Mountains.instance, Meadow.instance,
add(new JComboBox<Sky>(new DefaultComboBoxModel<Sky>(new Sky[] { null, Mountains.instance, Meadow.instance,
Storm.instance, Lake.instance, Orbit.instance, Miramar.instance }) {
}) {
{
addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
Object s = ((JComboBox) e.getSource()).getSelectedItem();
@SuppressWarnings("unchecked")
Object s = ((JComboBox<Sky>) e.getSource()).getSelectedItem();
if (s instanceof Sky) {
p.setSky((Sky) s);
skyColorButton.setEnabled(false);

View File

@ -30,7 +30,8 @@ import net.sf.openrocket.startup.Application;
import net.sf.openrocket.util.Named;
public class GuidedTourSelectionDialog extends JDialog {
private static final long serialVersionUID = -3643116444821710259L;
private static final Translator trans = Application.getTranslator();
private static GuidedTourSelectionDialog instance = null;
@ -41,7 +42,7 @@ public class GuidedTourSelectionDialog extends JDialog {
private SlideShowDialog slideShowDialog;
private JList tourList;
private JList<Named<SlideSet>> tourList;
private JEditorPane tourDescription;
private JLabel tourLength;
@ -56,7 +57,7 @@ public class GuidedTourSelectionDialog extends JDialog {
panel.add(new StyledLabel(trans.get("lbl.selectTour"), Style.BOLD), "spanx, wrap rel");
tourList = new JList(new TourListModel());
tourList = new JList<Named<SlideSet>>(new TourListModel());
tourList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
tourList.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
@Override
@ -157,15 +158,15 @@ public class GuidedTourSelectionDialog extends JDialog {
}
@SuppressWarnings("unchecked")
private SlideSet getSelectedSlideSet() {
return ((Named<SlideSet>) tourList.getSelectedValue()).get();
return tourList.getSelectedValue().get();
}
private class TourListModel extends AbstractListModel {
private class TourListModel extends AbstractListModel<Named<SlideSet>> {
private static final long serialVersionUID = -4031709944507449410L;
@Override
public Object getElementAt(int index) {
public Named<SlideSet> getElementAt(int index) {
String name = tourNames.get(index);
SlideSet set = slideSetManager.getSlideSet(name);
return new Named<SlideSet>(set, set.getTitle());

View File

@ -25,6 +25,7 @@ import net.sf.openrocket.startup.Application;
import net.sf.openrocket.util.BugException;
import net.sf.openrocket.util.Chars;
@SuppressWarnings("serial")
public class SlideShowDialog extends JDialog {
private static final Logger log = LoggerFactory.getLogger(SlideShowDialog.class);

View File

@ -12,7 +12,6 @@ import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.beans.PropertyChangeListener;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;

View File

@ -10,6 +10,7 @@ import javax.swing.JMenuItem;
/**
* Implements a menu for the example Open Rocket design files.
*/
@SuppressWarnings("serial")
public final class ExampleDesignFileAction extends JMenu {
/**

View File

@ -25,13 +25,14 @@ import net.sf.openrocket.gui.util.SwingPreferences;
import net.sf.openrocket.l10n.Translator;
import net.sf.openrocket.startup.Application;
@SuppressWarnings("serial")
public class ExportDecalDialog extends JDialog {
private final static Translator trans = Application.getTranslator();
private final OpenRocketDocument document;
private final JComboBox decalComboBox;
private final JComboBox<DecalImage> decalComboBox;
private final JFileChooser chooser;
public ExportDecalDialog(Window parent, OpenRocketDocument doc) {
@ -47,7 +48,7 @@ public class ExportDecalDialog extends JDialog {
Collection<DecalImage> exportableDecals = document.getDecalList();
decalComboBox = new JComboBox(exportableDecals.toArray(new DecalImage[0]));
decalComboBox = new JComboBox<DecalImage>(exportableDecals.toArray(new DecalImage[0]));
decalComboBox.setEditable(false);
panel.add(decalComboBox, "growx, wrap");

View File

@ -14,6 +14,7 @@ import java.util.List;
/**
* Implements a menu for the Most-Recently-Used Open Rocket design files.
*/
@SuppressWarnings("serial")
public final class MRUDesignFileAction extends JMenu {
/**

View File

@ -52,15 +52,15 @@ import net.sf.openrocket.rocketcomponent.Rocket;
import net.sf.openrocket.rocketcomponent.FlightConfigurationId;
import net.sf.openrocket.rocketcomponent.ComponentChangeEvent;
import net.sf.openrocket.rocketcomponent.ComponentChangeListener;
import net.sf.openrocket.rocketcomponent.FlightConfiguration;
import net.sf.openrocket.simulation.FlightData;
import net.sf.openrocket.startup.Application;
import net.sf.openrocket.startup.Preferences;
import net.sf.openrocket.unit.UnitGroup;
import net.sf.openrocket.util.AlphanumComparator;
@SuppressWarnings("serial")
public class SimulationPanel extends JPanel {
private static final long serialVersionUID = 1390060162192576924L;
private static final Logger log = LoggerFactory.getLogger(SimulationPanel.class);
private static final Translator trans = Application.getTranslator();

View File

@ -5,7 +5,6 @@ import java.awt.event.ActionListener;
import javax.swing.BorderFactory;
import javax.swing.ButtonGroup;
import javax.swing.JCheckBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
@ -27,6 +26,7 @@ import net.sf.openrocket.simulation.FlightData;
import net.sf.openrocket.simulation.FlightDataBranch;
import net.sf.openrocket.startup.Application;
@SuppressWarnings("serial")
public class StorageOptionChooser extends JPanel {
public static final double DEFAULT_SAVE_TIME_SKIP = 0.20;

View File

@ -7,6 +7,7 @@ import net.sf.openrocket.document.OpenRocketDocument;
import net.sf.openrocket.gui.components.BasicTree;
@SuppressWarnings("serial")
public class ComponentTree extends BasicTree {
public ComponentTree(OpenRocketDocument document) {

View File

@ -19,6 +19,7 @@ import net.sf.openrocket.startup.Application;
import net.sf.openrocket.unit.UnitGroup;
import net.sf.openrocket.util.TextUtil;
@SuppressWarnings("serial")
public class ComponentTreeRenderer extends DefaultTreeCellRenderer {
private static final Translator trans = Application.getTranslator();

View File

@ -29,6 +29,7 @@ import net.sf.openrocket.util.BugException;
*
* @author Sampo Niskanen <sampo.niskanen@iki.fi>
*/
@SuppressWarnings("serial")
public class ComponentTreeTransferHandler extends TransferHandler {
private static final Logger log = LoggerFactory.getLogger(ComponentTreeTransferHandler.class);

View File

@ -61,6 +61,7 @@ import org.jfree.ui.TextAnchor;
* both datasets and the legend. But for now, the renderers are queried for the line color information
* and this is held in the Legend.
*/
@SuppressWarnings("serial")
public class SimulationPlot {
private static final float PLOT_STROKE_WIDTH = 1.5f;

View File

@ -32,6 +32,7 @@ import java.awt.event.MouseListener;
*
* Credits: A post by Rob Camick http://tips4java.wordpress.com/2009/07/12/table-button-column/
*/
@SuppressWarnings("serial")
public class ButtonColumn extends AbstractCellEditor
implements TableCellRenderer, TableCellEditor, ActionListener, MouseListener
{

View File

@ -9,16 +9,18 @@ import java.util.Set;
/**
* A combo box that allows for items to be deselected.
*/
public class DeselectableComboBox extends JComboBox {
public class DeselectableComboBox<T> extends JComboBox<T> {
private static final long serialVersionUID = 1803702330221425938L;
public DeselectableComboBox() {
@SuppressWarnings("unchecked")
public DeselectableComboBox() {
super();
super.setRenderer(new DeselectedtemsRenderer());
super.setRenderer(new DeselectedItemsRenderer());
}
private Set<Integer> disabled_items = new HashSet<Integer>();
public void addItem(Object anObject, boolean disabled) {
public void addItem(T anObject, boolean disabled) {
super.addItem(anObject);
if (disabled) {
disabled_items.add(getItemCount() - 1);
@ -54,9 +56,12 @@ public class DeselectableComboBox extends JComboBox {
}
}
private class DeselectedtemsRenderer extends BasicComboBoxRenderer {
private class DeselectedItemsRenderer extends BasicComboBoxRenderer {
private static final long serialVersionUID = 6149806777306976399L;
@Override
// is raw because its super-method-signature is also a raw generic
@SuppressWarnings("rawtypes")
@Override
public Component getListCellRendererComponent(JList list,
Object value,
int index,

Some files were not shown because too many files have changed in this diff Show More