Tuesday, 16 July 2013

UI Builder Class

Trans type                        :  [   box]
sub code(transsubtype)   :  [   box]
Depending on selection of transaction type field the lookup change in subcode field
public class EmpTransUIBuilder extends SysOperationAutomaticUIBuilder
{
    DialogField dialogSubcode;
    DialogField dialogTransType;

    EmpTransactionContract contract;
}

public void build()
{
    Dialog      dialogLocal = this.dialog();
    EmpTransactionContract contractLocal = this.dataContractObject();

    //dialogLocal.addGroup(“Parameters”);
    this.addDialogField(methodStr(EmpTransactionContract,parmTransType), contractLocal);
    this.addDialogField(methodStr(EmpTransactionContract,parmTransSubCode), contractLocal);

}


public void getFromDialog()
{
    contract = this.dataContractObject();
    super();
}
public void initializeFields()
{
    contract = this.dataContractObject();
}

public void lookupSubCode(FormStringControl _control)
{
    Query query = new Query();
    SysTableLookup sysTablelookup;

    sysTablelookup =SysTableLookup::newParameters(tableNum(NSGEmplSubTrans),_control);
    sysTablelookup.addLookupfield(fieldNum(NSGEmplSubTrans,TransSubType));
    sysTablelookup.addLookupfield(fieldnum(NSGEmplSubTrans,DescriptionE));
    sysTablelookup.addLookupfield(fieldnum(NSGEmplSubTrans,DescriptionA));

    query.addDataSource(tableNum(NSGEmplSubTrans));
    query.dataSourceTable(tableNum(NSGEmplSubTrans)).addRange(fieldNum(NSGEmplSubTrans, TransType)).value(queryValue(dialogTransType.value()));

    sysTablelookup.parmQuery(query);
    sysTablelookup.performFormLookup();
}
public void postBuild()
{
    ;
    super();
    dialogTransType = this.bindInfo().getDialogField(
                         this.dataContractObject(),
                         methodStr(EmpTransactionContract,parmTransType));
    // register override method for lookup customer
    //dialogSubcode.registerOverrideMethod(methodStr(FormStringControl, lookup), methodStr(EmpTransUIBuilder, lookupSubCode), this);
   // if (dialogSubcode)
   // {
   //     dialogSubcode.lookupButton(2);
   // }
    dialogSubcode = this.bindInfo().getDialogField(
                         this.dataContractObject(),
                         methodStr(EmpTransactionContract,parmTransSubCode));

    // register override method for lookup customer
    dialogSubcode.registerOverrideMethod(methodStr(FormStringControl, lookup),methodStr(EmpTransUIBuilder, lookupSubCode), this);
    if (dialogSubcode)
    {
        dialogSubcode.lookupButton(2);
    }

}
public void postRun()
{
    super();
}
public boolean transTypeModified(FormStringControl _control)
{
    dialogTransType.value(_control.valueStr());
    dialogSubcode.value(”);
    return true;
}


No comments:

Post a Comment