UI Builder Class :
class ICDOCCollectorInformationUIBuilder extends SrsReportDataContractUIBuilder
{
}
public void
lookupDimensionAttribute(FormStringControl /*_formControl*/_control,
str _filterStr)
{
Query query;
SysTableLookup sysTableLookup;
sysTableLookup =
SysTableLookup::newParameters(tableNum(CollectorInformation),
_control);
// Add name
field to be shown in the lookup form.
sysTableLookup.addLookupfield(fieldNum(CollectorInformation, AgentCode));
sysTableLookup.addLookupfield(fieldNum(CollectorInformation, Employee));
sysTableLookup.addLookupfield(fieldNum(CollectorInformation, Name));
// Add the
dimension attribute table as data source.
query = new
Query();
query.addDataSource(tableNum(CollectorInformation));
sysTableLookup.parmQuery(query);
// Perform the
lookup.
sysTableLookup.performFormLookup();
}
public void
postBuild()
{
DialogField dimensionAttribute;
super();
// From
binding info, get the dialog field for dimension attribute and add button
dimensionAttribute =
this.bindInfo().getDialogField(
this.dataContractObject(),
methodStr(ICDOCCollectorInformationContract,
parmAgentCode));
dimensionAttribute.label("Collector");
if
(dimensionAttribute)
{
dimensionAttribute.lookupButton(2);
}
}
public void
postRun()
{
Dialog
dialogLocal = this.dialog();
DialogField dialogField;
super();
// This method
should be called in order to handle events on dialogs.
dialogLocal.dialogForm().formRun().controlMethodOverload(false);
// Override
the lookup for parmDimensionAttribute contract parameter with
dimensionAttributeLookup of this class.
dialogField = this.bindInfo().getDialogField(
this.dataContractObject(),
methodStr(ICDOCCollectorInformationContract,
parmAgentCode));
dialogField.registerOverrideMethod(
methodStr(FormStringControl,
lookup),
methodStr(ICDOCCollectorInformationUIBuilder,
lookupDimensionAttribute),
this);
}
class ProjHourUtilisationUIBuilder extends SysOperationAutomaticUIBuilder
{
ProjHourUtilisationContract
projHourUtilisationContract;
DialogField dialogCategory;
DialogField dialogProject;
DialogField dialogEmployee;
DialogField fromDate;
DialogField toDate;
}
public void build()
{
Dialog dialogLocal = this.dialog();
projHourUtilisationContract =
this.dataContractObject();
this.addDialogField(methodStr(ProjHourUtilisationContract,parmProjectId),
projHourUtilisationContract);
this.addDialogField(methodStr(ProjHourUtilisationContract,parmCategory),
projHourUtilisationContract);
this.addDialogField(methodStr(ProjHourUtilisationContract,parmEmployeeId),
projHourUtilisationContract);
this.addDialogField(methodStr(projHourUtilisationContract,parmFromDate),projHourUtilisationContract);
this.addDialogField(methodStr(projHourUtilisationContract,parmToDate),projHourUtilisationContract);
}
public void getFromDialog()
{
projHourUtilisationContract =
this.dataContractObject();
super();
}
public void initializeFields()
{
projHourUtilisationContract =
this.dataContractObject();
}
public void lookupCategory(FormStringControl
_control)
{
Query query = new Query();
SysTableLookup sysTablelookup;
sysTablelookup
=SysTableLookup::newParameters(tableNum(ProjCategory),_control);
sysTablelookup.addLookupfield(fieldNum(ProjCategory,CategoryId));
sysTablelookup.addLookupfield(fieldnum(ProjCategory,Name));
sysTablelookup.addLookupfield(fieldnum(ProjCategory,CategoryType));
query.addDataSource(tableNum(ProjCategory));
query.dataSourceTable(tableNum(ProjCategory)).addRange(fieldNum(ProjCategory,
CategoryType)).value(queryValue(ProjCategoryType::Hour));
sysTablelookup.parmQuery(query);
sysTablelookup.performFormLookup();
}
public void postRun()
{
Dialog dialogLocal = this.dialog();
super();
// This
method should be called in order to handle events on dialogs.
dialogLocal.dialogForm().formRun().controlMethodOverload(false);
}
public void postBuild()
{
;
super();
dialogCategory =
this.bindInfo().getDialogField(
this.dataContractObject(),
methodStr(ProjHourUtilisationContract,parmCategory));
//
register override method for lookup customer
dialogCategory.registerOverrideMethod(methodStr(FormStringControl,
lookup), methodStr(ProjHourUtilisationUIBuilder,lookupCategory),this);
dialogProject =
this.bindInfo().getDialogField(
this.dataContractObject(),
methodStr(ProjHourUtilisationContract,parmProjectId));
dialogEmployee =
this.bindInfo().getDialogField(
this.dataContractObject(),
methodStr(ProjHourUtilisationContract,parmEmployeeId));
fromDate =
this.bindInfo().getDialogField(
this.dataContractObject(),
methodStr(ProjHourUtilisationContract,parmFromDate));
toDate
=this.bindInfo().getDialogField(
this.dataContractObject(),
methodStr(ProjHourUtilisationContract,parmToDate));
}
Helpful!!!
ReplyDeleteThanks Abdul for this wonderful blog.
ReplyDelete