List of usage examples for org.apache.poi.hssf.usermodel HSSFCell setCellValue
@SuppressWarnings("fallthrough") public void setCellValue(boolean value)
From source file:com.nkapps.billing.services.BankStatementPrintServiceImpl.java
public boolean createCell(HSSFRow row, int cellCurrent, HSSFCellStyle[] style, Integer value) { HSSFCell cell; cell = row.createCell(cellCurrent);//from ww w .j a v a 2 s . c o m if (value == null) { cell.setCellValue(""); } else { cell.setCellValue(value); } cell.setCellStyle(style[cellCurrent++]); return true; }
From source file:com.nkapps.billing.services.BankStatementPrintServiceImpl.java
public boolean createCell(HSSFRow row, int cellCurrent, HSSFCellStyle[] style, Long value) { HSSFCell cell; cell = row.createCell(cellCurrent);//from www . ja v a 2 s. com if (value == null) { cell.setCellValue(""); } else { cell.setCellValue(value); } cell.setCellStyle(style[cellCurrent++]); return true; }
From source file:com.nkapps.billing.services.BankStatementPrintServiceImpl.java
public boolean createCell(HSSFRow row, int cellCurrent, HSSFCellStyle[] style, BigDecimal value) { HSSFCell cell; cell = row.createCell(cellCurrent);//from ww w . ja v a 2s . c o m if (value == null) { cell.setCellValue(""); } else { cell.setCellValue(value.doubleValue()); } cell.setCellStyle(style[cellCurrent++]); return true; }
From source file:com.nokia.s60tools.swmtanalyser.model.ExcelCreator.java
License:Open Source License
private boolean createOverViewTab() { //create a new sheet HSSFSheet sheet = wb.createSheet();/* w ww. ja va2 s .co m*/ // declare a row object reference HSSFRow row = null; // declare a cell object reference HSSFCell cell = null; //set the sheet name in Unicode wb.setSheetName(0, "Overview"); row = sheet.createRow(0); //r.setHeight((short)500); cell = row.createCell(0); cell.setCellStyle(styles.get("header")); cell.setCellValue(new HSSFRichTextString("Overview")); row = sheet.createRow(1); cell = row.createCell(0); cell.setCellValue(new HSSFRichTextString("Number of Cycles")); cell = row.createCell(1); cell.setCellStyle(styles.get("cell_number")); CycleData firstCycle = logData.getLogData()[0]; if (ovData.noOfcycles == 1) cell.setCellValue(new HSSFRichTextString(ovData.noOfcycles + " (" + firstCycle.getCycleNumber() + ")")); else cell.setCellValue(ovData.noOfcycles); row = sheet.createRow(2); cell = row.createCell(0); cell.setCellValue(new HSSFRichTextString("Number of Cycles Truncated")); cell = row.createCell(1); cell.setCellValue(constants.size()); row = sheet.createRow(3); cell = row.createCell(0); cell.setCellValue(new HSSFRichTextString("Time Period")); HSSFCell timePeriod = row.createCell(1); row = sheet.createRow(4); cell = row.createCell(0); cell.setCellValue(new HSSFRichTextString("Time Duration")); cell = row.createCell(1); cell.setCellValue(new HSSFRichTextString(ovData.duration + " sec(" + ovData.durationString + ")")); row = sheet.createRow(5); cell = row.createCell(0); cell.setCellValue(new HSSFRichTextString("ROM Checksum")); cell = row.createCell(1); cell.setCellValue(new HSSFRichTextString(firstCycle.getRomCheckSum())); row = sheet.createRow(6); cell = row.createCell(0); cell.setCellValue(new HSSFRichTextString("ROM Version")); cell = row.createCell(1); cell.setCellValue(new HSSFRichTextString(firstCycle.getRomVersion())); sheet.createRow(7); sheet.createRow(8); sheet.createRow(9); row = sheet.createRow(10); cell = row.createCell(0); cell.setCellStyle(styles.get("header2")); cell.setCellValue(new HSSFRichTextString("")); cell = row.createCell(1); cell.setCellStyle(styles.get("header2")); cell.setCellValue(new HSSFRichTextString("Delta")); HSSFRow totalHeapSizeRow = sheet.createRow(11); cell = totalHeapSizeRow.createCell(0); cell.setCellStyle(styles.get("cell_bold")); cell.setCellValue(new HSSFRichTextString("Heap Size")); HSSFRow freeCellRow = sheet.createRow(12); cell = freeCellRow.createCell(0); cell.setCellStyle(styles.get("cell_bold")); cell.setCellValue(new HSSFRichTextString("Free Cell count")); HSSFRow alloCellRow = sheet.createRow(13); cell = alloCellRow.createCell(0); cell.setCellStyle(styles.get("cell_bold")); cell.setCellValue(new HSSFRichTextString("Allocated Cell count")); HSSFRow freeSpaceRow = sheet.createRow(14); cell = freeSpaceRow.createCell(0); cell.setCellStyle(styles.get("cell_bold")); cell.setCellValue(new HSSFRichTextString("Free space")); HSSFRow allocSpaceRow = sheet.createRow(15); cell = allocSpaceRow.createCell(0); cell.setCellStyle(styles.get("cell_bold")); cell.setCellValue(new HSSFRichTextString("Allocated space")); HSSFRow slackSpaceRow = sheet.createRow(16); cell = slackSpaceRow.createCell(0); cell.setCellStyle(styles.get("cell_bold")); cell.setCellValue(new HSSFRichTextString("Slack space")); HSSFRow filesRow = sheet.createRow(17); cell = filesRow.createCell(0); cell.setCellStyle(styles.get("cell_bold")); cell.setCellValue(new HSSFRichTextString("Total files")); HSSFRow psHandlesRow = sheet.createRow(18); cell = psHandlesRow.createCell(0); cell.setCellStyle(styles.get("cell_bold")); cell.setCellValue(new HSSFRichTextString("Total P&S Handles")); sheet.createRow(19); sheet.createRow(20); sheet.createRow(21); sheet.createRow(22); row = sheet.createRow(23); createOverviewFields(row); createDataInOverView(sheet, 24); cell = totalHeapSizeRow.createCell(1); cell.setCellStyle(styles.get("blue_font")); cell.setCellValue(totalHeapSizeChange); cell = freeCellRow.createCell(1); cell.setCellStyle(styles.get("blue_font")); cell.setCellValue(totalFreeCellChange); cell = alloCellRow.createCell(1); cell.setCellStyle(styles.get("blue_font")); cell.setCellValue(totalAllocCellChange); cell = freeSpaceRow.createCell(1); cell.setCellStyle(styles.get("blue_font")); cell.setCellValue(totalFreeSpaceChange); cell = allocSpaceRow.createCell(1); cell.setCellStyle(styles.get("blue_font")); cell.setCellValue(totalAllocSpaceChange); cell = slackSpaceRow.createCell(1); cell.setCellStyle(styles.get("blue_font")); cell.setCellValue(totalSlackSpaceChange); cell = filesRow.createCell(1); cell.setCellStyle(styles.get("blue_font")); cell.setCellValue(totalFilesChange); cell = psHandlesRow.createCell(1); cell.setCellStyle(styles.get("blue_font")); cell.setCellValue(totalHandlesChange); sheet.autoSizeColumn((short) 0); sheet.autoSizeColumn((short) 1); sheet.autoSizeColumn((short) 2); sheet.autoSizeColumn((short) 3); sheet.autoSizeColumn((short) 4); sheet.autoSizeColumn((short) 5); sheet.autoSizeColumn((short) 6); sheet.autoSizeColumn((short) 7); sheet.autoSizeColumn((short) 8); sheet.autoSizeColumn((short) 9); sheet.autoSizeColumn((short) 10); sheet.autoSizeColumn((short) 11); if (ovData.noOfcycles > 1) timePeriod.setCellValue(new HSSFRichTextString(ovData.fromTime + " to " + ovData.toTime)); else timePeriod.setCellValue(new HSSFRichTextString(ovData.fromTime)); return true; }
From source file:com.nokia.s60tools.swmtanalyser.model.ExcelCreator.java
License:Open Source License
/** * This method creates the sheet for RAM and DISK Memory data. * It shows the variation of RAM and Disk Memory in each cycle. * *//*from ww w . ja v a 2s. c o m*/ private void createDiskVariationSheet() { //create a new sheet HSSFSheet sheet = wb.createSheet(); // declare a row object reference HSSFRow row = null; HSSFRow description = null; // declare a cell object reference HSSFCell cell = null; //set the sheet name in Unicode wb.setSheetName(1, "RAM and Disk Memory"); row = sheet.createRow(0); //r.setHeight((short)500); cell = row.createCell(0); cell.setCellStyle(styles.get("header")); cell.setCellValue(new HSSFRichTextString("RAM and Disk Memory")); description = sheet.createRow(1); //creates an empty row row = sheet.createRow(2); row = sheet.createRow(3); cell = row.createCell(0); cell.setCellStyle(styles.get("header2")); cell.setCellValue(new HSSFRichTextString("")); addCycleIntervals(row); cell = row.createCell((int) (row.getLastCellNum())); cell.setCellStyle(styles.get("header2")); cell.setCellValue(new HSSFRichTextString("Delta")); SWMTLogReaderUtils utils = new SWMTLogReaderUtils(); ArrayList<String> diskNames = utils.getAllDiskNames(logData); int rowNo = 4; row = sheet.createRow(rowNo); cell = row.createCell(0); cell.setCellStyle(styles.get("cell_normal")); cell.setCellValue(new HSSFRichTextString("RAM (Used)")); ArrayList<SystemData> systemData = utils.getSystemDataFromAllCycles(logData); long[] usedMemValues = new long[logData.getNumberOfCycles()]; j = 1; for (int i = 0; i < logData.getNumberOfCycles(); i++) { long totalMem = systemData.get(i).getTotalMemory(); long freeMem = systemData.get(i).getFreeMemory(); if (totalMem == -1 || freeMem == -1) { //cell.getCellStyle().setAlignment(HSSFCellStyle.ALIGN_CENTER); usedMemValues[i] = -1; } else { long usedMemory = totalMem - freeMem; usedMemValues[i] = usedMemory; } if (constants.contains(i + 1)) continue; cell = row.createCell(j++); cell.setCellStyle(styles.get("cell_number")); cell.setCellType(HSSFCell.CELL_TYPE_NUMERIC); if (usedMemValues[i] == -1) cell.setCellValue(new HSSFRichTextString(NOT_AVAILABLE)); else cell.setCellValue(usedMemValues[i]); //cell.setCellValue(logData.get(i).getFreeMemory()); } cell = row.createCell(logData.getNumberOfCycles() + 1 - constants.size()); cell.setCellStyle(styles.get("cell_number")); long usedMemChange = utils.calculateDeltaForGivenSet(usedMemValues); cell.setCellValue(usedMemChange); /*cell = row.createCell(logData.size()+1); cell.setCellStyle(styles.get("cell_number")); long firstCycleValue = logData.get(0).getFreeMemory(); long lastCycleValue = logData.get(logData.size()-1).getFreeMemory(); if(firstCycleValue!= -1 && lastCycleValue!= -1) cell.setCellValue(lastCycleValue - firstCycleValue); else{ //cell.getCellStyle().setAlignment(HSSFCellStyle.ALIGN_CENTER); cell.setCellValue(new HSSFRichTextString(NOT_AVAILABLE)); }*/ rowNo++; row = sheet.createRow(rowNo); cell = row.createCell(0); cell.setCellStyle(styles.get("cell_normal")); cell.setCellValue(new HSSFRichTextString("RAM (Size)")); long[] totalMemValues = new long[logData.getNumberOfCycles()]; j = 1; for (int i = 0; i < logData.getNumberOfCycles(); i++) { long totalMem = systemData.get(i).getTotalMemory(); if (totalMem == -1) { totalMemValues[i] = -1; } else { totalMemValues[i] = totalMem; } //cell.setCellValue(logData.get(i).getFreeMemory()); if (constants.contains(i + 1)) continue; cell = row.createCell(j++); cell.setCellStyle(styles.get("cell_number")); cell.setCellType(HSSFCell.CELL_TYPE_NUMERIC); if (totalMemValues[i] == -1) cell.setCellValue(new HSSFRichTextString(NOT_AVAILABLE)); else cell.setCellValue(totalMemValues[i]); } cell = row.createCell(logData.getNumberOfCycles() + 1 - constants.size()); cell.setCellStyle(styles.get("cell_number")); long totalMemChange = utils.calculateDeltaForGivenSet(totalMemValues); cell.setCellValue(totalMemChange); Collections.sort(diskNames); for (String name : diskNames) { rowNo++; row = sheet.createRow(rowNo); cell = row.createCell(0); cell.setCellStyle(styles.get("cell_normal")); cell.setCellValue(new HSSFRichTextString(name + " (Used)")); ArrayList<DiskOverview> values = utils.getUsedMemoryAndSizesForDisk(name, logData); long[] usedSizes = new long[values.size()]; j = 1; for (int i = 0; i < values.size(); i++) { if (constants.contains(i + 1)) continue; cell = row.createCell(j++); cell.setCellStyle(styles.get("cell_number")); cell.setCellType(HSSFCell.CELL_TYPE_NUMERIC); long usedSize = values.get(i).getUsedSize(); if (usedSize == -1) { //cell.getCellStyle().setAlignment(HSSFCellStyle.ALIGN_CENTER); cell.setCellValue(new HSSFRichTextString(NOT_AVAILABLE)); } else cell.setCellValue(usedSize); usedSizes[i] = usedSize; } cell = row.createCell(logData.getNumberOfCycles() + 1 - constants.size()); cell.setCellStyle(styles.get("cell_number")); long deltaValue = utils.calculateDeltaForGivenSet(usedSizes); cell.setCellValue(deltaValue); rowNo++; row = sheet.createRow(rowNo); cell = row.createCell(0); cell.setCellStyle(styles.get("cell_normal")); cell.setCellValue(new HSSFRichTextString(name + " (Size)")); long[] sizeValues = new long[values.size()]; j = 1; for (int i = 0; i < values.size(); i++) { if (constants.contains(i + 1)) continue; cell = row.createCell(j++); cell.setCellStyle(styles.get("cell_number")); cell.setCellType(HSSFCell.CELL_TYPE_NUMERIC); long size = values.get(i).getSize(); if (size == -1) { //cell.getCellStyle().setAlignment(HSSFCellStyle.ALIGN_CENTER); cell.setCellValue(new HSSFRichTextString(NOT_AVAILABLE)); } else cell.setCellValue(size); sizeValues[i] = size; } cell = row.createCell(logData.getNumberOfCycles() + 1 - constants.size()); cell.setCellStyle(styles.get("cell_number")); long sizeDelta = utils.calculateDeltaForGivenSet(sizeValues); cell.setCellValue(sizeDelta); } for (int i = 0; i <= logData.getNumberOfCycles(); i++) { sheet.autoSizeColumn((short) i); } cell = description.createCell(0); cell.setCellValue(new HSSFRichTextString( "Specifies the amount of used RAM and disk memories of all drives in bytes, for each cycle in seconds")); }
From source file:com.nokia.s60tools.swmtanalyser.model.ExcelCreator.java
License:Open Source License
private void createHeapSizeTab() { HSSFSheet sheet = wb.createSheet();/* ww w.ja va 2 s. c o m*/ // declare a row object reference HSSFRow row = null; HSSFRow description = null; // declare a cell object reference HSSFCell cell = null; //set the sheet name in Unicode wb.setSheetName(4, "Total Heap Size"); row = sheet.createRow(0); //r.setHeight((short)500); cell = row.createCell(0); cell.setCellStyle(styles.get("header")); cell.setCellValue(new HSSFRichTextString("Total Heap Size")); description = sheet.createRow(1); //creates an empty row. row = sheet.createRow(2); row = sheet.createRow(3); cell = row.createCell(0); cell.setCellStyle(styles.get("header1")); cell.setCellValue(new HSSFRichTextString("Threads")); addCycleIntervals(row); cell = row.createCell((int) row.getLastCellNum()); cell.setCellStyle(styles.get("header2")); cell.setCellValue(new HSSFRichTextString("Delta")); int rowNo = 4; for (String heap : heapThreads) { row = sheet.createRow(rowNo); cell = row.createCell(0); cell.setCellStyle(styles.get("cell_normal")); cell.setCellValue(new HSSFRichTextString(heap)); ArrayList<ThreadData> heapValues = heapData.get(heap.toLowerCase()); if (heapValues != null) { int j = 1; for (int i = 0; i < heapValues.size(); i++) { if (constants.contains(i + 1)) { if (heap.equalsIgnoreCase("!SensorServer[1020507e]0001::OrientationThread")) DbgUtility.println(DbgUtility.PRIORITY_OPERATION, "Skipping data from Cycle.." + i); continue; } cell = row.createCell(j++); cell.setCellStyle(styles.get("cell_number")); ThreadData thData = heapValues.get(i); if (thData.getStatus() == 0) { //cell.getCellStyle().setAlignment(HSSFCellStyle.ALIGN_CENTER); cell.setCellValue(new HSSFRichTextString(NOT_AVAILABLE)); } else cell.setCellValue(thData.getHeapChunkSize()); } } cell = row.createCell(logData.getNumberOfCycles() + 1 - constants.size()); cell.setCellStyle(styles.get("cell_number")); ThreadData delta = deltaData.get(heap.toLowerCase()); //DbgUtility.println(DbgUtility.PRIORITY_OPERATION, "Delta for the thread " + heap + " is " + delta); if (delta != null) { long heapSizeDelta = delta.getHeapChunkSize(); cell.setCellValue(heapSizeDelta); } else cell.setCellValue(0); rowNo++; } for (int i = 0; i <= logData.getNumberOfCycles(); i++) { sheet.autoSizeColumn((short) i); } cell = description.createCell(0); cell.setCellValue(new HSSFRichTextString( "Specifies the total heap size for each thread in bytes, for each cycle in seconds")); }
From source file:com.nokia.s60tools.swmtanalyser.model.ExcelCreator.java
License:Open Source License
private void createHeapAllocSpaceTab() { HSSFSheet sheet = wb.createSheet();//from w w w. j a va 2 s . c om // declare a row object reference HSSFRow row = null; HSSFRow description = null; // declare a cell object reference HSSFCell cell = null; //set the sheet name in Unicode wb.setSheetName(5, "Total heap alloc space"); row = sheet.createRow(0); //r.setHeight((short)500); cell = row.createCell(0); cell.setCellStyle(styles.get("header")); cell.setCellValue(new HSSFRichTextString("Total Heap Allocated Space")); description = sheet.createRow(1); //creates an empty row. row = sheet.createRow(2); row = sheet.createRow(3); cell = row.createCell(0); cell.setCellStyle(styles.get("header1")); cell.setCellValue(new HSSFRichTextString("Threads")); addCycleIntervals(row); cell = row.createCell((int) row.getLastCellNum()); cell.setCellStyle(styles.get("header2")); cell.setCellValue(new HSSFRichTextString("Delta")); int rowNo = 4; for (String heap : heapThreads) { row = sheet.createRow(rowNo); cell = row.createCell(0); cell.setCellStyle(styles.get("cell_normal")); cell.setCellValue(new HSSFRichTextString(heap)); ArrayList<ThreadData> heapValues = heapData.get(heap.toLowerCase()); if (heapValues != null) { int j = 1; for (int i = 0; i < heapValues.size(); i++) { if (constants.contains(i + 1)) continue; cell = row.createCell(j++); cell.setCellStyle(styles.get("cell_number")); ThreadData thData = heapValues.get(i); if (thData.getStatus() == 0) { //cell.getCellStyle().setAlignment(HSSFCellStyle.ALIGN_CENTER); cell.setCellValue(new HSSFRichTextString(NOT_AVAILABLE)); } else cell.setCellValue(thData.getHeapAllocatedSpace()); } } cell = row.createCell(logData.getNumberOfCycles() + 1 - constants.size()); cell.setCellStyle(styles.get("cell_number")); if (deltaData.get(heap.toLowerCase()) != null) { long heapAllocSpaceDelta = deltaData.get(heap.toLowerCase()).getHeapAllocatedSpace(); cell.setCellValue(heapAllocSpaceDelta); } else cell.setCellValue(0); rowNo++; } for (int i = 0; i <= logData.getNumberOfCycles(); i++) { sheet.autoSizeColumn((short) i); } cell = description.createCell(0); cell.setCellValue(new HSSFRichTextString( "Specifies the total heap allocated space for each thread in bytes, for each cycle in seconds")); }
From source file:com.nokia.s60tools.swmtanalyser.model.ExcelCreator.java
License:Open Source License
private void createHeapFreeSpaceTab() { HSSFSheet sheet = wb.createSheet();//from w ww . j a va 2 s .c o m // declare a row object reference HSSFRow row = null; HSSFRow description = null; // declare a cell object reference HSSFCell cell = null; //set the sheet name in Unicode wb.setSheetName(6, "Total heap free space"); row = sheet.createRow(0); //r.setHeight((short)500); cell = row.createCell(0); cell.setCellStyle(styles.get("header")); cell.setCellValue(new HSSFRichTextString("Total Heap Free Space")); description = sheet.createRow(1); //creates an empty row. row = sheet.createRow(2); row = sheet.createRow(3); cell = row.createCell(0); cell.setCellStyle(styles.get("header1")); cell.setCellValue(new HSSFRichTextString("Threads")); addCycleIntervals(row); cell = row.createCell((int) row.getLastCellNum()); cell.setCellStyle(styles.get("header2")); cell.setCellValue(new HSSFRichTextString("Delta")); int rowNo = 4; for (String heap : heapThreads) { row = sheet.createRow(rowNo); cell = row.createCell(0); cell.setCellStyle(styles.get("cell_normal")); cell.setCellValue(new HSSFRichTextString(heap)); ArrayList<ThreadData> heapValues = heapData.get(heap.toLowerCase()); if (heapValues != null) { int j = 1; for (int i = 0; i < heapValues.size(); i++) { if (constants.contains(i + 1)) continue; cell = row.createCell(j++); cell.setCellStyle(styles.get("cell_number")); ThreadData thData = heapValues.get(i); if (thData.getStatus() == 0) { //cell.getCellStyle().setAlignment(HSSFCellStyle.ALIGN_CENTER); cell.setCellValue(new HSSFRichTextString(NOT_AVAILABLE)); } else cell.setCellValue(thData.getHeapFreeSpace()); } } cell = row.createCell(logData.getNumberOfCycles() + 1 - constants.size()); cell.setCellStyle(styles.get("cell_number")); if (deltaData.get(heap.toLowerCase()) != null) { long heapFreeeDelta = deltaData.get(heap.toLowerCase()).getHeapFreeSpace(); cell.setCellValue(heapFreeeDelta); } else cell.setCellValue(0); rowNo++; } for (int i = 0; i <= logData.getNumberOfCycles(); i++) { sheet.autoSizeColumn((short) i); } cell = description.createCell(0); cell.setCellValue(new HSSFRichTextString( "Specifies the total heap free space for each thread in bytes, for each cycle in seconds")); }
From source file:com.nokia.s60tools.swmtanalyser.model.ExcelCreator.java
License:Open Source License
private void createAllocatedCellsTab() { HSSFSheet sheet = wb.createSheet();/*w w w. j a v a 2 s . com*/ // declare a row object reference HSSFRow row = null; HSSFRow description = null; // declare a cell object reference HSSFCell cell = null; //set the sheet name in Unicode wb.setSheetName(7, "Allocated heap cell count"); row = sheet.createRow(0); //r.setHeight((short)500); cell = row.createCell(0); cell.setCellStyle(styles.get("header")); cell.setCellValue(new HSSFRichTextString("Allocated heap cell count")); description = sheet.createRow(1); //creates an empty row. row = sheet.createRow(2); row = sheet.createRow(3); cell = row.createCell(0); cell.setCellStyle(styles.get("header1")); cell.setCellValue(new HSSFRichTextString("Threads")); addCycleIntervals(row); cell = row.createCell((int) row.getLastCellNum()); cell.setCellStyle(styles.get("header2")); cell.setCellValue(new HSSFRichTextString("Delta")); int rowNo = 4; for (String heap : heapThreads) { row = sheet.createRow(rowNo); cell = row.createCell(0); cell.setCellStyle(styles.get("cell_normal")); cell.setCellValue(new HSSFRichTextString(heap)); ArrayList<ThreadData> heapValues = heapData.get(heap.toLowerCase()); if (heapValues != null) { int j = 1; for (int i = 0; i < heapValues.size(); i++) { if (constants.contains(i + 1)) continue; cell = row.createCell(j++); cell.setCellStyle(styles.get("cell_number")); ThreadData thData = heapValues.get(i); if (thData.getStatus() == 0) { //cell.getCellStyle().setAlignment(HSSFCellStyle.ALIGN_CENTER); cell.setCellValue(new HSSFRichTextString(NOT_AVAILABLE)); } else cell.setCellValue(thData.getAllocatedCells()); } } cell = row.createCell(logData.getNumberOfCycles() + 1 - constants.size()); cell.setCellStyle(styles.get("cell_number")); if (deltaData.get(heap.toLowerCase()) != null) { long allocCellsDelta = deltaData.get(heap.toLowerCase()).getAllocatedCells(); cell.setCellValue(allocCellsDelta); } else cell.setCellValue(0); rowNo++; } for (int i = 0; i <= logData.getNumberOfCycles(); i++) { sheet.autoSizeColumn((short) i); } cell = description.createCell(0); cell.setCellValue(new HSSFRichTextString( "Specifies the allocated heap cell count for each thread in bytes, for each cycle in seconds")); }
From source file:com.nokia.s60tools.swmtanalyser.model.ExcelCreator.java
License:Open Source License
private void createFreeCellsTab() { HSSFSheet sheet = wb.createSheet();/*from w ww .ja va2 s . co m*/ // declare a row object reference HSSFRow row = null; HSSFRow description = null; // declare a cell object reference HSSFCell cell = null; //set the sheet name in Unicode wb.setSheetName(8, "Free heap cell count"); row = sheet.createRow(0); cell = row.createCell(0); cell.setCellStyle(styles.get("header")); cell.setCellValue(new HSSFRichTextString("Free heap cell count")); description = sheet.createRow(1); //creates an empty row. row = sheet.createRow(2); row = sheet.createRow(3); cell = row.createCell(0); cell.setCellStyle(styles.get("header1")); cell.setCellValue(new HSSFRichTextString("Threads")); addCycleIntervals(row); cell = row.createCell((int) row.getLastCellNum()); cell.setCellStyle(styles.get("header2")); cell.setCellValue(new HSSFRichTextString("Delta")); int rowNo = 4; for (String heap : heapThreads) { row = sheet.createRow(rowNo); cell = row.createCell(0); cell.setCellStyle(styles.get("cell_normal")); cell.setCellValue(new HSSFRichTextString(heap)); ArrayList<ThreadData> heapValues = heapData.get(heap.toLowerCase()); if (heapValues != null) { int j = 1; for (int i = 0; i < heapValues.size(); i++) { if (constants.contains(i + 1)) continue; cell = row.createCell(j++); cell.setCellStyle(styles.get("cell_number")); ThreadData thData = heapValues.get(i); if (thData.getStatus() == 0) { //cell.getCellStyle().setAlignment(HSSFCellStyle.ALIGN_CENTER); cell.setCellValue(new HSSFRichTextString(NOT_AVAILABLE)); } else cell.setCellValue(thData.getFreeCells()); } } cell = row.createCell(logData.getNumberOfCycles() + 1 - constants.size()); cell.setCellStyle(styles.get("cell_number")); if (deltaData.get(heap.toLowerCase()) != null) { long heapFreeCellsDelta = deltaData.get(heap.toLowerCase()).getFreeCells(); cell.setCellValue(heapFreeCellsDelta); } else cell.setCellValue(0); rowNo++; } for (int i = 0; i <= logData.getNumberOfCycles(); i++) { sheet.autoSizeColumn((short) i); } cell = description.createCell(0); cell.setCellValue(new HSSFRichTextString( "Specifies the free heap cell count for each thread in bytes, for each cycle in seconds")); }