Fix refresh bug which sometimes happens when the plot configuration is changed. Sometimes after changing the configuration drop down (at the top), the y series combo boxes disappeared.

This commit is contained in:
Kevin Ruland 2012-07-31 18:03:52 +00:00
parent 3a53e160e9
commit be8827c226

View File

@ -119,8 +119,16 @@ public class SimulationPlotPanel extends JPanel {
} }
configurationSelector.addItemListener(new ItemListener() { configurationSelector.addItemListener(new ItemListener() {
@Override @Override
public void itemStateChanged(ItemEvent e) { public void itemStateChanged(ItemEvent e) {
// We are only concerned with ItemEvent.SELECTED to update
// the UI when the selected item changes.
// TODO - this should probably be implemented as an ActionListener instead
// of ItemStateListener.
if ( e.getStateChange() == ItemEvent.DESELECTED) {
return;
}
if (modifying > 0) if (modifying > 0)
return; return;
PlotConfiguration conf = (PlotConfiguration) configurationSelector.getSelectedItem(); PlotConfiguration conf = (PlotConfiguration) configurationSelector.getSelectedItem();
@ -357,7 +365,9 @@ public class SimulationPlotPanel extends JPanel {
typeSelectorPanel.add(new PlotTypeSelector(i, type, unit, axis), "wrap"); typeSelectorPanel.add(new PlotTypeSelector(i, type, unit, axis), "wrap");
} }
typeSelectorPanel.repaint(); // In order to consistantly update the ui, we need to validate before repaint.
typeSelectorPanel.validate();
typeSelectorPanel.repaint();
eventTableModel.fireTableDataChanged(); eventTableModel.fireTableDataChanged();
} }