@ Nonnull public static JSAnonymousFunction createFunctionPrintSum ( @ Nullable final String sPrefix , @ Nullable final String sSuffix , @ Nullable final String sBothPrefix , @ Nullable final String sBothSep , @ Nullable final String sBothSuffix ) { final JSAnonymousFunction aFuncPrintSum = new JSAnonymousFunction ( ) ; IJSExpression aTotal = aFuncPrintSum . param ( "t" ) ; IJSExpression aPageTotal = aFuncPrintSum . param ( "pt" ) ; if ( StringHelper . hasText ( sPrefix ) ) { aTotal = JSExpr . lit ( sPrefix ) . plus ( aTotal ) ; aPageTotal = JSExpr . lit ( sPrefix ) . plus ( aPageTotal ) ; } if ( StringHelper . hasText ( sSuffix ) ) { aTotal = aTotal . plus ( sSuffix ) ; aPageTotal = aPageTotal . plus ( sSuffix ) ; } IJSExpression aBoth ; if ( StringHelper . hasText ( sBothPrefix ) ) aBoth = JSExpr . lit ( sBothPrefix ) . plus ( aPageTotal ) ; else aBoth = aPageTotal ; if ( StringHelper . hasText ( sBothSep ) ) aBoth = aBoth . plus ( sBothSep ) ; aBoth = aBoth . plus ( aTotal ) ; if ( StringHelper . hasText ( sBothSuffix ) ) aBoth = aBoth . plus ( sBothSuffix ) ; aFuncPrintSum . body ( ) . _return ( JSOp . cond ( aTotal . eq ( aPageTotal ) , aTotal , aBoth ) ) ; return aFuncPrintSum ; }
Create the JS function to print the sum in the footer