Presentation is loading. Please wait.

Presentation is loading. Please wait.

JukeBox – transparency, flexibility, speed and comfort!

Similar presentations


Presentation on theme: "JukeBox – transparency, flexibility, speed and comfort!"— Presentation transcript:

1 JukeBox – transparency, flexibility, speed and comfort!
Brynjar Hasle, Chemistry as

2 Operational (business) requirements:
The client should be in charge of the server Slick UI Exceptional development speed (low, that is) Transparency client-server / appserver No extra setup required Very small client footprint

3 Tools: Dynamic 4GL (9.1d+) Static 4GL (Stateless AppServer (9.1d+)) (Aia client on webserver) - Progress 8.x - 9.1/10.0a RDBMS

4 Basic Elements x.w y.w z.w UI_lib.p AS_lib.p
Client: x.w y.w z.w UI_lib.p AS_lib.p Server: Get data: -gettemptablejoin.p -getfieldlist.p getfieldvalues.p (FIND) -gettemptable (input <fill>.p) -checkcurrentchanged.p .. Put data: -servertrans.p -runproc.p ..

5 Server, get data: - gettemptablejoin.p: Input: - Buffers and fields Query criteria Startrow and number of rows to return Hooks for calculated fields (input .p’s for logic) Returns temp-table handle (and hence the data) getfieldlist.p: Input: - Buffers and fields Query criteria Returns fieldlist (f.ex to populate drop-down) - gettemptable.p (input .p, output temp-table handle)

6 Server, put data: - servertrans.p: Input: - Trans header and trans values Temp-table struct Dynamic FK validation Hooks for custom validation / updates Assign defaults Returns completed temp-table (option) Trans.header: Buffer Operation Field list Opt.val.proc Trans.values: - Field value list

7 AS_lib, main methods: - GetTempTableJoin( Input: List of buffers and fields, rows-to-batch,startrow and query criteria). Checks for appserver / client server and passes on the input parameters pluss sessionid to gettemptablejoin.p - DoCreate(Input buffer,fields and values). - DoUpdate(Input buffer,criteria,fields and values). DoDelete(Input buffer,criteria). Populate transaction temp-tables. - DoCommit(true/false). Checks for appserver and passes transaction temp-tables to servertrans.p. True/False: receive completed buffer back

8 UI_lib: Implements standard events
and methods. Keeps run-time state for UI objects. ”Objects”: NewBrowse(..) -NewQuery(..) -NewFieldMap(..) (browse buffer pluss add. ttObject ttEvent ttObjectLink ttAttribute info on input/display fields) -NewToolbar(..) -NewBrowseDropDown(..) -NewBrowseFillIn(..) -NewFilter(..) .. Standard methods: DisplayRecord, SaveRecord, OpenQuery,etc.

9 Additional handy stuff:
- ResizeLib.p - Dynamic lookup - src/adm2/dyntreeview.w (slightly altered) - from smartpak/adm2/cal.w (altered) - Microsoft OCX tab-folder -

10 Coding example: Rectangles are used to represent screen objects that are created. In this example a toolbar and a browser. All relevant code for this simple window is in one procedure, InitWindow. Only the libraries (AS,UI and Resize are supporting this .w file – no includes).

11 Procedure InitWindow:
DO WITH FRAME {&FRAME-NAME}: hBrowse = DYNAMIC-FUNCTION("NewBrowse", /* Create a browse object (New!) */ rectBrowse:HANDLE, /* Rectangle to define coordinates for browse */ 100, /* Rows to batch */ "", /* Browse properties, ie MULTIPLE,NUM-LOCKED-COLUMNS, etc */ "pccMemberShipType;MemberShipTypeName;MemberShipTypeCost", /* Buffers and fields: <buffer1>;<field1>;<field2>..,<buffer2>;.. No fields gives all*/ "WHERE iCompanyId = " + STRING(DYNAMIC-FUNCTION("getCompanyId")), "") /* Misc - for something I might need in next version.. */ hFieldMap = DYNAMIC-FUNCTION("NewFieldMap", /* A fieldmap object holds extra info for display and input fields (fill-ins) and their corresponding buffer columns return handle equals the buffer handle */ hBrowse:QUERY, FRAME {&FRAME-NAME}:HANDLE, /* Frame for the input/display fields (might not be the same frame as the browse) */ "MemberShipTypeName,MemberShipTypeCost", /* Update columns in buffer */ "MemberShipTypeName,MemberShipTypeCost", /* Corresponding input fields (fill-in..)*/ "","", /* Additional buffer and displ.fields - not updateable*/ "") /* Additional input fields (not in buffer) */ /* Assign foreign key values (not selected by the user): */ DYNAMIC-FUNCTION("setAttribute",hFieldMap,"bufferextrafields","iCompanyId"). DYNAMIC-FUNCTION("setAttribute",hFieldMap,"bufferextravalues",STRING(DYNAMIC-FUNCTION("getCompanyId"))). DYNAMIC-FUNCTION("NewToolBar", rectTBfile:HANDLE, /* Rectangle to define coordinates for toolbar */ "Fil", /* Corresponding menu label - no menu if blank */ "new;Ny,undo;Angre,delete;Slett,save;Lagre,excel;Eksporter til Excel", /* Buttons / Menu items: action;label;tooltip;Method;image,action;label.. Any number of properties accepted (one ok - if predef. action) */ "maxborder") /* View and expand border rectangle to span frame */ DYNAMIC-FUNCTION("LinkAllObjects", /* Link all created objects. Linktype is type of "to" object, f.ex link from browse to combo-box is combo-box link */ THIS-PROCEDURE:CURRENT-WINDOW, /* Link only objects created for current window */ TRUE, /* Replace any existing links */ "") /* Except these objects – list of handles */ DYNAMIC-FUNCTION("setCompanyHeader",THIS-PROCEDURE:CURRENT-WINDOW). /* The application should supports multiple companies */ DYNAMIC-FUNCTION("setNoResizeY", THIS-PROCEDURE:CURRENT-WINDOW, FRAME {&FRAME-NAME}:HANDLE, "rectTBfile"). DYNAMIC-FUNCTION("setOrgWinSize", THIS-PROCEDURE:CURRENT-WINDOW,200,250,0,250). DYNAMIC-FUNCTION("initTranslation",THIS-PROCEDURE:CURRENT-WINDOW). APPLY "value-changed" TO hBrowse. /* Since the query is opened we want to display the first record */ END.

12 Run the window:

13 Same window again: ..this time translated, resized and with different BG-color Resize and color settings can be stored pr window pr user

14 What happened? InitWindow NewBrowse (.w)
NewBrowse (UI_lib): 1:Ask for data and def 2: Create browser GetTT (AS_lib): - Check for appserver (reconnect if needed) - Create and populate TT, - Run additioaln. calc - Return TT-handle (get_tt.p)

15 Organizing server logic
Very few access points (in AS_lib) for server logic: Generic GetTempTableJoin Generic GetFieldList Generic GetFieldValue(s) - FIND RunProc, input ”mysimple.p” + custom params: character string (for fields and values) optional temp-table GetTempTable (from anothersimple.p) Always pass on the sessionid to all server routines!

16 Using runproc Update cred.limit for these customers (.w)
- List of customers - Field/value - ”customer_update_records.p” RunProc (AS_lib): - Check for appserver (reconnect if needed) Jbox_runproc.p - Validate session - run .p Customer_update_record.p

17


Download ppt "JukeBox – transparency, flexibility, speed and comfort!"

Similar presentations


Ads by Google