Merge pull request #290 from teyrana/warning-cleanup

Warning cleanup ( reduced from 219 to 185 )
This commit is contained in:
kruland2607 2016-11-19 08:31:11 -06:00 committed by GitHub
commit 597d6c8391
9 changed files with 30 additions and 31 deletions

View File

@ -17,6 +17,7 @@ import net.sf.openrocket.rocketcomponent.AxialStage;
import net.sf.openrocket.rocketcomponent.FlightConfiguration;
import net.sf.openrocket.rocketcomponent.RocketComponent;
import net.sf.openrocket.rocketcomponent.StageSeparationConfiguration;
import net.sf.openrocket.rocketcomponent.StageSeparationConfiguration.SeparationEvent;
import net.sf.openrocket.startup.Application;
public class AxialStageConfig extends ComponentAssemblyConfig {
@ -48,16 +49,10 @@ public class AxialStageConfig extends ComponentAssemblyConfig {
sepConfig = new StageSeparationConfiguration();
stage.getSeparationConfigurations().set( flConfig.getId(), sepConfig );
}
@SuppressWarnings("unchecked")
JComboBox<?> combo = new JComboBox<StageSeparationConfiguration.SeparationEvent>(
new EnumModel<StageSeparationConfiguration.SeparationEvent>( sepConfig, "SeparationEvent",
new StageSeparationConfiguration.SeparationEvent[] {
StageSeparationConfiguration.SeparationEvent.UPPER_IGNITION,
StageSeparationConfiguration.SeparationEvent.IGNITION,
StageSeparationConfiguration.SeparationEvent.BURNOUT,
StageSeparationConfiguration.SeparationEvent.EJECTION,
StageSeparationConfiguration.SeparationEvent.LAUNCH,
StageSeparationConfiguration.SeparationEvent.NEVER }));
new EnumModel<StageSeparationConfiguration.SeparationEvent>( sepConfig, "SeparationEvent", SeparationEvent.values()));
//combo.setSelectedItem(sepConfig);
panel.add(combo, "");

View File

