ECOB40 ;BP/CMF - Generic Table Print Object
;;2.0;EVENT CAPTURE;**100**;8 May 96;Build 21
;@author - Chris Flegel
;@date - 17 May 2009
;@version - 1.0
;;
Q
;; private methods
OUT(HANDLE,METHOD) ;
N RESULT
D METHOD(.RESULT,HANDLE_"."_METHOD)
Q RESULT
;;
ECOBL(RESULT,HANDLE,ARGUMENT) ; handler for the actual list object
N CHILD
D METHOD(.CHILD,HANDLE_".GetHeaders")
D METHOD^ECOBL(.RESULT,CHILD_"."_ARGUMENT)
Q
;;
N HDR,HDRNAME,HDRWIDTH,PAGE
W @IOF
S PAGE=$$OUT(HANDLE,"GetPage")
W !,$$CJ^XLFSTR($$OUT(HANDLE,"GetTableName"),IOM)
W !,$$CJ^XLFSTR($$FMTE^XLFDT($$NOW^XLFDT()),IOM)
W !,$$CJ^XLFSTR("Page: "_PAGE,IOM)
W !!
S HDR=$$OUT(HANDLE,"Headers.First")
F Q:HDR="-1^End of list" D
.S HDRNAME=$P(HDR,U)
.S HDRWIDTH=$P(HDR,U,2)
.W $$LJ^XLFSTR(HDRNAME,HDRWIDTH)
.S HDR=$$OUT(HANDLE,"Headers.Next")
.Q
S PAGE=PAGE+1
D OUT(HANDLE,"SetPage."_PAGE)
Q
;;
N PAGE
S PAGE=$$OUT(HANDLE,"GetPage")
W !!
W $$CJ^XLFSTR("Page: "_PAGE,IOM)
S PAGE=PAGE+1
D OUT(HANDLE,"SetPage."_PAGE)
Q
WIDTH(HANDLE,HEADER) ;
Q $P($$OUT(HANDLE,"Headers.GetItem."_HEADER),U,2)
;;
;; protected methods
PRINT(RESULT,HANDLE,PARAMS) ;
N COLUMNS,COLUMN,TXT,WIDTH,VALUE
S COLUMNS=$$OUT(HANDLE,"Headers.GetCount")
D OUT(HANDLE,"SetPage.1")
D HEADER(HANDLE)
S TXT=$$OUT(HANDLE,"List.First")
F Q:TXT="-1^End of list" D
.W !
.F COLUMN=1:1:COLUMNS D
..S WIDTH=$$WIDTH(HANDLE,COLUMN)
..S VALUE=$E($P(TXT,U,COLUMN),1,WIDTH-2)
..W $$LJ^XLFSTR(VALUE,WIDTH)
..Q
.S TXT=$$OUT(HANDLE,"List.Next")
.I ($Y+5)>IOSL D HEADER(HANDLE)
Q
;; public methods
CREATE(NAME) ;
; call parent first
N HANDLE,X,CHILD
S HANDLE=$$CREATE^ECOBUL(NAME)
D METHOD(.X,HANDLE_".of.Set_class.EC GENERIC TABLE PRINT")
D METHOD(.X,HANDLE_".of.Set_name.Generic Table Print")
D METHOD(.X,HANDLE_".of.Set_routine.METHOD^ECOB40(.RESULT,ARGUMENT)")
;;
D METHOD(.CHILD,HANDLE_".Methods.Add.Execute")
D METHOD(.X,CHILD_".mf.SetAddedByClass.Generic Table Print")
D METHOD(.X,CHILD_".mf.SetDescription.Print contents to IO device.")
D METHOD(.X,CHILD_".mf.SetHandler.PRINT^ECOB40(.RESULT,HANDLE,PARAMS)")
D METHOD(.X,CHILD_".mf.SetParams.")
D METHOD(.X,CHILD_".mf.SetReturns.1")
;;
D METHOD(.CHILD,HANDLE_".Properties.Add.TableName")
D METHOD(.X,CHILD_".pf.SetAddedByClass.EC GENERIC TABLE PRINT")
D METHOD(.X,CHILD_".pf.SetValue.Generic Table")
D METHOD(.X,CHILD_".pf.SetDefaultValue.")
;;
D METHOD(.CHILD,HANDLE_".Properties.Add.Page")
D METHOD(.X,CHILD_".pf.SetAddedByClass.EC GENERIC TABLE PRINT")
D METHOD(.X,CHILD_".pf.SetValue.1")
D METHOD(.X,CHILD_".pf.SetDefaultValue.1")
;;
; complex properties last
S CHILD=$$CREATE^ECOBL(NAME)
D METHOD(.X,HANDLE_".Collect.SetChild."_CHILD)
D METHOD(.X,HANDLE_".Collect.SetName.Headers")
D METHOD(.X,HANDLE_".Collect.SetHandler.ECOBL^ECOB40(.RESULT,HANDLE,PARAMS)")
D METHOD(.X,HANDLE_".Collect.Execute")
;;
D METHOD(.X,HANDLE_".Root.Add.EC GENERIC TABLE PRINT")
;
Q HANDLE
;;
DESTROY(HANDLE) ;
; call parent last
N CHILD
D METHOD(.CHILD,HANDLE_".GetHeaders")
D DESTROY^ECOBL(CHILD)
Q $$DESTROY^ECOBUL(HANDLE)
;;
METHOD(RESULT,ARGUMENT) ;
; call parent last
D METHOD^ECOBUL(.RESULT,ARGUMENT) ; parent method
Q
;;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HECOB40 3349 printed Nov 22, 2024@17:08:08 Page 2
ECOB40 ;BP/CMF - Generic Table Print Object
+1 ;;2.0;EVENT CAPTURE;**100**;8 May 96;Build 21
+2 ;@author - Chris Flegel
+3 ;@date - 17 May 2009
+4 ;@version - 1.0
+5 ;;
+6 QUIT
+7 ;; private methods
OUT(HANDLE,METHOD) ;
+1 NEW RESULT
+2 DO METHOD(.RESULT,HANDLE_"."_METHOD)
+3 QUIT RESULT
+4 ;;
ECOBL(RESULT,HANDLE,ARGUMENT) ; handler for the actual list object
+1 NEW CHILD
+2 DO METHOD(.CHILD,HANDLE_".GetHeaders")
+3 DO METHOD^ECOBL(.RESULT,CHILD_"."_ARGUMENT)
+4 QUIT
+5 ;;
+1 NEW HDR,HDRNAME,HDRWIDTH,PAGE
+2 WRITE @IOF
+3 SET PAGE=$$OUT(HANDLE,"GetPage")
+4 WRITE !,$$CJ^XLFSTR($$OUT(HANDLE,"GetTableName"),IOM)
+5 WRITE !,$$CJ^XLFSTR($$FMTE^XLFDT($$NOW^XLFDT()),IOM)
+6 WRITE !,$$CJ^XLFSTR("Page: "_PAGE,IOM)
+7 WRITE !!
+8 SET HDR=$$OUT(HANDLE,"Headers.First")
+9 FOR
if HDR="-1^End of list"
QUIT
Begin DoDot:1
+10 SET HDRNAME=$PIECE(HDR,U)
+11 SET HDRWIDTH=$PIECE(HDR,U,2)
+12 WRITE $$LJ^XLFSTR(HDRNAME,HDRWIDTH)
+13 SET HDR=$$OUT(HANDLE,"Headers.Next")
+14 QUIT
End DoDot:1
+15 SET PAGE=PAGE+1
+16 DO OUT(HANDLE,"SetPage."_PAGE)
+17 QUIT
+18 ;;
+1 NEW PAGE
+2 SET PAGE=$$OUT(HANDLE,"GetPage")
+3 WRITE !!
+4 WRITE $$CJ^XLFSTR("Page: "_PAGE,IOM)
+5 SET PAGE=PAGE+1
+6 DO OUT(HANDLE,"SetPage."_PAGE)
+7 QUIT
WIDTH(HANDLE,HEADER) ;
+1 QUIT $PIECE($$OUT(HANDLE,"Headers.GetItem."_HEADER),U,2)
+2 ;;
+3 ;; protected methods
PRINT(RESULT,HANDLE,PARAMS) ;
+1 NEW COLUMNS,COLUMN,TXT,WIDTH,VALUE
+2 SET COLUMNS=$$OUT(HANDLE,"Headers.GetCount")
+3 DO OUT(HANDLE,"SetPage.1")
+4 DO HEADER(HANDLE)
+5 SET TXT=$$OUT(HANDLE,"List.First")
+6 FOR
if TXT="-1^End of list"
QUIT
Begin DoDot:1
+7 WRITE !
+8 FOR COLUMN=1:1:COLUMNS
Begin DoDot:2
+9 SET WIDTH=$$WIDTH(HANDLE,COLUMN)
+10 SET VALUE=$EXTRACT($PIECE(TXT,U,COLUMN),1,WIDTH-2)
+11 WRITE $$LJ^XLFSTR(VALUE,WIDTH)
+12 QUIT
End DoDot:2
+13 SET TXT=$$OUT(HANDLE,"List.Next")
+14 IF ($Y+5)>IOSL
DO HEADER(HANDLE)
End DoDot:1
+15 QUIT
+16 ;; public methods
CREATE(NAME) ;
+1 ; call parent first
+2 NEW HANDLE,X,CHILD
+3 SET HANDLE=$$CREATE^ECOBUL(NAME)
+4 DO METHOD(.X,HANDLE_".of.Set_class.EC GENERIC TABLE PRINT")
+5 DO METHOD(.X,HANDLE_".of.Set_name.Generic Table Print")
+6 DO METHOD(.X,HANDLE_".of.Set_routine.METHOD^ECOB40(.RESULT,ARGUMENT)")
+7 ;;
+8 DO METHOD(.CHILD,HANDLE_".Methods.Add.Execute")
+9 DO METHOD(.X,CHILD_".mf.SetAddedByClass.Generic Table Print")
+10 DO METHOD(.X,CHILD_".mf.SetDescription.Print contents to IO device.")
+11 DO METHOD(.X,CHILD_".mf.SetHandler.PRINT^ECOB40(.RESULT,HANDLE,PARAMS)")
+12 DO METHOD(.X,CHILD_".mf.SetParams.")
+13 DO METHOD(.X,CHILD_".mf.SetReturns.1")
+14 ;;
+15 DO METHOD(.CHILD,HANDLE_".Properties.Add.TableName")
+16 DO METHOD(.X,CHILD_".pf.SetAddedByClass.EC GENERIC TABLE PRINT")
+17 DO METHOD(.X,CHILD_".pf.SetValue.Generic Table")
+18 DO METHOD(.X,CHILD_".pf.SetDefaultValue.")
+19 ;;
+20 DO METHOD(.CHILD,HANDLE_".Properties.Add.Page")
+21 DO METHOD(.X,CHILD_".pf.SetAddedByClass.EC GENERIC TABLE PRINT")
+22 DO METHOD(.X,CHILD_".pf.SetValue.1")
+23 DO METHOD(.X,CHILD_".pf.SetDefaultValue.1")
+24 ;;
+25 ; complex properties last
+26 SET CHILD=$$CREATE^ECOBL(NAME)
+27 DO METHOD(.X,HANDLE_".Collect.SetChild."_CHILD)
+28 DO METHOD(.X,HANDLE_".Collect.SetName.Headers")
+29 DO METHOD(.X,HANDLE_".Collect.SetHandler.ECOBL^ECOB40(.RESULT,HANDLE,PARAMS)")
+30 DO METHOD(.X,HANDLE_".Collect.Execute")
+31 ;;
+32 DO METHOD(.X,HANDLE_".Root.Add.EC GENERIC TABLE PRINT")
+33 ;
+34 QUIT HANDLE
+35 ;;
DESTROY(HANDLE) ;
+1 ; call parent last
+2 NEW CHILD
+3 DO METHOD(.CHILD,HANDLE_".GetHeaders")
+4 DO DESTROY^ECOBL(CHILD)
+5 QUIT $$DESTROY^ECOBUL(HANDLE)
+6 ;;
METHOD(RESULT,ARGUMENT) ;
+1 ; call parent last
+2 ; parent method
DO METHOD^ECOBUL(.RESULT,ARGUMENT)
+3 QUIT
+4 ;;