Skip to content

Commit

Permalink
Added error reporting to logcombiner: closes #422.
Browse files Browse the repository at this point in the history
  • Loading branch information
tgvaughan committed Sep 20, 2015
1 parent 9bf4fca commit a109718
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/beast/app/tools/LogCombiner.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ private void parseArgs(String[] args) throws Exception {
i += 2;
} else if (args[i].equals("-b") || args[i].equals("-burnin") || args[i].equals("--burnin")) {
m_nBurninPercentage = Integer.parseInt(args[i + 1]);
if (m_nBurninPercentage < 0 || m_nBurninPercentage > 100) {
System.err.println("Error: Burn-in percentage must be between 0 and 100.");
System.exit(1);
}
i += 2;
} else if (args[i].equals("-n")) {
m_nParticles = Integer.parseInt(args[i + 1]);
Expand Down
12 changes: 10 additions & 2 deletions src/beast/app/tools/LogCombinerDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@ public LogCombinerDialog(final JFrame frame, String titleString, Icon icon) {
filesTable.getColumnModel().getColumn(0).setPreferredWidth(120);
filesTable.getColumnModel().getColumn(0).setPreferredWidth(80);

TableEditorStopper.ensureEditingStopWhenTableLosesFocus(filesTable);
// This causes superfluous TabelModel.setValue events to fire.
// Is this still needed? I guess we'll see...
//TableEditorStopper.ensureEditingStopWhenTableLosesFocus(filesTable);

filesTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
public void valueChanged(ListSelectionEvent evt) {
Expand Down Expand Up @@ -362,7 +364,13 @@ public boolean isCellEditable(int rowIndex, int columnIndex) {
public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
FileInfo fileInfo = files.get(rowIndex);
if (columnIndex == 1) {
fileInfo.burnin = (Integer) aValue;
int newBurnin = (int)aValue;
if (newBurnin<0 || newBurnin>100)
JOptionPane.showMessageDialog(frame,
"Burn-in percentage must be between 0 and 100.",
"Error", JOptionPane.ERROR_MESSAGE);
else
fileInfo.burnin = newBurnin;
}
}

Expand Down

0 comments on commit a109718

Please sign in to comment.