/*
 *  Copyright 2001-2013 Stephen Colebourne
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
package org.joda.beans.ui.swing.type;

import org.joda.beans.Bean;
import org.joda.beans.ui.form.MetaUIComponent;
import org.joda.beans.ui.swing.SwingUIComponent;
import org.joda.beans.ui.swing.SwingUISettings;
import org.joda.beans.ui.swing.component.JValidatedTextField;
import org.joda.beans.ui.swing.component.JValidatedTextFields;

/**
 * An instantiated Swing component for floating point numerics.
 */
public class FloatingSwingUIComponent extends SwingUIComponent<JValidatedTextField> {

    /**
     * Meta-component additional field.
     * True to allow NaN, false to disallow NaN.
     */
    private static final String ALLOW_NAN = "allowNaN";

    /**
     * Creates an instance.
     * 
     * @param metaComponent  the meta-component, not null
     */
    public FloatingSwingUIComponent(MetaUIComponent metaComponent) {
        super(metaComponent);
        Boolean allowNan = (Boolean) metaComponent.getAdditional().get(ALLOW_NAN);
        Class<?> type = metaComponent.getPropertyType();
        JValidatedTextField component;
        if (type == Double.class || type == Double.TYPE) {
            component = JValidatedTextFields.createDoubleTextField(
                    metaComponent.isMandatory(), allowNan != null && allowNan.booleanValue(),
                    metaComponent.getMinValue(Double.NEGATIVE_INFINITY).doubleValue(),
                    metaComponent.getMaxValue(Double.POSITIVE_INFINITY).doubleValue());
        } else if (type == Float.class || type == Float.TYPE) {
            component = JValidatedTextFields.createFloatTextField(
                    metaComponent.isMandatory(), allowNan != null && allowNan.booleanValue(),
                    metaComponent.getMinValue(Float.NEGATIVE_INFINITY).floatValue(),
                    metaComponent.getMaxValue(Float.POSITIVE_INFINITY).floatValue());
        } else {
            throw new IllegalArgumentException("Unknown type: " + type);
        }
        setComponent(component);
    }

    //-------------------------------------------------------------------------
    @Override
    public void updateUI(Bean bean) {
        String text = getMetaProperty().getString(bean, SwingUISettings.INSTANCE.getStringConvert());
        getComponent().setText(text);
    }

}

@@ -2818,24 +2818,126 @@
 Convert());%0A
+        if (text.endsWith(%22.0%22)) %7B%0A            text = text.substring(0, text.length() - 2);%0A        %7D%0A
         getC

Remove trailing dot zero from floating point types