@ -23,6 +23,7 @@ import net.sf.openrocket.startup.Application;
import net.sf.openrocket.unit.UnitGroup;
@SuppressWarnings("serial")
public class MassComponentConfig extends RocketComponentConfig {
private static final Translator trans = Application.getTranslator();
@ -34,8 +35,8 @@ public class MassComponentConfig extends RocketComponentConfig {
//// Mass component type
panel.add(new JLabel(trans.get("MassComponentCfg.lbl.type")));
@SuppressWarnings("unchecked")
JComboBox typecombo = new JComboBox(
final JComboBox<?> typecombo = new JComboBox<MassComponent.MassComponentType>(
new EnumModel<MassComponent.MassComponentType>(component, "MassComponentType",
new MassComponent.MassComponentType[] {
MassComponent.MassComponentType.MASSCOMPONENT,
@ -108,7 +109,7 @@ public class MassComponentConfig extends RocketComponentConfig {
//// Position relative to:
panel.add(new JLabel(trans.get("MassComponentCfg.lbl.PosRelativeto")));
JComboBox combo = new JComboBox(
final JComboBox<RocketComponent.Position> combo = new JComboBox<RocketComponent.Position>(
new EnumModel<RocketComponent.Position>(component, "RelativePosition",
new RocketComponent.Position[] {
RocketComponent.Position.TOP,

View File

@ -27,9 +27,9 @@ import net.sf.openrocket.rocketcomponent.Transition;
import net.sf.openrocket.startup.Application;
import net.sf.openrocket.unit.UnitGroup;
@SuppressWarnings("serial")
public class NoseConeConfig extends RocketComponentConfig {
private JComboBox typeBox;
private DescriptionArea description;
@ -54,7 +54,7 @@ public class NoseConeConfig extends RocketComponentConfig {
Transition.Shape selected = ((NoseCone) component).getType();
Transition.Shape[] typeList = Transition.Shape.values();
typeBox = new JComboBox(typeList);
final JComboBox<Transition.Shape> typeBox = new JComboBox<Transition.Shape>(typeList);
typeBox.setEditable(false);
typeBox.setSelectedItem(selected);
typeBox.addActionListener(new ActionListener() {

View File

@ -22,9 +22,9 @@ import net.sf.openrocket.rocketcomponent.RocketComponent;
import net.sf.openrocket.startup.Application;
import net.sf.openrocket.unit.UnitGroup;
@SuppressWarnings("serial")
public class RailButtonConfig extends RocketComponentConfig {
private MotorConfig motorConfigPane = null;
private static final Translator trans = Application.getTranslator();
public RailButtonConfig( OpenRocketDocument document, RocketComponent component) {
@ -78,7 +78,7 @@ public class RailButtonConfig extends RocketComponentConfig {
{ //// Position relative to:
panel.add(new JLabel(trans.get("RailBtnCfg.lbl.PosRelativeTo")));
@SuppressWarnings("unchecked")
JComboBox<RocketComponent.Position> relToCombo = new JComboBox<RocketComponent.Position>(
(ComboBoxModel<RocketComponent.Position>) new EnumModel<RocketComponent.Position>(component, "RelativePosition",
new RocketComponent.Position[] {

View File

@ -22,6 +22,7 @@ import net.sf.openrocket.rocketcomponent.RocketComponent;
import net.sf.openrocket.startup.Application;
import net.sf.openrocket.unit.UnitGroup;
@SuppressWarnings("serial")
public class RingComponentConfig extends RocketComponentConfig {
private static final Translator trans = Application.getTranslator();
@ -125,7 +126,7 @@ public class RingComponentConfig extends RocketComponentConfig {
//// Position relative to:
panel.add(new JLabel(trans.get("ringcompcfg.Positionrelativeto")));
JComboBox combo = new JComboBox(
final JComboBox<RocketComponent.Position> positionCombo = new JComboBox<RocketComponent.Position>(
new EnumModel<RocketComponent.Position>(component, "RelativePosition",
new RocketComponent.Position[] {
RocketComponent.Position.TOP,
@ -133,7 +134,7 @@ public class RingComponentConfig extends RocketComponentConfig {
RocketComponent.Position.BOTTOM,
RocketComponent.Position.ABSOLUTE
}));
panel.add(combo, "spanx 3, growx, wrap");
panel.add( positionCombo, "spanx 3, growx, wrap");
//// plus
panel.add(new JLabel(trans.get("ringcompcfg.plus")), "right");

View File

@ -25,13 +25,14 @@ import net.sf.openrocket.l10n.Translator;
import net.sf.openrocket.material.Material;
import net.sf.openrocket.startup.Application;
@SuppressWarnings("serial")
public class CustomMaterialDialog extends JDialog {
private static final Translator trans = Application.getTranslator();
private final Material originalMaterial;
private boolean okClicked = false;
private JComboBox typeBox;
private JComboBox<Material.Type> typeBox;
private JTextField nameField;
private DoubleModel density;
private JSpinner densitySpinner;
@ -76,7 +77,7 @@ public class CustomMaterialDialog extends JDialog {
// Material type (if not known)
panel.add(new JLabel(trans.get("custmatdlg.lbl.Materialtype")));
if (material == null) {
typeBox = new JComboBox(Material.Type.values());
typeBox = new JComboBox<Material.Type>(Material.Type.values());
typeBox.setSelectedItem(Material.Type.BULK);
typeBox.setEditable(false);
typeBox.addActionListener(new ActionListener() {

View File

@ -30,6 +30,7 @@ import net.sf.openrocket.startup.Application;
/**
* This class is a dialog for displaying advanced settings for printing rocket related info.
*/
@SuppressWarnings("serial")
public class PrintSettingsDialog extends JDialog {
private static final Logger log = LoggerFactory.getLogger(PrintSettingsDialog.class);
private static final Translator trans = Application.getTranslator();
@ -75,16 +76,16 @@ public class PrintSettingsDialog extends JDialog {
JComboBox combo = new JComboBox(new EnumModel<PaperSize>(settings, "PaperSize"));
final JComboBox<PaperSize> sizeCombo = new JComboBox<PaperSize>(new EnumModel<PaperSize>(settings, "PaperSize"));
////Paper size:
panel.add(new JLabel(trans.get("lbl.Papersize")));
panel.add(combo, "growx, wrap para");
panel.add( sizeCombo, "growx, wrap para");
combo = new JComboBox(new EnumModel<PaperOrientation>(settings, "PaperOrientation"));
final JComboBox<PaperOrientation> orientCombo = new JComboBox<PaperOrientation>(new EnumModel<PaperOrientation>(settings, "PaperOrientation"));
//// Paper orientation:
panel.add(new JLabel(trans.get("lbl.Paperorientation")));
panel.add(combo, "growx, wrap para*2");
panel.add( orientCombo, "growx, wrap para*2");

View File

@ -10,13 +10,13 @@ import javax.swing.JScrollPane;
import net.sf.openrocket.aerodynamics.Warning;
import net.sf.openrocket.aerodynamics.WarningSet;
@SuppressWarnings("serial")
public class WarningDialog extends JDialog {
public static void showWarnings(Component parent, Object message, String title,
WarningSet warnings) {
public static void showWarnings(Component parent, Object message, String title, WarningSet warnings) {
Warning[] w = warnings.toArray(new Warning[0]);
JList list = new JList(w);
final JList<Warning> list = new JList<Warning>(w);
JScrollPane pane = new JScrollPane(list);
JOptionPane.showMessageDialog(parent, new Object[] { message, pane },

View File

@ -78,12 +78,12 @@ public class DeploymentSelectionDialog extends JDialog {
//// Deploys at:
panel.add(new JLabel(trans.get("ParachuteCfg.lbl.Deploysat")), "");
final JComboBox<?> event = new JComboBox(new EnumModel<DeployEvent>(newConfiguration, "DeployEvent"));
final JComboBox<DeployEvent> deployEvent = new JComboBox<DeployEvent>(new EnumModel<DeployEvent>(newConfiguration, "DeployEvent"));
if( (component.getStageNumber() + 1 ) == rocket.getStageCount() ){
// This is the bottom stage: Restrict deployment options.
event.removeItem( DeployEvent.LOWER_STAGE_SEPARATION );
deployEvent.removeItem( DeployEvent.LOWER_STAGE_SEPARATION );
}
panel.add(event, "spanx 3, growx, wrap");
panel.add( deployEvent, "spanx 3, growx, wrap");
// ... and delay
//// plus
@ -111,7 +111,7 @@ public class DeploymentSelectionDialog extends JDialog {
altSlider = new BasicSlider(alt.getSliderModel(100, 1000));
panel.add(altSlider, "w 100lp, wrap");
event.addActionListener(new ActionListener() {
deployEvent.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
updateState();