Package reportgen.math.constants.doubleval

Source Code of reportgen.math.constants.doubleval.DoubleContextGroup

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

package reportgen.math.constants.doubleval;

import java.awt.Window;
import reportgen.prototype.context.Context;
import reportgen.prototype.context.group.ContextGroup;
import reportgen.prototype.context.group.ContextGroupTitled;
import reportgen.prototype.context.group.ExpressionEditorPanel;
import reportgen.math.constants.MathExpressionTxtValuePanel;
import reportgen.math.constants.doubleval.MathExpressionConstValueDouble;

/**
*
* @author axe
*/
public class DoubleContextGroup extends ContextGroupTitled<MathExpressionConstValueDouble> {

    public DoubleContextGroup() {
        super(ContextGroup.CONSTANT, "Вещественное число");
    }

    @Override
    public ExpressionEditorPanel getPanel(Window parent, final Context context,
            final MathExpressionConstValueDouble expression) {

        return new MathExpressionTxtValuePanel<MathExpressionConstValueDouble>(expression) {
            @Override
            protected MathExpressionConstValueDouble initNew(String str) {
                return new MathExpressionConstValueDouble(Double.parseDouble(str), context);
            }

            @Override
            protected String getString(MathExpressionConstValueDouble exp) {
                return exp.getValue().toString();
            }

            @Override
            protected void update(String str) {
                me.setValue(Double.parseDouble(str));
            }

        };
    }
}
TOP

Related Classes of reportgen.math.constants.doubleval.DoubleContextGroup

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.