Clean up
This commit is contained in:
parent
4ea5a6ade5
commit
71e9315ec9
@ -3,6 +3,8 @@ package net.sf.openrocket.gui.main.flightconfigpanel;
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.Font;
|
||||
import java.awt.event.FocusEvent;
|
||||
import java.awt.event.FocusListener;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.util.Arrays;
|
||||
@ -180,6 +182,25 @@ public abstract class FlightConfigurablePanel<T extends FlightConfigurableCompon
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
table.getColumnModel().getSelectionModel().addListSelectionListener(new ListSelectionListener() {
|
||||
@Override
|
||||
public void valueChanged(ListSelectionEvent e) {
|
||||
updateComponentSelection(e);
|
||||
}
|
||||
});
|
||||
|
||||
table.addFocusListener(new FocusListener() {
|
||||
@Override
|
||||
public void focusGained(FocusEvent e) {
|
||||
updateComponentSelection(new ListSelectionEvent(this, 0, 0, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void focusLost(FocusEvent e) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@ -193,6 +214,11 @@ public abstract class FlightConfigurablePanel<T extends FlightConfigurableCompon
|
||||
table.clearSelection();
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the selection in the rocket design view, based on the currently selected motor, recovery device, or stage.
|
||||
*/
|
||||
protected abstract void updateComponentSelection(ListSelectionEvent e);
|
||||
|
||||
protected T getSelectedComponent() {
|
||||
|
||||
int col = table.convertColumnIndexToModel(table.getSelectedColumn());
|
||||
|
@ -3,8 +3,6 @@ package net.sf.openrocket.gui.main.flightconfigpanel;
|
||||
import java.awt.CardLayout;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.FocusEvent;
|
||||
import java.awt.event.FocusListener;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
@ -251,30 +249,6 @@ public class MotorConfigurationPanel extends FlightConfigurablePanel<MotorMount>
|
||||
return configurationTable;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void installTableListener() {
|
||||
super.installTableListener();
|
||||
|
||||
table.getColumnModel().getSelectionModel().addListSelectionListener(new ListSelectionListener() {
|
||||
@Override
|
||||
public void valueChanged(ListSelectionEvent e) {
|
||||
updateComponentSelection(e);
|
||||
}
|
||||
});
|
||||
|
||||
table.addFocusListener(new FocusListener() {
|
||||
@Override
|
||||
public void focusGained(FocusEvent e) {
|
||||
updateComponentSelection(new ListSelectionEvent(this, 0, 0, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void focusLost(FocusEvent e) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void doPopupFull(MouseEvent e) {
|
||||
popupMenuFull.show(e.getComponent(), e.getX(), e.getY());
|
||||
}
|
||||
|
@ -1,8 +1,6 @@
|
||||
package net.sf.openrocket.gui.main.flightconfigpanel;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.FocusEvent;
|
||||
import java.awt.event.FocusListener;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
@ -166,30 +164,6 @@ public class RecoveryConfigurationPanel extends FlightConfigurablePanel<Recovery
|
||||
return recoveryTable;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void installTableListener() {
|
||||
super.installTableListener();
|
||||
|
||||
table.getColumnModel().getSelectionModel().addListSelectionListener(new ListSelectionListener() {
|
||||
@Override
|
||||
public void valueChanged(ListSelectionEvent e) {
|
||||
updateComponentSelection(e);
|
||||
}
|
||||
});
|
||||
|
||||
table.addFocusListener(new FocusListener() {
|
||||
@Override
|
||||
public void focusGained(FocusEvent e) {
|
||||
updateComponentSelection(new ListSelectionEvent(this, 0, 0, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void focusLost(FocusEvent e) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void selectDeployment() {
|
||||
List<RecoveryDevice> devices = getSelectedComponents();
|
||||
List<FlightConfigurationId> fcIds = getSelectedConfigurationIds();
|
||||
|
@ -1,8 +1,6 @@
|
||||
package net.sf.openrocket.gui.main.flightconfigpanel;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.FocusEvent;
|
||||
import java.awt.event.FocusListener;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
@ -175,30 +173,6 @@ public class SeparationConfigurationPanel extends FlightConfigurablePanel<AxialS
|
||||
return separationTable;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void installTableListener() {
|
||||
super.installTableListener();
|
||||
|
||||
table.getColumnModel().getSelectionModel().addListSelectionListener(new ListSelectionListener() {
|
||||
@Override
|
||||
public void valueChanged(ListSelectionEvent e) {
|
||||
updateComponentSelection(e);
|
||||
}
|
||||
});
|
||||
|
||||
table.addFocusListener(new FocusListener() {
|
||||
@Override
|
||||
public void focusGained(FocusEvent e) {
|
||||
updateComponentSelection(new ListSelectionEvent(this, 0, 0, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void focusLost(FocusEvent e) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void selectSeparation() {
|
||||
List<AxialStage> stages = getSelectedComponents();
|
||||
List<FlightConfigurationId> fcIds = getSelectedConfigurationIds();
|
||||
|
Loading…
x
Reference in New Issue
Block a user