@Test public void textWithoutPercentSignIsValid() { BigDecimalPM pm = new BigDecimalPM(); pm.setFormat(new BigDecimalPM.Format(new DecimalFormat("#.##%"))); String input = "10"; pm.setText(input); assertEquals("pm.isValid()", true, pm.isValid()); }
public void setFormat(IFormat<BigDecimal> newFormat) { if (newFormat == null) { throw new IllegalArgumentException("newFormat == null"); } IFormat<BigDecimal> oldFormat = format; if (oldFormat == newFormat) { return; } boolean doReformat; BigDecimal oldValue = null; try { oldValue = getBigDecimal(); doReformat = true; } catch (ConversionException ex) { doReformat = false; } format = newFormat; revalidate(); getPropertyChangeSupport().firePropertyChange("format", oldFormat, newFormat); if (doReformat) { setBigDecimal(oldValue); } }
BigDecimalPM extends TextPM implements IBigDecimalPM { public void setFormat(IFormat<BigDecimal> newFormat) { if (newFormat == null) { throw new IllegalArgumentException("newFormat == null"); } IFormat<BigDecimal> oldFormat = format; if (oldFormat == newFormat) { return; } boolean doReformat; BigDecimal oldValue = null; try { oldValue = getBigDecimal(); doReformat = true; } catch (ConversionException ex) { doReformat = false; } format = newFormat; revalidate(); getPropertyChangeSupport().firePropertyChange("format", oldFormat, newFormat); if (doReformat) { setBigDecimal(oldValue); } } }
BigDecimalPM extends TextPM implements IBigDecimalPM { public void setFormat(IFormat<BigDecimal> newFormat) { if (newFormat == null) { throw new IllegalArgumentException("newFormat == null"); } IFormat<BigDecimal> oldFormat = format; if (oldFormat == newFormat) { return; } boolean doReformat; BigDecimal oldValue = null; try { oldValue = getBigDecimal(); doReformat = true; } catch (ConversionException ex) { doReformat = false; } format = newFormat; revalidate(); getPropertyChangeSupport().firePropertyChange("format", oldFormat, newFormat); if (doReformat) { setBigDecimal(oldValue); } } BigDecimalPM(); }
BigDecimalPM extends TextPM implements IBigDecimalPM { public void setFormat(IFormat<BigDecimal> newFormat) { if (newFormat == null) { throw new IllegalArgumentException("newFormat == null"); } IFormat<BigDecimal> oldFormat = format; if (oldFormat == newFormat) { return; } boolean doReformat; BigDecimal oldValue = null; try { oldValue = getBigDecimal(); doReformat = true; } catch (ConversionException ex) { doReformat = false; } format = newFormat; revalidate(); getPropertyChangeSupport().firePropertyChange("format", oldFormat, newFormat); if (doReformat) { setBigDecimal(oldValue); } } BigDecimalPM(); @Override void reformat(); IFormat<BigDecimal> getFormat(); void setFormat(IFormat<BigDecimal> newFormat); void setBigDecimal(BigDecimal value); BigDecimal getBigDecimal(); void setDefaultBigDecimal(BigDecimal value); void setBigInteger(BigInteger value); BigInteger getBigInteger(); void setDefaultBigInteger(BigInteger value); @Override Comparable<?> getComparable(); }
BigDecimalPM extends TextPM implements IBigDecimalPM { public void setFormat(IFormat<BigDecimal> newFormat) { if (newFormat == null) { throw new IllegalArgumentException("newFormat == null"); } IFormat<BigDecimal> oldFormat = format; if (oldFormat == newFormat) { return; } boolean doReformat; BigDecimal oldValue = null; try { oldValue = getBigDecimal(); doReformat = true; } catch (ConversionException ex) { doReformat = false; } format = newFormat; revalidate(); getPropertyChangeSupport().firePropertyChange("format", oldFormat, newFormat); if (doReformat) { setBigDecimal(oldValue); } } BigDecimalPM(); @Override void reformat(); IFormat<BigDecimal> getFormat(); void setFormat(IFormat<BigDecimal> newFormat); void setBigDecimal(BigDecimal value); BigDecimal getBigDecimal(); void setDefaultBigDecimal(BigDecimal value); void setBigInteger(BigInteger value); BigInteger getBigInteger(); void setDefaultBigInteger(BigInteger value); @Override Comparable<?> getComparable();  }