| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
package dr.app.coalgen; |
| 27 |
|
| 28 |
import jam.framework.Exportable; |
| 29 |
import jam.panels.OptionsPanel; |
| 30 |
|
| 31 |
import javax.swing.*; |
| 32 |
import java.awt.*; |
| 33 |
import dr.app.gui.components.WholeNumberField; |
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
public class SimulationsPanel extends JPanel implements Exportable { |
| 41 |
|
| 42 |
private final CoalGenFrame frame; |
| 43 |
private final CoalGenData data; |
| 44 |
|
| 45 |
private OptionsPanel optionPanel; |
| 46 |
|
| 47 |
private final JLabel replicatesLabel = new JLabel("Number of replicates:"); |
| 48 |
private final WholeNumberField replicatesField = new WholeNumberField(1, Integer.MAX_VALUE); |
| 49 |
|
| 50 |
|
| 51 |
public SimulationsPanel(final CoalGenFrame frame, final CoalGenData data) { |
| 52 |
|
| 53 |
super(); |
| 54 |
|
| 55 |
this.frame = frame; |
| 56 |
this.data = data; |
| 57 |
|
| 58 |
setOpaque(false); |
| 59 |
setLayout(new BorderLayout()); |
| 60 |
|
| 61 |
optionPanel = new OptionsPanel(12, 12, SwingConstants.CENTER); |
| 62 |
add(optionPanel, BorderLayout.NORTH); |
| 63 |
|
| 64 |
replicatesField.setColumns(8); |
| 65 |
replicatesField.setValue(data.replicateCount); |
| 66 |
|
| 67 |
optionPanel.addComponents(replicatesLabel, replicatesField); |
| 68 |
} |
| 69 |
|
| 70 |
public final void tracesChanged() { |
| 71 |
replicatesLabel.setEnabled(data.traces == null); |
| 72 |
replicatesField.setEnabled(data.traces == null); |
| 73 |
if (data.traces != null) { |
| 74 |
replicatesField.setValue(data.traces.getStateCount()); |
| 75 |
} |
| 76 |
|
| 77 |
replicatesField.setValue(data.replicateCount); |
| 78 |
} |
| 79 |
|
| 80 |
public final void collectSettings() { |
| 81 |
data.replicateCount = replicatesField.getValue(); |
| 82 |
} |
| 83 |
|
| 84 |
public JComponent getExportableComponent() { |
| 85 |
return this; |
| 86 |
} |
| 87 |
} |