Fix component selection resetting after updating plots
This commit is contained in:
parent
f392760c0e
commit
a52f16bd7c
@ -71,7 +71,7 @@ public class CAPlotPanel extends PlotPanel<CADataType, CADataBranch, CADataTypeG
|
||||
@Override
|
||||
protected CAPlotTypeSelector createSelector(int i, CADataType type, Unit unit, int axis) {
|
||||
return new CAPlotTypeSelector(parent, i, type, unit, axis, List.of(typesY),
|
||||
parent.getComponentsForType(type), configuration);
|
||||
parent.getComponentsForType(type), configuration, configuration.getComponent(i));
|
||||
}
|
||||
|
||||
public void setXAxis(CADomainDataType type) {
|
||||
|
@ -18,7 +18,8 @@ public class CAPlotTypeSelector extends PlotTypeSelector<CADataType, CADataTypeG
|
||||
|
||||
public CAPlotTypeSelector(final ComponentAnalysisPlotExportPanel parent, int plotIndex,
|
||||
CADataType type, Unit unit, int position, List<CADataType> availableTypes,
|
||||
List<RocketComponent> componentsForType, CAPlotConfiguration configuration) {
|
||||
List<RocketComponent> componentsForType, CAPlotConfiguration configuration,
|
||||
RocketComponent selectedComponent) {
|
||||
super(plotIndex, type, unit, position, availableTypes, false);
|
||||
|
||||
if (componentsForType.isEmpty()) {
|
||||
@ -26,9 +27,11 @@ public class CAPlotTypeSelector extends PlotTypeSelector<CADataType, CADataTypeG
|
||||
}
|
||||
|
||||
// Component selector
|
||||
selectedComponent = selectedComponent != null ? selectedComponent : componentsForType.get(0);
|
||||
this.add(new JLabel(trans.get("CAPlotTypeSelector.lbl.component")));
|
||||
componentSelector = new JComboBox<>(componentsForType.toArray(new RocketComponent[0]));
|
||||
configuration.setPlotDataComponent(plotIndex, componentsForType.get(0));
|
||||
componentSelector.setSelectedItem(selectedComponent);
|
||||
configuration.setPlotDataComponent(plotIndex, selectedComponent);
|
||||
this.add(componentSelector, "gapright para");
|
||||
|
||||
addRemoveButton();
|
||||
@ -48,6 +51,12 @@ public class CAPlotTypeSelector extends PlotTypeSelector<CADataType, CADataTypeG
|
||||
});
|
||||
}
|
||||
|
||||
public CAPlotTypeSelector(final ComponentAnalysisPlotExportPanel parent, int plotIndex,
|
||||
CADataType type, Unit unit, int position, List<CADataType> availableTypes,
|
||||
List<RocketComponent> componentsForType, CAPlotConfiguration configuration) {
|
||||
this(parent, plotIndex, type, unit, position, availableTypes, componentsForType, configuration, null);
|
||||
}
|
||||
|
||||
public void addComponentSelectionListener(ItemListener listener) {
|
||||
componentSelector.addItemListener(listener);
|
||||
}
|
||||
|
@ -212,7 +212,6 @@ public class PlotPanel<T extends DataType & Groupable<G>,
|
||||
// Select new type smartly
|
||||
T type = null;
|
||||
for (T t : typesY) {
|
||||
|
||||
boolean used = false;
|
||||
if (configuration.getDomainAxisType().equals(t)) {
|
||||
used = true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user