Add right-click actions for motor config
This commit is contained in:
parent
9e7a48261e
commit
e79aa9d739
@ -2,13 +2,16 @@ package net.sf.openrocket.gui.main.flightconfigpanel;
|
|||||||
|
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
import java.awt.event.ActionListener;
|
import java.awt.event.ActionListener;
|
||||||
|
import java.awt.event.MouseEvent;
|
||||||
import java.util.EventObject;
|
import java.util.EventObject;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.swing.AbstractAction;
|
||||||
import javax.swing.JButton;
|
import javax.swing.JButton;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
|
import javax.swing.JPopupMenu;
|
||||||
import javax.swing.JTabbedPane;
|
import javax.swing.JTabbedPane;
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
import javax.swing.event.ChangeEvent;
|
import javax.swing.event.ChangeEvent;
|
||||||
@ -48,6 +51,12 @@ public class FlightConfigurationPanel extends JPanel implements StateChangeListe
|
|||||||
private final RecoveryConfigurationPanel recoveryConfigurationPanel;
|
private final RecoveryConfigurationPanel recoveryConfigurationPanel;
|
||||||
private final SeparationConfigurationPanel separationConfigurationPanel;
|
private final SeparationConfigurationPanel separationConfigurationPanel;
|
||||||
|
|
||||||
|
private final JPopupMenu popupMenuConfig;
|
||||||
|
private final AbstractAction newConfigAction;
|
||||||
|
private final AbstractAction renameConfigAction;
|
||||||
|
private final AbstractAction removeConfigAction;
|
||||||
|
private final AbstractAction duplicateConfigAction;
|
||||||
|
|
||||||
private final static int MOTOR_TAB_INDEX = 0;
|
private final static int MOTOR_TAB_INDEX = 0;
|
||||||
private final static int RECOVERY_TAB_INDEX = 1;
|
private final static int RECOVERY_TAB_INDEX = 1;
|
||||||
private final static int SEPARATION_TAB_INDEX = 2;
|
private final static int SEPARATION_TAB_INDEX = 2;
|
||||||
@ -60,7 +69,16 @@ public class FlightConfigurationPanel extends JPanel implements StateChangeListe
|
|||||||
this.rocket = doc.getRocket();
|
this.rocket = doc.getRocket();
|
||||||
this.rocket.addChangeListener(this);
|
this.rocket.addChangeListener(this);
|
||||||
|
|
||||||
//JPanel panel = new JPanel(new MigLayout("fill","[grow][][][][][grow]"));
|
// Populate the popup menu
|
||||||
|
popupMenuConfig = new JPopupMenu();
|
||||||
|
newConfigAction = new NewConfigAction();
|
||||||
|
renameConfigAction = new RenameConfigAction();
|
||||||
|
removeConfigAction = new RemoveConfigAction();
|
||||||
|
duplicateConfigAction = new DuplicateConfigAction();
|
||||||
|
popupMenuConfig.add(newConfigAction);
|
||||||
|
popupMenuConfig.add(renameConfigAction);
|
||||||
|
popupMenuConfig.add(removeConfigAction);
|
||||||
|
popupMenuConfig.add(duplicateConfigAction);
|
||||||
|
|
||||||
//// Tabs for advanced view.
|
//// Tabs for advanced view.
|
||||||
tabs = new JTabbedPane();
|
tabs = new JTabbedPane();
|
||||||
@ -77,44 +95,20 @@ public class FlightConfigurationPanel extends JPanel implements StateChangeListe
|
|||||||
separationConfigurationPanel = new SeparationConfigurationPanel(this, rocket);
|
separationConfigurationPanel = new SeparationConfigurationPanel(this, rocket);
|
||||||
tabs.add(trans.get("edtmotorconfdlg.lbl.Stagetab"), separationConfigurationPanel);
|
tabs.add(trans.get("edtmotorconfdlg.lbl.Stagetab"), separationConfigurationPanel);
|
||||||
|
|
||||||
newConfButton = new SelectColorButton(trans.get("edtmotorconfdlg.but.Newconfiguration"));
|
//// New configuration
|
||||||
newConfButton.addActionListener(new ActionListener() {
|
newConfButton = new SelectColorButton(newConfigAction);
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
newOrDuplicateConfigAction(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
this.add(newConfButton,"skip 1,gapright para");
|
this.add(newConfButton,"skip 1,gapright para");
|
||||||
|
|
||||||
renameConfButton = new SelectColorButton(trans.get("edtmotorconfdlg.but.Renameconfiguration"));
|
//// Rename configuration
|
||||||
renameConfButton.addActionListener(new ActionListener() {
|
renameConfButton = new SelectColorButton(renameConfigAction);
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
renameConfiguration();
|
|
||||||
configurationChanged(ComponentChangeEvent.NONFUNCTIONAL_CHANGE);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
this.add(renameConfButton,"gapright para");
|
this.add(renameConfButton,"gapright para");
|
||||||
|
|
||||||
removeConfButton = new SelectColorButton(trans.get("edtmotorconfdlg.but.Removeconfiguration"));
|
//// Remove configuration
|
||||||
removeConfButton.addActionListener(new ActionListener() {
|
removeConfButton = new SelectColorButton(removeConfigAction);
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
removeConfiguration();
|
|
||||||
configurationChanged(ComponentChangeEvent.NONFUNCTIONAL_CHANGE);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
this.add(removeConfButton,"gapright para");
|
this.add(removeConfButton,"gapright para");
|
||||||
|
|
||||||
duplicateConfButton = new SelectColorButton(trans.get("edtmotorconfdlg.but.Duplicateconfiguration"));
|
//// Duplicate configuration
|
||||||
duplicateConfButton.addActionListener(new ActionListener() {
|
duplicateConfButton = new SelectColorButton(duplicateConfigAction);
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
newOrDuplicateConfigAction(true);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
this.add(duplicateConfButton, "wrap");
|
this.add(duplicateConfButton, "wrap");
|
||||||
|
|
||||||
tabs.addChangeListener(new ChangeListener() {
|
tabs.addChangeListener(new ChangeListener() {
|
||||||
@ -150,7 +144,7 @@ public class FlightConfigurationPanel extends JPanel implements StateChangeListe
|
|||||||
stateChanged(null);
|
stateChanged(null);
|
||||||
switch (tabs.getSelectedIndex()) {
|
switch (tabs.getSelectedIndex()) {
|
||||||
case MOTOR_TAB_INDEX:
|
case MOTOR_TAB_INDEX:
|
||||||
motorConfigurationPanel.selectMotor();
|
motorConfigurationPanel.selectMotorAction();
|
||||||
break;
|
break;
|
||||||
case RECOVERY_TAB_INDEX:
|
case RECOVERY_TAB_INDEX:
|
||||||
recoveryConfigurationPanel.selectDeployment();
|
recoveryConfigurationPanel.selectDeployment();
|
||||||
@ -215,7 +209,7 @@ public class FlightConfigurationPanel extends JPanel implements StateChangeListe
|
|||||||
rocket.setSelectedConfiguration((FlightConfigurationId) newConfigs.keySet().toArray()[0]);
|
rocket.setSelectedConfiguration((FlightConfigurationId) newConfigs.keySet().toArray()[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void renameConfiguration() {
|
private void renameConfigurationAction() {
|
||||||
List<FlightConfigurationId> fcIds = getSelectedConfigurationIds();
|
List<FlightConfigurationId> fcIds = getSelectedConfigurationIds();
|
||||||
if (fcIds == null) return;
|
if (fcIds == null) return;
|
||||||
FlightConfigurationId initFcId = fcIds.get(0);
|
FlightConfigurationId initFcId = fcIds.get(0);
|
||||||
@ -224,9 +218,10 @@ public class FlightConfigurationPanel extends JPanel implements StateChangeListe
|
|||||||
for (int i = 1; i < fcIds.size(); i++) {
|
for (int i = 1; i < fcIds.size(); i++) {
|
||||||
rocket.getFlightConfiguration(fcIds.get(i)).setName(newName);
|
rocket.getFlightConfiguration(fcIds.get(i)).setName(newName);
|
||||||
}
|
}
|
||||||
|
configurationChanged(ComponentChangeEvent.NONFUNCTIONAL_CHANGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void removeConfiguration() {
|
private void removeConfigurationAction() {
|
||||||
List<FlightConfigurationId> fcIds = getSelectedConfigurationIds();
|
List<FlightConfigurationId> fcIds = getSelectedConfigurationIds();
|
||||||
if (fcIds == null || fcIds.size() == 0)
|
if (fcIds == null || fcIds.size() == 0)
|
||||||
return;
|
return;
|
||||||
@ -238,6 +233,26 @@ public class FlightConfigurationPanel extends JPanel implements StateChangeListe
|
|||||||
configurationChanged(ComponentChangeEvent.NONFUNCTIONAL_CHANGE);
|
configurationChanged(ComponentChangeEvent.NONFUNCTIONAL_CHANGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void doPopupConfig(MouseEvent e) {
|
||||||
|
popupMenuConfig.show(e.getComponent(), e.getX(), e.getY());
|
||||||
|
}
|
||||||
|
|
||||||
|
public AbstractAction getNewConfigAction() {
|
||||||
|
return newConfigAction;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AbstractAction getRenameConfigAction() {
|
||||||
|
return renameConfigAction;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AbstractAction getRemoveConfigAction() {
|
||||||
|
return removeConfigAction;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AbstractAction getDuplicateConfigAction() {
|
||||||
|
return duplicateConfigAction;
|
||||||
|
}
|
||||||
|
|
||||||
private void configurationChanged(int cce) {
|
private void configurationChanged(int cce) {
|
||||||
motorConfigurationPanel.fireTableDataChanged(cce);
|
motorConfigurationPanel.fireTableDataChanged(cce);
|
||||||
recoveryConfigurationPanel.fireTableDataChanged(cce);
|
recoveryConfigurationPanel.fireTableDataChanged(cce);
|
||||||
@ -308,4 +323,48 @@ public class FlightConfigurationPanel extends JPanel implements StateChangeListe
|
|||||||
recoveryConfigurationPanel.synchronizeConfigurationSelection();
|
recoveryConfigurationPanel.synchronizeConfigurationSelection();
|
||||||
separationConfigurationPanel.synchronizeConfigurationSelection();
|
separationConfigurationPanel.synchronizeConfigurationSelection();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class NewConfigAction extends AbstractAction {
|
||||||
|
public NewConfigAction() {
|
||||||
|
putValue(NAME, trans.get("edtmotorconfdlg.but.Newconfiguration"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
newOrDuplicateConfigAction(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class RenameConfigAction extends AbstractAction {
|
||||||
|
public RenameConfigAction() {
|
||||||
|
putValue(NAME, trans.get("edtmotorconfdlg.but.Renameconfiguration"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
renameConfigurationAction();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class RemoveConfigAction extends AbstractAction {
|
||||||
|
public RemoveConfigAction() {
|
||||||
|
putValue(NAME, trans.get("edtmotorconfdlg.but.Removeconfiguration"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
removeConfigurationAction();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class DuplicateConfigAction extends AbstractAction {
|
||||||
|
public DuplicateConfigAction() {
|
||||||
|
putValue(NAME, trans.get("edtmotorconfdlg.but.Duplicateconfiguration"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
newOrDuplicateConfigAction(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@ package net.sf.openrocket.gui.main.flightconfigpanel;
|
|||||||
import java.awt.CardLayout;
|
import java.awt.CardLayout;
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
import java.awt.event.ActionListener;
|
|
||||||
import java.awt.event.FocusEvent;
|
import java.awt.event.FocusEvent;
|
||||||
import java.awt.event.FocusListener;
|
import java.awt.event.FocusListener;
|
||||||
import java.awt.event.KeyEvent;
|
import java.awt.event.KeyEvent;
|
||||||
@ -19,6 +18,7 @@ import javax.swing.JButton;
|
|||||||
import javax.swing.JComponent;
|
import javax.swing.JComponent;
|
||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
|
import javax.swing.JPopupMenu;
|
||||||
import javax.swing.JScrollPane;
|
import javax.swing.JScrollPane;
|
||||||
import javax.swing.JTable;
|
import javax.swing.JTable;
|
||||||
import javax.swing.KeyStroke;
|
import javax.swing.KeyStroke;
|
||||||
@ -62,6 +62,16 @@ public class MotorConfigurationPanel extends FlightConfigurablePanel<MotorMount>
|
|||||||
private final MotorChooserDialog motorChooserDialog;
|
private final MotorChooserDialog motorChooserDialog;
|
||||||
protected FlightConfigurableTableModel<MotorMount> configurationTableModel;
|
protected FlightConfigurableTableModel<MotorMount> configurationTableModel;
|
||||||
|
|
||||||
|
private final JPopupMenu popupMenuFull; // popup menu containing all the options
|
||||||
|
private final AbstractAction selectMotorAction;
|
||||||
|
private final AbstractAction removeMotorAction;
|
||||||
|
private final AbstractAction selectIgnitionAction;
|
||||||
|
private final AbstractAction resetIgnitionAction;
|
||||||
|
private final AbstractAction renameConfigAction;
|
||||||
|
private final AbstractAction removeConfigAction;
|
||||||
|
private final AbstractAction duplicateConfigAction;
|
||||||
|
|
||||||
|
|
||||||
MotorConfigurationPanel(final FlightConfigurationPanel flightConfigurationPanel, Rocket rocket) {
|
MotorConfigurationPanel(final FlightConfigurationPanel flightConfigurationPanel, Rocket rocket) {
|
||||||
super(flightConfigurationPanel, rocket);
|
super(flightConfigurationPanel, rocket);
|
||||||
|
|
||||||
@ -82,6 +92,26 @@ public class MotorConfigurationPanel extends FlightConfigurablePanel<MotorMount>
|
|||||||
cards = new JPanel(new CardLayout());
|
cards = new JPanel(new CardLayout());
|
||||||
this.add(cards, "pushy");
|
this.add(cards, "pushy");
|
||||||
|
|
||||||
|
// Get all the actions
|
||||||
|
selectMotorAction = new SelectMotorAction();
|
||||||
|
removeMotorAction = new RemoveMotorAction();
|
||||||
|
selectIgnitionAction = new SelectIgnitionAction();
|
||||||
|
resetIgnitionAction = new ResetIgnitionAction();
|
||||||
|
renameConfigAction = flightConfigurationPanel.getRenameConfigAction();
|
||||||
|
removeConfigAction = flightConfigurationPanel.getRemoveConfigAction();
|
||||||
|
duplicateConfigAction = flightConfigurationPanel.getDuplicateConfigAction();
|
||||||
|
|
||||||
|
// Populate the popup menu
|
||||||
|
popupMenuFull = new JPopupMenu();
|
||||||
|
popupMenuFull.add(selectMotorAction);
|
||||||
|
popupMenuFull.add(removeMotorAction);
|
||||||
|
popupMenuFull.add(selectIgnitionAction);
|
||||||
|
popupMenuFull.add(resetIgnitionAction);
|
||||||
|
popupMenuFull.addSeparator();
|
||||||
|
popupMenuFull.add(renameConfigAction);
|
||||||
|
popupMenuFull.add(removeConfigAction);
|
||||||
|
popupMenuFull.add(duplicateConfigAction);
|
||||||
|
|
||||||
JLabel helpText = new JLabel(trans.get("MotorConfigurationPanel.lbl.nomotors"));
|
JLabel helpText = new JLabel(trans.get("MotorConfigurationPanel.lbl.nomotors"));
|
||||||
cards.add(helpText, HELP_LABEL );
|
cards.add(helpText, HELP_LABEL );
|
||||||
|
|
||||||
@ -93,43 +123,19 @@ public class MotorConfigurationPanel extends FlightConfigurablePanel<MotorMount>
|
|||||||
configurationPanel.add(scroll, "spanx, grow, pushy, wrap");
|
configurationPanel.add(scroll, "spanx, grow, pushy, wrap");
|
||||||
|
|
||||||
//// Select motor
|
//// Select motor
|
||||||
selectMotorButton = new SelectColorButton(trans.get("MotorConfigurationPanel.btn.selectMotor"));
|
selectMotorButton = new SelectColorButton(selectMotorAction);
|
||||||
selectMotorButton.addActionListener(new ActionListener() {
|
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
selectMotor();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
configurationPanel.add(selectMotorButton, "split, align right, sizegroup button");
|
configurationPanel.add(selectMotorButton, "split, align right, sizegroup button");
|
||||||
|
|
||||||
//// Remove motor button
|
//// Remove motor button
|
||||||
removeMotorButton = new SelectColorButton(trans.get("MotorConfigurationPanel.btn.removeMotor"));
|
removeMotorButton = new SelectColorButton(removeMotorAction);
|
||||||
removeMotorButton.addActionListener(new ActionListener() {
|
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
removeMotor();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
configurationPanel.add(removeMotorButton, "sizegroup button");
|
configurationPanel.add(removeMotorButton, "sizegroup button");
|
||||||
|
|
||||||
//// Select Ignition button
|
//// Select Ignition button
|
||||||
selectIgnitionButton = new SelectColorButton(trans.get("MotorConfigurationPanel.btn.selectIgnition"));
|
selectIgnitionButton = new SelectColorButton(selectIgnitionAction);
|
||||||
selectIgnitionButton.addActionListener(new ActionListener() {
|
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
selectIgnition();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
configurationPanel.add(selectIgnitionButton, "sizegroup button");
|
configurationPanel.add(selectIgnitionButton, "sizegroup button");
|
||||||
|
|
||||||
//// Reset Ignition button
|
//// Reset Ignition button
|
||||||
resetIgnitionButton = new SelectColorButton(trans.get("MotorConfigurationPanel.btn.resetIgnition"));
|
resetIgnitionButton = new SelectColorButton(resetIgnitionAction);
|
||||||
resetIgnitionButton.addActionListener(new ActionListener() {
|
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
resetIgnition();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
configurationPanel.add(resetIgnitionButton, "sizegroup button, wrap");
|
configurationPanel.add(resetIgnitionButton, "sizegroup button, wrap");
|
||||||
|
|
||||||
cards.add(configurationPanel, TABLE_LABEL );
|
cards.add(configurationPanel, TABLE_LABEL );
|
||||||
@ -142,7 +148,7 @@ public class MotorConfigurationPanel extends FlightConfigurablePanel<MotorMount>
|
|||||||
table.getActionMap().put("Enter", new AbstractAction() {
|
table.getActionMap().put("Enter", new AbstractAction() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent ae) {
|
public void actionPerformed(ActionEvent ae) {
|
||||||
selectMotor();
|
selectMotorAction();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -199,9 +205,16 @@ public class MotorConfigurationPanel extends FlightConfigurablePanel<MotorMount>
|
|||||||
public void mouseClicked(MouseEvent e) {
|
public void mouseClicked(MouseEvent e) {
|
||||||
updateButtonState();
|
updateButtonState();
|
||||||
int selectedColumn = table.getSelectedColumn();
|
int selectedColumn = table.getSelectedColumn();
|
||||||
if (e.getClickCount() == 2) {
|
|
||||||
|
if (e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() == 2) {
|
||||||
if (selectedColumn > 0) {
|
if (selectedColumn > 0) {
|
||||||
selectMotor();
|
selectMotorAction();
|
||||||
|
}
|
||||||
|
} else if (e.getButton() == MouseEvent.BUTTON3 && e.getClickCount() == 1) {
|
||||||
|
if (selectedColumn > 0) {
|
||||||
|
doPopupFull(e);
|
||||||
|
} else {
|
||||||
|
flightConfigurationPanel.doPopupConfig(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -234,6 +247,10 @@ public class MotorConfigurationPanel extends FlightConfigurablePanel<MotorMount>
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void doPopupFull(MouseEvent e) {
|
||||||
|
popupMenuFull.show(e.getComponent(), e.getX(), e.getY());
|
||||||
|
}
|
||||||
|
|
||||||
public void updateComponentSelection(ListSelectionEvent e) {
|
public void updateComponentSelection(ListSelectionEvent e) {
|
||||||
if (e.getValueIsAdjusting()) {
|
if (e.getValueIsAdjusting()) {
|
||||||
return;
|
return;
|
||||||
@ -268,7 +285,7 @@ public class MotorConfigurationPanel extends FlightConfigurablePanel<MotorMount>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void selectMotor() {
|
public void selectMotorAction() {
|
||||||
List<MotorMount> mounts = getSelectedComponents();
|
List<MotorMount> mounts = getSelectedComponents();
|
||||||
List<FlightConfigurationId> fcIds = getSelectedConfigurationIds();
|
List<FlightConfigurationId> fcIds = getSelectedConfigurationIds();
|
||||||
if ((mounts == null) || (fcIds == null) || mounts.size() == 0 || fcIds.size() == 0) {
|
if ((mounts == null) || (fcIds == null) || mounts.size() == 0 || fcIds.size() == 0) {
|
||||||
@ -315,7 +332,7 @@ public class MotorConfigurationPanel extends FlightConfigurablePanel<MotorMount>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void removeMotor() {
|
private void removeMotorAction() {
|
||||||
List<MotorMount> mounts = getSelectedComponents();
|
List<MotorMount> mounts = getSelectedComponents();
|
||||||
List<FlightConfigurationId> fcIds = getSelectedConfigurationIds();
|
List<FlightConfigurationId> fcIds = getSelectedConfigurationIds();
|
||||||
if ((mounts == null) || (fcIds == null) || mounts.size() == 0 || fcIds.size() == 0) {
|
if ((mounts == null) || (fcIds == null) || mounts.size() == 0 || fcIds.size() == 0) {
|
||||||
@ -331,7 +348,7 @@ public class MotorConfigurationPanel extends FlightConfigurablePanel<MotorMount>
|
|||||||
fireTableDataChanged(ComponentChangeEvent.MOTOR_CHANGE);
|
fireTableDataChanged(ComponentChangeEvent.MOTOR_CHANGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void selectIgnition() {
|
private void selectIgnitionAction() {
|
||||||
List<MotorMount> mounts = getSelectedComponents();
|
List<MotorMount> mounts = getSelectedComponents();
|
||||||
List<FlightConfigurationId> fcIds = getSelectedConfigurationIds();
|
List<FlightConfigurationId> fcIds = getSelectedConfigurationIds();
|
||||||
if ((mounts == null) || (fcIds == null) || mounts.size() == 0 || fcIds.size() == 0) {
|
if ((mounts == null) || (fcIds == null) || mounts.size() == 0 || fcIds.size() == 0) {
|
||||||
@ -380,7 +397,7 @@ public class MotorConfigurationPanel extends FlightConfigurablePanel<MotorMount>
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void resetIgnition() {
|
private void resetIgnitionAction() {
|
||||||
List<MotorMount> mounts = getSelectedComponents();
|
List<MotorMount> mounts = getSelectedComponents();
|
||||||
List<FlightConfigurationId> fcIds = getSelectedConfigurationIds();
|
List<FlightConfigurationId> fcIds = getSelectedConfigurationIds();
|
||||||
if ((mounts == null) || (fcIds == null) || mounts.size() == 0 || fcIds.size() == 0) {
|
if ((mounts == null) || (fcIds == null) || mounts.size() == 0 || fcIds.size() == 0) {
|
||||||
@ -408,6 +425,50 @@ public class MotorConfigurationPanel extends FlightConfigurablePanel<MotorMount>
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private class SelectMotorAction extends AbstractAction {
|
||||||
|
public SelectMotorAction() {
|
||||||
|
putValue(NAME, trans.get("MotorConfigurationPanel.btn.selectMotor"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
selectMotorAction();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class RemoveMotorAction extends AbstractAction {
|
||||||
|
public RemoveMotorAction() {
|
||||||
|
putValue(NAME, trans.get("MotorConfigurationPanel.btn.removeMotor"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
removeMotorAction();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class SelectIgnitionAction extends AbstractAction {
|
||||||
|
public SelectIgnitionAction() {
|
||||||
|
putValue(NAME, trans.get("MotorConfigurationPanel.btn.selectIgnition"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
selectIgnitionAction();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class ResetIgnitionAction extends AbstractAction {
|
||||||
|
public ResetIgnitionAction() {
|
||||||
|
putValue(NAME, trans.get("MotorConfigurationPanel.btn.resetIgnition"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
resetIgnitionAction();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private class MotorTableCellRenderer extends FlightConfigurablePanel<MotorMount>.FlightConfigurableCellRenderer {
|
private class MotorTableCellRenderer extends FlightConfigurablePanel<MotorMount>.FlightConfigurableCellRenderer {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user