Package WindowTester

Source Code of WindowTester.MoneyDomain

package WindowTester;

import DisplayProject.binding.beans.Observable;
import Framework.DataValue;
import Framework.DecimalData;
import Framework.DecimalNullable;
import Framework.DomainDataValue;
import Framework.DoubleData;
import Framework.ExtendedProperties;
import Framework.NumericFormat;
import Framework.RuntimeProperties;
import Framework.TextData;
import java.io.Serializable;
import java.lang.String;
import org.apache.log4j.Logger;

/**
* MoneyDomain<p>
* <p>
* @author Generated from Forte
* @since  19-Nov-2008
*/
@RuntimeProperties(isDistributed=false, isAnchored=false, isShared=false, isTransactional=false)
@ExtendedProperties(values = {"DomainFormWidgetType=DataField","DomainFormDataFieldMaxCharacters=0","DomainFormDataFieldIsPassword=FALSE",
                              "DomainFormDataFieldValidateOnKeystroke=FALSE",
                              "DomainFormDataFieldMaskType=1",
                              "DomainFormDataFieldAlignment=128",
                              "DomainFormDataFieldHeightPolicy=1",
                              "DomainFormDataFieldMinHeightInMils=0",
                              "DomainFormDataFieldWidthPolicy=2",
                              "DomainFormDataFieldMinWidthInMils=0",
                              "DomainFormDataFieldMinHeightInRows=0",
                              "DomainFormDataFieldMinWidthInColumns=0",
                              "DomainFormDataFieldVisibleColumns=20",
                              "DomainFormDataFieldHelpTopic=",
                              "DomainFormDataFieldFloatOverText=",
                              "DomainFormDataFieldFloatOverTextMsgNum=0",
                              "DomainFormDataFieldFloatOverTextSetNum=0"})
@SuppressWarnings("serial")
public class MoneyDomain
        extends DecimalNullable
        implements Serializable, Observable, DomainDataValue
{

    // ----------
    // Attributes
    // ----------
    private NumericFormat fmt;

    // ------------
    // Constructors
    // ------------
    public MoneyDomain() {
        // Explicitly call the superclass constructor to prevent the implicit call
        super();

        this.fmt = new NumericFormat(new TextData("$#,##0.00"), NumericFormat.qq_Resolver.cTEMPLATE);

    }

    public enum qq_Resolver {
          cSCALE
    };

    public MoneyDomain(int pParam1, qq_Resolver pResolver) {
        this();
        if (pResolver == MoneyDomain.qq_Resolver.cSCALE) {
            this.setScale( pParam1 );
        }
    }

    public MoneyDomain(DecimalNullable pParam) {
        this();
        this.setValue(pParam);
    }

    public MoneyDomain(TextData pParam) {
        this();
        this.setValue(pParam);
    }

    public MoneyDomain(String pParam) {
        this();
        this.setValue(pParam);
    }

    public MoneyDomain(Number number) {
        this();
        this.setValue(number);
    }

    // ----------------------
    // Accessors and Mutators
    // ----------------------
    private void setFmt(NumericFormat fmt) {
        NumericFormat oldValue = this.fmt;
        this.fmt = fmt;
//        this.qq_Listeners.firePropertyChange("fmt", oldValue, this.fmt);
    }

    // -------
    // Methods
    // -------
    /**
     * fillString<p>
     * <p>
     * @param target Type: TextData
     */
    public void fillString(TextData target) {
        TextData aMsg = new TextData();
        aMsg.concat("fillString(").concat(target).concat(");");
        Logger.getLogger("task.part.logmgr").info(aMsg);

        super.fillString(target);

        if (target != null) {
            target.setValue( this.fmt.formatNumeric(new DoubleData(target.getDoubleValue())) );
        }
        else {
            target = new TextData();
        }

        aMsg.clear();
        aMsg.concat("end fillString(").concat(target).concat(");");
        Logger.getLogger("task.part.logmgr").info(aMsg);
    }

    /**
     * setFormat<p>
     * <p>
     * @param pShowCents Type: boolean
     */
    public void setFormat(boolean pShowCents) {
        if (pShowCents) {
            this.fmt = new NumericFormat(new TextData("$#,##0.00"), NumericFormat.qq_Resolver.cTEMPLATE);
        }
        else {
            this.fmt = new NumericFormat(new TextData("$#,##0"), NumericFormat.qq_Resolver.cTEMPLATE);
        }
    }

    /**
     * setScale<p>
     * <p>
     * @param scale Type: int
     */
    public void setScale(int scale) {
        return;
    }

    /**
     * setValue<p>
     * <p>
     * @param source Type: DecimalData
     */
    public void setValue(DecimalData source) {
        super.setValue(source);
    }

    /**
     * setValue<p>
     * <p>
     * @param source Type: DataValue
     */
    public void setValue(DataValue source) {
        super.setValue(source);
    }

    /**
     * setValue<p>
     * <p>
     * @param source Type: String
     */
    public void setValue(String source) {
        TextData aMsg = new TextData();
        aMsg.concat("SetValue(").concat(source).concat(");");
        Logger.getLogger("task.part.logmgr").info(aMsg);

        TextData aValue = new TextData(source);
        while (aValue.moveToNotChar("-.1234567890")) {
            aValue.replaceRange("", aValue.getOffset(), aValue.getOffset()+1);
        }

        aValue.setOffset(0);
        if (aValue.getActualSize() == 0) {
            aValue.setValue("0");
        }
        else {
            if (aValue.moveToChar(".")) {
                aValue = aValue.copyRange(0, aValue.getOffset()+3);
            }
        }

        super.setValue(aValue.getValue());
    }

    /**
     * setValue<p>
     * <p>
     * @param source Type: double
     */
    public void setValue(double source) {
        super.setValue(source);
    }
// end class MoneyDomain
// c Pass 2 Conversion Time: 312 milliseconds
TOP

Related Classes of WindowTester.MoneyDomain

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.