Open the SimulationEditDialog in the correct mode based on button press
only try to infer it when double clicking.
This commit is contained in:
parent
be62cc243e
commit
4b9fb6b2fc
@ -102,7 +102,7 @@ public class SimulationPanel extends JPanel {
|
|||||||
simulationTable.clearSelection();
|
simulationTable.clearSelection();
|
||||||
simulationTable.addRowSelectionInterval(n, n);
|
simulationTable.addRowSelectionInterval(n, n);
|
||||||
|
|
||||||
openDialog(sim);
|
openDialog(false, sim);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.add(button, "skip 1, gapright para");
|
this.add(button, "skip 1, gapright para");
|
||||||
@ -124,7 +124,7 @@ public class SimulationPanel extends JPanel {
|
|||||||
selection[i] = simulationTable.convertRowIndexToModel(selection[i]);
|
selection[i] = simulationTable.convertRowIndexToModel(selection[i]);
|
||||||
sims[i] = document.getSimulation(selection[i]);
|
sims[i] = document.getSimulation(selection[i]);
|
||||||
}
|
}
|
||||||
openDialog(sims);
|
openDialog(false, sims);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.add(editButton, "gapright para");
|
this.add(editButton, "gapright para");
|
||||||
@ -234,7 +234,7 @@ public class SimulationPanel extends JPanel {
|
|||||||
|
|
||||||
fireMaintainSelection();
|
fireMaintainSelection();
|
||||||
|
|
||||||
openDialog(sim);
|
openDialog(true, sim);
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -560,15 +560,23 @@ public class SimulationPanel extends JPanel {
|
|||||||
return simulationTable.getSelectionModel();
|
return simulationTable.getSelectionModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void openDialog(final Simulation... sims) {
|
private void openDialog(boolean plotMode, final Simulation... sims) {
|
||||||
SimulationEditDialog d = new SimulationEditDialog(SwingUtilities.getWindowAncestor(this), document, sims);
|
SimulationEditDialog d = new SimulationEditDialog(SwingUtilities.getWindowAncestor(this), document, sims);
|
||||||
if (sims.length == 1 && sims[0].hasSimulationData()) {
|
if (plotMode) {
|
||||||
d.setPlotMode();
|
d.setPlotMode();
|
||||||
}
|
}
|
||||||
d.setVisible(true);
|
d.setVisible(true);
|
||||||
fireMaintainSelection();
|
fireMaintainSelection();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void openDialog(final Simulation sim) {
|
||||||
|
boolean plotMode = false;
|
||||||
|
if (sim.hasSimulationData()) {
|
||||||
|
plotMode = true;
|
||||||
|
}
|
||||||
|
openDialog(plotMode, sim);
|
||||||
|
}
|
||||||
|
|
||||||
private void fireMaintainSelection() {
|
private void fireMaintainSelection() {
|
||||||
int[] selection = simulationTable.getSelectedRows();
|
int[] selection = simulationTable.getSelectedRows();
|
||||||
simulationTableModel.fireTableDataChanged();
|
simulationTableModel.fireTableDataChanged();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user