package com.jxml.quick.editors;

import java.beans.PropertyEditorSupport;
import java.math.BigDecimal;

/**
 * A PropertyEditor for java.math.BigDecimal values.
 * <p>by Pavel Curtis--Quick 1.1
 */
public class BigDecimalEditor extends PropertyEditorSupport {
    public String getJavaInitializationString() {
	return "new java.math.BigDecimal(\"" + getAsText() + "\"";
    }

    public void setAsText(String value) throws IllegalArgumentException {
	try {
	    setValue(new BigDecimal(value));
	} catch (NumberFormatException e) {
	    throw new IllegalArgumentException(e.toString());
	}
    }
}
