Clean up structure a bit
(I'm doing this for a later commit I will push in this PR)
This commit is contained in:
parent
96f3e671b0
commit
8051e5c9c1
@ -60,7 +60,6 @@ import net.sf.openrocket.gui.dialogs.preferences.PreferencesDialog;
|
|||||||
import net.sf.openrocket.gui.figure3d.photo.PhotoFrame;
|
import net.sf.openrocket.gui.figure3d.photo.PhotoFrame;
|
||||||
import net.sf.openrocket.gui.help.tours.GuidedTourSelectionDialog;
|
import net.sf.openrocket.gui.help.tours.GuidedTourSelectionDialog;
|
||||||
import net.sf.openrocket.gui.main.componenttree.ComponentTree;
|
import net.sf.openrocket.gui.main.componenttree.ComponentTree;
|
||||||
import net.sf.openrocket.gui.main.flightconfigpanel.FlightConfigurationPanel;
|
|
||||||
import net.sf.openrocket.gui.scalefigure.RocketPanel;
|
import net.sf.openrocket.gui.scalefigure.RocketPanel;
|
||||||
import net.sf.openrocket.gui.util.DummyFrameMenuOSX;
|
import net.sf.openrocket.gui.util.DummyFrameMenuOSX;
|
||||||
import net.sf.openrocket.gui.util.FileHelper;
|
import net.sf.openrocket.gui.util.FileHelper;
|
||||||
@ -276,6 +275,7 @@ public class BasicFrame extends JFrame {
|
|||||||
* with the left component the design tree and the right component buttons
|
* with the left component the design tree and the right component buttons
|
||||||
* for adding components.
|
* for adding components.
|
||||||
*/
|
*/
|
||||||
|
// TODO LOW: Put this in a separate file...
|
||||||
private JComponent designTab() {
|
private JComponent designTab() {
|
||||||
JSplitPane horizontal = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true);
|
JSplitPane horizontal = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true);
|
||||||
horizontal.setResizeWeight(0.5);
|
horizontal.setResizeWeight(0.5);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package net.sf.openrocket.gui.main.flightconfigpanel;
|
package net.sf.openrocket.gui.main;
|
||||||
|
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
import java.awt.event.MouseEvent;
|
import java.awt.event.MouseEvent;
|
||||||
@ -20,7 +20,9 @@ import net.miginfocom.swing.MigLayout;
|
|||||||
import net.sf.openrocket.document.OpenRocketDocument;
|
import net.sf.openrocket.document.OpenRocketDocument;
|
||||||
import net.sf.openrocket.document.Simulation;
|
import net.sf.openrocket.document.Simulation;
|
||||||
import net.sf.openrocket.gui.dialogs.flightconfiguration.RenameConfigDialog;
|
import net.sf.openrocket.gui.dialogs.flightconfiguration.RenameConfigDialog;
|
||||||
import net.sf.openrocket.gui.main.BasicFrame;
|
import net.sf.openrocket.gui.main.flightconfigpanel.MotorConfigurationPanel;
|
||||||
|
import net.sf.openrocket.gui.main.flightconfigpanel.RecoveryConfigurationPanel;
|
||||||
|
import net.sf.openrocket.gui.main.flightconfigpanel.SeparationConfigurationPanel;
|
||||||
import net.sf.openrocket.l10n.Translator;
|
import net.sf.openrocket.l10n.Translator;
|
||||||
import net.sf.openrocket.rocketcomponent.ComponentChangeEvent;
|
import net.sf.openrocket.rocketcomponent.ComponentChangeEvent;
|
||||||
import net.sf.openrocket.rocketcomponent.FlightConfigurableComponent;
|
import net.sf.openrocket.rocketcomponent.FlightConfigurableComponent;
|
@ -4,7 +4,6 @@ import java.awt.Color;
|
|||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
import java.awt.Font;
|
import java.awt.Font;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.swing.JComponent;
|
import javax.swing.JComponent;
|
||||||
@ -20,6 +19,7 @@ import javax.swing.event.ListSelectionListener;
|
|||||||
import javax.swing.table.AbstractTableModel;
|
import javax.swing.table.AbstractTableModel;
|
||||||
import javax.swing.table.DefaultTableCellRenderer;
|
import javax.swing.table.DefaultTableCellRenderer;
|
||||||
|
|
||||||
|
import net.sf.openrocket.gui.main.FlightConfigurationPanel;
|
||||||
import net.sf.openrocket.util.ArrayList;
|
import net.sf.openrocket.util.ArrayList;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@ -71,7 +71,7 @@ public abstract class FlightConfigurablePanel<T extends FlightConfigurableCompon
|
|||||||
updateButtonState();
|
updateButtonState();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract void updateButtonState();
|
public abstract void updateButtonState();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void componentChanged(ComponentChangeEvent e) {
|
public void componentChanged(ComponentChangeEvent e) {
|
||||||
@ -99,7 +99,7 @@ public abstract class FlightConfigurablePanel<T extends FlightConfigurableCompon
|
|||||||
return table;
|
return table;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final void synchronizeConfigurationSelection() {
|
public final void synchronizeConfigurationSelection() {
|
||||||
FlightConfigurationId currentRocketFCID = rocket.getSelectedConfiguration().getFlightConfigurationID();
|
FlightConfigurationId currentRocketFCID = rocket.getSelectedConfiguration().getFlightConfigurationID();
|
||||||
FlightConfigurationId selectedFCID = getSelectedConfigurationId();
|
FlightConfigurationId selectedFCID = getSelectedConfigurationId();
|
||||||
|
|
||||||
@ -227,7 +227,7 @@ public abstract class FlightConfigurablePanel<T extends FlightConfigurableCompon
|
|||||||
return FlightConfigurationId.ERROR_FCID;
|
return FlightConfigurationId.ERROR_FCID;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected List<FlightConfigurationId> getSelectedConfigurationIds() {
|
public List<FlightConfigurationId> getSelectedConfigurationIds() {
|
||||||
int col = table.convertColumnIndexToModel(table.getSelectedColumn());
|
int col = table.convertColumnIndexToModel(table.getSelectedColumn());
|
||||||
int[] rows = Arrays.stream(table.getSelectedRows()).map(table::convertRowIndexToModel).toArray();
|
int[] rows = Arrays.stream(table.getSelectedRows()).map(table::convertRowIndexToModel).toArray();
|
||||||
if (Arrays.stream(rows).min().isEmpty() || Arrays.stream(rows).min().getAsInt() < 0 || col < 0 ||
|
if (Arrays.stream(rows).min().isEmpty() || Arrays.stream(rows).min().getAsInt() < 0 || col < 0 ||
|
||||||
|
@ -33,6 +33,7 @@ import net.miginfocom.swing.MigLayout;
|
|||||||
import net.sf.openrocket.gui.dialogs.flightconfiguration.IgnitionSelectionDialog;
|
import net.sf.openrocket.gui.dialogs.flightconfiguration.IgnitionSelectionDialog;
|
||||||
import net.sf.openrocket.gui.dialogs.flightconfiguration.MotorMountConfigurationPanel;
|
import net.sf.openrocket.gui.dialogs.flightconfiguration.MotorMountConfigurationPanel;
|
||||||
import net.sf.openrocket.gui.dialogs.motor.MotorChooserDialog;
|
import net.sf.openrocket.gui.dialogs.motor.MotorChooserDialog;
|
||||||
|
import net.sf.openrocket.gui.main.FlightConfigurationPanel;
|
||||||
import net.sf.openrocket.gui.widgets.SelectColorButton;
|
import net.sf.openrocket.gui.widgets.SelectColorButton;
|
||||||
import net.sf.openrocket.motor.IgnitionEvent;
|
import net.sf.openrocket.motor.IgnitionEvent;
|
||||||
import net.sf.openrocket.motor.Motor;
|
import net.sf.openrocket.motor.Motor;
|
||||||
@ -65,7 +66,7 @@ public class MotorConfigurationPanel extends FlightConfigurablePanel<MotorMount>
|
|||||||
private final JPopupMenu popupMenuFull; // popup menu containing all the options
|
private final JPopupMenu popupMenuFull; // popup menu containing all the options
|
||||||
|
|
||||||
|
|
||||||
MotorConfigurationPanel(final FlightConfigurationPanel flightConfigurationPanel, Rocket rocket) {
|
public MotorConfigurationPanel(final FlightConfigurationPanel flightConfigurationPanel, Rocket rocket) {
|
||||||
super(flightConfigurationPanel, rocket);
|
super(flightConfigurationPanel, rocket);
|
||||||
|
|
||||||
motorChooserDialog = new MotorChooserDialog(SwingUtilities.getWindowAncestor(flightConfigurationPanel));
|
motorChooserDialog = new MotorChooserDialog(SwingUtilities.getWindowAncestor(flightConfigurationPanel));
|
||||||
@ -294,7 +295,7 @@ public class MotorConfigurationPanel extends FlightConfigurablePanel<MotorMount>
|
|||||||
flightConfigurationPanel.setSelectedComponents(components);
|
flightConfigurationPanel.setSelectedComponents(components);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void updateButtonState() {
|
public void updateButtonState() {
|
||||||
if( configurationTableModel.getColumnCount() > 1 ) {
|
if( configurationTableModel.getColumnCount() > 1 ) {
|
||||||
showContent();
|
showContent();
|
||||||
|
|
||||||
|
@ -25,6 +25,7 @@ import javax.swing.event.ListSelectionListener;
|
|||||||
|
|
||||||
import net.sf.openrocket.formatting.RocketDescriptor;
|
import net.sf.openrocket.formatting.RocketDescriptor;
|
||||||
import net.sf.openrocket.gui.dialogs.flightconfiguration.DeploymentSelectionDialog;
|
import net.sf.openrocket.gui.dialogs.flightconfiguration.DeploymentSelectionDialog;
|
||||||
|
import net.sf.openrocket.gui.main.FlightConfigurationPanel;
|
||||||
import net.sf.openrocket.l10n.Translator;
|
import net.sf.openrocket.l10n.Translator;
|
||||||
import net.sf.openrocket.rocketcomponent.*;
|
import net.sf.openrocket.rocketcomponent.*;
|
||||||
import net.sf.openrocket.rocketcomponent.DeploymentConfiguration.DeployEvent;
|
import net.sf.openrocket.rocketcomponent.DeploymentConfiguration.DeployEvent;
|
||||||
@ -43,7 +44,7 @@ public class RecoveryConfigurationPanel extends FlightConfigurablePanel<Recovery
|
|||||||
private final JPopupMenu popupMenuFull; // popup menu containing all the options
|
private final JPopupMenu popupMenuFull; // popup menu containing all the options
|
||||||
|
|
||||||
|
|
||||||
RecoveryConfigurationPanel(FlightConfigurationPanel flightConfigurationPanel, Rocket rocket) {
|
public RecoveryConfigurationPanel(FlightConfigurationPanel flightConfigurationPanel, Rocket rocket) {
|
||||||
super(flightConfigurationPanel,rocket);
|
super(flightConfigurationPanel,rocket);
|
||||||
|
|
||||||
JScrollPane scroll = new JScrollPane(table);
|
JScrollPane scroll = new JScrollPane(table);
|
||||||
|
@ -25,6 +25,7 @@ import javax.swing.event.ListSelectionListener;
|
|||||||
|
|
||||||
import net.sf.openrocket.formatting.RocketDescriptor;
|
import net.sf.openrocket.formatting.RocketDescriptor;
|
||||||
import net.sf.openrocket.gui.dialogs.flightconfiguration.SeparationSelectionDialog;
|
import net.sf.openrocket.gui.dialogs.flightconfiguration.SeparationSelectionDialog;
|
||||||
|
import net.sf.openrocket.gui.main.FlightConfigurationPanel;
|
||||||
import net.sf.openrocket.l10n.Translator;
|
import net.sf.openrocket.l10n.Translator;
|
||||||
import net.sf.openrocket.rocketcomponent.AxialStage;
|
import net.sf.openrocket.rocketcomponent.AxialStage;
|
||||||
import net.sf.openrocket.rocketcomponent.ComponentChangeEvent;
|
import net.sf.openrocket.rocketcomponent.ComponentChangeEvent;
|
||||||
@ -48,7 +49,7 @@ public class SeparationConfigurationPanel extends FlightConfigurablePanel<AxialS
|
|||||||
private final JPopupMenu popupMenuFull; // popup menu containing all the options
|
private final JPopupMenu popupMenuFull; // popup menu containing all the options
|
||||||
|
|
||||||
|
|
||||||
SeparationConfigurationPanel(FlightConfigurationPanel flightConfigurationPanel, Rocket rocket) {
|
public SeparationConfigurationPanel(FlightConfigurationPanel flightConfigurationPanel, Rocket rocket) {
|
||||||
super(flightConfigurationPanel,rocket);
|
super(flightConfigurationPanel,rocket);
|
||||||
|
|
||||||
JScrollPane scroll = new JScrollPane(table);
|
JScrollPane scroll = new JScrollPane(table);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user