use of javax.swing.border.EmptyBorder in project beast-mcmc by beast-dev.
the class ChartSetupDialog method showDialog.
public int showDialog(JChart chart) {
JOptionPane optionPane = new JOptionPane(optionPanel, JOptionPane.QUESTION_MESSAGE, JOptionPane.OK_CANCEL_OPTION, null, null, null);
optionPane.setBorder(new EmptyBorder(12, 12, 12, 12));
Axis xAxis = chart.getXAxis();
Axis yAxis = chart.getYAxis();
if (canLogXAxis) {
logXAxis.setSelected(xAxis instanceof LogAxis);
}
if (canLogYAxis) {
logYAxis.setSelected(yAxis instanceof LogAxis);
}
if (!manualXAxis.isSelected()) {
minXValue.setValue(xAxis.getMinAxis());
maxXValue.setValue(xAxis.getMaxAxis());
}
if (!manualYAxis.isSelected()) {
minYValue.setValue(yAxis.getMinAxis());
maxYValue.setValue(yAxis.getMaxAxis());
}
final JDialog dialog = optionPane.createDialog(frame, "Setup Chart");
dialog.pack();
dialog.setVisible(true);
final Integer value = (Integer) optionPane.getValue();
final int result = (value != null && value != -1) ? value : JOptionPane.CANCEL_OPTION;
if (result == JOptionPane.OK_OPTION) {
applySettings(chart);
}
return result;
}
use of javax.swing.border.EmptyBorder in project beast-mcmc by beast-dev.
the class SelectClockDialog method showDialog.
public int showDialog(Object[] models) {
treeCombo.removeAllItems();
for (Object model : models) {
treeCombo.addItem(model);
}
JOptionPane optionPane = new JOptionPane(optionPanel, JOptionPane.QUESTION_MESSAGE, JOptionPane.OK_CANCEL_OPTION, null, null, null);
optionPane.setBorder(new EmptyBorder(12, 12, 12, 12));
final JDialog dialog = optionPane.createDialog(frame, "Create New Partition Clock Model");
dialog.pack();
dialog.setVisible(true);
int result = JOptionPane.CANCEL_OPTION;
Integer value = (Integer) optionPane.getValue();
if (value != null && value != -1) {
result = value;
}
return result;
}
use of javax.swing.border.EmptyBorder in project beast-mcmc by beast-dev.
the class SelectModelDialog method showDialog.
public int showDialog(Object[] models) {
modelCombo.removeAllItems();
for (Object model : models) {
modelCombo.addItem(model);
}
JOptionPane optionPane = new JOptionPane(optionPanel, JOptionPane.QUESTION_MESSAGE, JOptionPane.OK_CANCEL_OPTION, null, null, null);
optionPane.setBorder(new EmptyBorder(12, 12, 12, 12));
final JDialog dialog = optionPane.createDialog(frame, "Create New Model");
dialog.pack();
dialog.setVisible(true);
int result = JOptionPane.CANCEL_OPTION;
Integer value = (Integer) optionPane.getValue();
if (value != null && value != -1) {
result = value;
}
return result;
}
use of javax.swing.border.EmptyBorder in project beast-mcmc by beast-dev.
the class InputFileSettingsDialog method showDialog.
public int showDialog(InputFile inputFile) {
this.inputFile = inputFile;
setupPanel(inputFile);
final JOptionPane optionPane = new JOptionPane(optionPanel, JOptionPane.QUESTION_MESSAGE, JOptionPane.OK_CANCEL_OPTION, null, null, null);
optionPane.setBorder(new EmptyBorder(12, 12, 12, 12));
final JDialog dialog = optionPane.createDialog(frame, "Edit Input File Settings");
dialog.pack();
int result = JOptionPane.CANCEL_OPTION;
dialog.setVisible(true);
Integer value = (Integer) optionPane.getValue();
if (value != null && value != -1) {
result = value;
}
return result;
}
use of javax.swing.border.EmptyBorder in project beast-mcmc by beast-dev.
the class StatisticsPanel method createStatistic.
public TreeSummaryStatistic createStatistic(TreeSummaryStatistic.Factory factory) {
if (!factory.allowsTaxonList() && !factory.allowsDouble() && !factory.allowsInteger() && !factory.allowsString()) {
return factory.createStatistic();
}
OptionsPanel optionPanel = new OptionsPanel();
optionPanel.addSpanningComponent(new JLabel(factory.getSummaryStatisticDescription()));
final JRadioButton wholeTreeRadio = new JRadioButton("For the whole tree", false);
final JRadioButton taxonSetRadio = new JRadioButton("Using a given taxon set", false);
final JComboBox taxonSetCombo = new JComboBox();
final JTextField valueField;
if (factory.allowsTaxonList()) {
for (Object taxonSet : treeStatData.taxonSets) {
taxonSetCombo.addItem(taxonSet);
}
ButtonGroup group = new ButtonGroup();
ItemListener listener = new ItemListener() {
public void itemStateChanged(ItemEvent e) {
taxonSetCombo.setEnabled(taxonSetRadio.isSelected());
}
};
if (factory.allowsWholeTree()) {
group.add(wholeTreeRadio);
wholeTreeRadio.addItemListener(listener);
optionPanel.addSpanningComponent(wholeTreeRadio);
optionPanel.addSeparator();
}
if (factory.allowsTaxonList()) {
group.add(taxonSetRadio);
taxonSetRadio.addItemListener(listener);
optionPanel.addSpanningComponent(taxonSetRadio);
optionPanel.addComponentWithLabel("Taxon Set: ", taxonSetCombo);
optionPanel.addSeparator();
}
if (factory.allowsTaxonList()) {
taxonSetRadio.setSelected(true);
}
if (factory.allowsWholeTree()) {
wholeTreeRadio.setSelected(true);
}
}
if (factory.allowsDouble() || factory.allowsInteger() || factory.allowsString()) {
if (factory.allowsDouble()) {
valueField = new RealNumberField();
valueField.setColumns(12);
optionPanel.addComponentWithLabel(factory.getValueName(), valueField);
} else if (factory.allowsInteger()) {
valueField = new WholeNumberField();
valueField.setColumns(12);
optionPanel.addComponentWithLabel(factory.getValueName(), valueField);
} else {
// allowsString
valueField = new JTextField();
valueField.setColumns(24);
optionPanel.addComponentWithLabel(factory.getValueName(), valueField);
}
} else {
valueField = null;
}
JOptionPane optionPane = new JOptionPane(optionPanel, JOptionPane.QUESTION_MESSAGE, JOptionPane.OK_CANCEL_OPTION, null, null, null);
optionPane.setBorder(new EmptyBorder(12, 12, 12, 12));
JDialog dialog = optionPane.createDialog(frame, factory.getSummaryStatisticName());
// dialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
dialog.pack();
dialog.setVisible(true);
if (optionPane.getValue() == null) {
return null;
}
int result = (Integer) optionPane.getValue();
if (result == -1 || result == JOptionPane.CANCEL_OPTION) {
return null;
}
TreeSummaryStatistic statistic = factory.createStatistic();
if (wholeTreeRadio.isSelected()) {
statistic = factory.createStatistic();
} else if (taxonSetRadio.isSelected()) {
TreeStatData.TaxonSet t = (TreeStatData.TaxonSet) taxonSetCombo.getSelectedItem();
Taxa taxa = new Taxa();
taxa.setId(t.name);
//Iterator iter = t.taxa.iterator();
for (Object aTaxa : t.taxa) {
String id = (String) aTaxa;
Taxon taxon = new Taxon(id);
taxa.addTaxon(taxon);
}
statistic.setTaxonList(taxa);
} else {
return null;
}
if (factory.allowsDouble()) {
assert valueField instanceof RealNumberField;
Double value = ((RealNumberField) valueField).getValue();
statistic.setDouble(value);
} else if (factory.allowsInteger()) {
assert valueField instanceof WholeNumberField;
Integer value = ((WholeNumberField) valueField).getValue();
statistic.setInteger(value);
} else if (factory.allowsString()) {
String value = valueField.getText();
statistic.setString(value);
}
return statistic;
}
Aggregations