//TH-Header //***************************************************************************************** // Copyright (c) 2024 Antwise Solutions // All rights reserved. // // $FileName : SyncFusion\AppSrc\csfWebBaseControl.pkg // $ProjectName : SyncFusion Library // $Authors : Wil van Antwerpen // $Created : 2024-05-30 // // Contents: // This is a web framework wrapper base class for the SyncFusion controls. // // //***************************************************************************************** //TH-RevisionStart // ******************** // MODIFICATION SUMMARY // ******************** // ####### DD/MM/YYYY WHO COMMENT //TH-RevisionEnd Use cWebBaseControl.pkg Use cJsonObject.pkg { OverrideProperty=psLabel Visibility=Private } { OverrideProperty=psLabelColor Visibility=Private } { OverrideProperty=peLabelAlign Visibility=Private } { OverrideProperty=peLabelPosition Visibility=Private } { OverrideProperty=piLabelOffset Visibility=Private } { OverrideProperty=psBackgroundColor Visibility=Private } { OverrideProperty=psTextColor Visibility=Private } { OverrideProperty=pbShowLabel InitialValue=False } { DesignerClass=cDTCWebObject } { DesignerJSClass=df.WebDesignerControl } Class csfWebBaseControl is a cWebBaseControl Procedure Construct_Object Forward Send Construct_Object // // If set then it determines the height of the Control. If equal to C_WebDefault then it uses the height as // automatically determined. { InitialValue=300 } // only as a hint for the designer { WebProperty=Client } Property Integer piHeight C_WebDefault // // If set then it determines the width of the Control. If equal to C_WebDefault then it uses the width as // automatically determined. { WebProperty=Client } Property Integer piWidth C_WebDefault // Private properties used for configuring the Control. { WebProperty=Client } Property String psSyncfusionLicense "" Set pbShowLabel to False // By default do not show a label End_Procedure Procedure InitializeDefaults Send ClientAction "initializeDefaults" End_Procedure Procedure LicenseComponent String sLicenseKey Get SyncFusionLicenseKey Of ghoApplication To sLicenseKey Set psSyncfusionLicense to sLicenseKey End_Procedure Procedure LogConsole String sParam String[] aParams tWebValueTree tVT Move sParam To aParams[0] Send ClientAction "logConsole" aParams tVT End_Procedure // This function breaks the json data up in a string array. // This circumvents the string array size for almost all cases as each array item // can take up to 64k. // Earlier on we did this via a simple UChar array, but we had problems with utf8 to oem // encoding issues and strangely it wasn't as performant either. Function JsonDataToStringArray Handle hoJSON Returns String[] Boolean bOK Integer iRow Integer iCount Handle hoRow String sRow String[] Data If (hoJSON<>0) Begin Get IsOfJsonType of hoJson jsonTypeArray to bOK If (bOK) Begin Move '[ ' to Data[SizeOfArray(Data)] Get MemberCount of hoJSON to iCount For iRow from 0 to (iCount-1) Get MemberByIndex of hoJSON iRow to hoRow Get IsOfJsonType of hoRow jsonTypeObject to bOK If (bOK) Begin Get Stringify of hoRow to sRow If (iRow<(iCount-1)) Begin Move (sRow+", ") to sRow End Move sRow to Data[SizeOfArray(Data)] Send Destroy of hoRow End Loop Move " ]" to Data[SizeOfArray(Data)] End Else Begin Send UserError "The JSON data is not an array." End End Function_Return Data End_Function Procedure End_Construct_Object Send LicenseComponent Forward Send End_Construct_Object End_Procedure End_Class