Skip to content

Commit

Permalink
constrained view of values and uncertainties to BigDecimal scale 15
Browse files Browse the repository at this point in the history
  • Loading branch information
bowring committed Mar 22, 2015
1 parent fd38caa commit b0b63b8
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 ) );

Expand Down Expand Up @@ -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() );
}

}
Expand Down

0 comments on commit b0b63b8

Please sign in to comment.