EAS Bos total line code

Source: Internet
Author: User
/*** Function: add the kdtable * @ Param fields * columns to be aggregated */public static void apendfootrow (kdtable table, string fields []) {int size = fields. length; If (size = 0) return; Map sumvalue = new hashmap (); // The rows from getrowcount may be incorrect. Int COUNT = table. getrowcount3 (); For (INT I = 0; I <fields. length; I ++) {sumvalue. put (fields [I], new bigdecimal ("0.00");} irow footrow = NULL; kdtfootma Nager footmanager = table. getfootmanager (); If (footmanager = NULL) {footmanager = new kdtfootmanager (table); footmanager. addfootview (); table. setfootmanager (footmanager);} // calculates the total value of all specified rows. footrow = footmanager. getfootrow (0); For (INT I = 0; I <count; I ++) {irow ROW = table. getrow (I); For (Int J = 0; j <fields. length; j ++) {sumvalueforcell (row, fields [J], sumvalue) ;}} if (footrow = NULL) {Footrow = footmanager. addfootrow (0);} // set the display style of the total rows string colformat = "% {0.00} f"; string Total = easresource. getstring (frameworkclientutils. strresource + "msg_total"); table. getindexcolumn (). setwidthadjustmode (kdtindexcolumn. width_manual); table. getindexcolumn (). setwidth (30); footmanager. addindextext (0, total); footrow. getstyleattributes (). setbackground (new color (0xf6, 0xf6, 0xbf); For (INT I = 0; I <size; I ++) {string colname = Fields [I]; footrow. getcell (colname ). getstyleattributes (). setnumberformat (colformat); footrow. getcell (colname ). getstyleattributes (). sethorizontalalign (horizontalalignment. right); footrow. getcell (colname ). getstyleattributes (). setfontcolor (color. black);} // set the value of the total row for (INT I = 0; I <fields. length; I ++) {footrow. getcell (fields [I]). setvalue (sumvalue. get (FIE LDS [I]) ;}} Private Static void sumvalueforcell (irow row, string key, map sumvalue) {icell cell = row. getcell (key); If (cell! = NULL) {object OBJ = cell. getvalue (); If (OBJ! = NULL) {bigdecimal keyValue = (bigdecimal) sumvalue. get (key); keyValue = keyValue. add (New bigdecimal (obj. tostring (); sumvalue. put (Key, keyValue );}}}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.