From b0b63b80003593e8e57dbe146f098e3b2a57c168 Mon Sep 17 00:00:00 2001 From: bowring Date: Sun, 22 Mar 2015 09:29:59 -0400 Subject: [PATCH] constrained view of values and uncertainties to BigDecimal scale 15 --- .../UPb_Redux/valueModelViews/AbstractValueModelView.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/earthtime/UPb_Redux/valueModelViews/AbstractValueModelView.java b/src/main/java/org/earthtime/UPb_Redux/valueModelViews/AbstractValueModelView.java index e404930d..a0201049 100644 --- a/src/main/java/org/earthtime/UPb_Redux/valueModelViews/AbstractValueModelView.java +++ b/src/main/java/org/earthtime/UPb_Redux/valueModelViews/AbstractValueModelView.java @@ -27,6 +27,7 @@ import java.awt.event.FocusEvent; import java.awt.event.FocusListener; import java.math.BigDecimal; +import java.math.RoundingMode; import javax.swing.JLabel; import javax.swing.JLayeredPane; import javax.swing.JTextField; @@ -120,7 +121,7 @@ public AbstractValueModelView ( ValueModel valueModel ) { */ protected void initTextBoxes ( boolean editable ) { valueTextBox.setDocument( new DialogEditor.BigDecimalDocument( valueTextBox, editable ) ); - valueTextBox.setText( valueModel.getValue().toString() ); + valueTextBox.setText( valueModel.getValue().setScale(15, RoundingMode.HALF_UP).toPlainString() ); uncertaintyTextBox.setDocument( new DialogEditor.BigDecimalDocument( uncertaintyTextBox, editable ) ); @@ -173,9 +174,9 @@ public void focusLost ( FocusEvent e ) { private void displayOneSigmaPerMode () { if ( isShowOneSigmaAsPerCent() ) { - uncertaintyTextBox.setText( valueModel.getOneSigmaPct().toString() ); + uncertaintyTextBox.setText( valueModel.getOneSigmaPct().setScale(15, RoundingMode.HALF_UP).toPlainString() ); } else { - uncertaintyTextBox.setText( valueModel.getOneSigmaAbs().toString() ); + uncertaintyTextBox.setText( valueModel.getOneSigmaAbs().setScale(15, RoundingMode.HALF_UP).toPlainString() ); } }