Fix focus lost motors, recovery & stage
This commit is contained in:
parent
6ff6265c3a
commit
e13c4baf25
@ -136,6 +136,7 @@ public class FlightConfigurationPanel extends JPanel implements StateChangeListe
|
|||||||
synchronizePanelSelection(previousPanel, panel);
|
synchronizePanelSelection(previousPanel, panel);
|
||||||
panel.updateButtonState();
|
panel.updateButtonState();
|
||||||
panel.takeTheSpotlight();
|
panel.takeTheSpotlight();
|
||||||
|
panel.updateRocketViewSelection();
|
||||||
previousPanel = panel;
|
previousPanel = panel;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -397,12 +398,15 @@ public class FlightConfigurationPanel extends JPanel implements StateChangeListe
|
|||||||
switch (tabs.getSelectedIndex()) {
|
switch (tabs.getSelectedIndex()) {
|
||||||
case MOTOR_TAB_INDEX:
|
case MOTOR_TAB_INDEX:
|
||||||
motorConfigurationPanel.takeTheSpotlight();
|
motorConfigurationPanel.takeTheSpotlight();
|
||||||
|
motorConfigurationPanel.updateRocketViewSelection();
|
||||||
break;
|
break;
|
||||||
case RECOVERY_TAB_INDEX:
|
case RECOVERY_TAB_INDEX:
|
||||||
recoveryConfigurationPanel.takeTheSpotlight();
|
recoveryConfigurationPanel.takeTheSpotlight();
|
||||||
|
recoveryConfigurationPanel.updateRocketViewSelection();
|
||||||
break;
|
break;
|
||||||
case SEPARATION_TAB_INDEX:
|
case SEPARATION_TAB_INDEX:
|
||||||
separationConfigurationPanel.takeTheSpotlight();
|
separationConfigurationPanel.takeTheSpotlight();
|
||||||
|
separationConfigurationPanel.updateRocketViewSelection();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,8 +3,6 @@ package net.sf.openrocket.gui.main.flightconfigpanel;
|
|||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
import java.awt.Font;
|
import java.awt.Font;
|
||||||
import java.awt.event.FocusEvent;
|
|
||||||
import java.awt.event.FocusListener;
|
|
||||||
import java.awt.event.MouseAdapter;
|
import java.awt.event.MouseAdapter;
|
||||||
import java.awt.event.MouseEvent;
|
import java.awt.event.MouseEvent;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
@ -186,19 +184,7 @@ public abstract class FlightConfigurablePanel<T extends FlightConfigurableCompon
|
|||||||
table.getColumnModel().getSelectionModel().addListSelectionListener(new ListSelectionListener() {
|
table.getColumnModel().getSelectionModel().addListSelectionListener(new ListSelectionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void valueChanged(ListSelectionEvent e) {
|
public void valueChanged(ListSelectionEvent e) {
|
||||||
updateComponentSelection(e);
|
updateRocketViewSelection(e);
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
table.addFocusListener(new FocusListener() {
|
|
||||||
@Override
|
|
||||||
public void focusGained(FocusEvent e) {
|
|
||||||
updateComponentSelection(new ListSelectionEvent(this, 0, 0, false));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void focusLost(FocusEvent e) {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -214,10 +200,15 @@ public abstract class FlightConfigurablePanel<T extends FlightConfigurableCompon
|
|||||||
table.clearSelection();
|
table.clearSelection();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void updateRocketViewSelection() {
|
||||||
|
ListSelectionEvent e = new ListSelectionEvent(this, 0, 0, false);
|
||||||
|
updateRocketViewSelection(e);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the selection in the rocket design view, based on the currently selected motor, recovery device, or stage.
|
* Update the selection in the rocket design view, based on the currently selected motor, recovery device, or stage.
|
||||||
*/
|
*/
|
||||||
protected abstract void updateComponentSelection(ListSelectionEvent e);
|
public abstract void updateRocketViewSelection(ListSelectionEvent e);
|
||||||
|
|
||||||
protected T getSelectedComponent() {
|
protected T getSelectedComponent() {
|
||||||
|
|
||||||
|
@ -253,7 +253,7 @@ public class MotorConfigurationPanel extends FlightConfigurablePanel<MotorMount>
|
|||||||
popupMenuFull.show(e.getComponent(), e.getX(), e.getY());
|
popupMenuFull.show(e.getComponent(), e.getX(), e.getY());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateComponentSelection(ListSelectionEvent e) {
|
public void updateRocketViewSelection(ListSelectionEvent e) {
|
||||||
if (e.getValueIsAdjusting()) {
|
if (e.getValueIsAdjusting()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -245,7 +245,7 @@ public class RecoveryConfigurationPanel extends FlightConfigurablePanel<Recovery
|
|||||||
popupMenuFull.show(e.getComponent(), e.getX(), e.getY());
|
popupMenuFull.show(e.getComponent(), e.getX(), e.getY());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateComponentSelection(ListSelectionEvent e) {
|
public void updateRocketViewSelection(ListSelectionEvent e) {
|
||||||
if (e.getValueIsAdjusting() || getSelectedComponents() == null) {
|
if (e.getValueIsAdjusting() || getSelectedComponents() == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -255,7 +255,7 @@ public class SeparationConfigurationPanel extends FlightConfigurablePanel<AxialS
|
|||||||
popupMenuFull.show(e.getComponent(), e.getX(), e.getY());
|
popupMenuFull.show(e.getComponent(), e.getX(), e.getY());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateComponentSelection(ListSelectionEvent e) {
|
public void updateRocketViewSelection(ListSelectionEvent e) {
|
||||||
if (e.getValueIsAdjusting() || getSelectedComponents() == null) {
|
if (e.getValueIsAdjusting() || getSelectedComponents() == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user