| Line | Hits | Source |
|---|---|---|
| 1 | /******************************************************************************* | |
| 2 | ||
| 3 | * Demetrix process modelling system | |
| 4 | ||
| 5 | * | |
| 6 | ||
| 7 | * Copyright (c) 2003, 2004 Dimitri A. Pissarenko | |
| 8 | ||
| 9 | * | |
| 10 | ||
| 11 | * This file is part of Demetrix. | |
| 12 | ||
| 13 | * | |
| 14 | ||
| 15 | * Demetrix is free software; you can redistribute it and/or modify | |
| 16 | ||
| 17 | * it under the terms of the GNU General Public License as published by | |
| 18 | ||
| 19 | * the Free Software Foundation; either version 2.1 of the License, or | |
| 20 | ||
| 21 | * (at your option) any later version. | |
| 22 | ||
| 23 | * | |
| 24 | ||
| 25 | * Demetrix is distributed in the hope that it will be useful, | |
| 26 | ||
| 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 28 | ||
| 29 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 30 | ||
| 31 | * GNU General Public License for more details. | |
| 32 | ||
| 33 | * | |
| 34 | ||
| 35 | * You should have received a copy of the GNU General Public License | |
| 36 | ||
| 37 | * along with Demetrix; if not, write to the Free Software | |
| 38 | ||
| 39 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 40 | ||
| 41 | * | |
| 42 | ||
| 43 | * For further information you may | |
| 44 | ||
| 45 | * | |
| 46 | ||
| 47 | * - send an e-mail in Russian, German or English to dimitri.pissarenko@gmx.net | |
| 48 | ||
| 49 | * - look at http://sourceforge.net/projects/demetrix/ | |
| 50 | ||
| 51 | * - look at http://demetrix.sourceforge.net/ | |
| 52 | ||
| 53 | * - look at http://members.inode.at/d.pissarenko/ | |
| 54 | ||
| 55 | * | |
| 56 | ||
| 57 | *****************************************************************************/ | |
| 58 | ||
| 59 | ||
| 60 | ||
| 61 | package net.sourceforge.demetrix.ui.balancesheets; | |
| 62 | ||
| 63 | ||
| 64 | ||
| 65 | import java.util.Vector; | |
| 66 | ||
| 67 | ||
| 68 | ||
| 69 | import net.sourceforge.demetrix.ui.ProcessChainExcelWriter; | |
| 70 | ||
| 71 | ||
| 72 | ||
| 73 | import org.apache.poi.hssf.usermodel.HSSFCell; | |
| 74 | ||
| 75 | import org.apache.poi.hssf.usermodel.HSSFRow; | |
| 76 | ||
| 77 | import org.apache.poi.hssf.usermodel.HSSFSheet; | |
| 78 | ||
| 79 | ||
| 80 | ||
| 81 | /** | |
| 82 | ||
| 83 | * @author Dimitri Pissarenko | |
| 84 | ||
| 85 | * | |
| 86 | ||
| 87 | */ | |
| 88 | ||
| 89 | public abstract class ExcelBalanceSheetRenderer implements BalanceSheetRenderer { | |
| 90 | ||
| 91 | private HSSFSheet workSheet; | |
| 92 | ||
| 93 | public final static String TASK_NAME_LABEL="Task name:"; | |
| 94 | ||
| 95 | public final static String INPUTS_LABEL="Inputs"; | |
| 96 | ||
| 97 | public final static String OUTPUTS_LABEL="Outputs"; | |
| 98 | ||
| 99 | public final static short TASK_NAME_LABEL_COL=0; | |
| 100 | ||
| 101 | public final static short TASK_NAME_VALUE_COL=1; | |
| 102 | ||
| 103 | public final static short INPUTS_OR_OUTPUTS_LABEL_COL=0; | |
| 104 | ||
| 105 | ||
| 106 | ||
| 107 | public ExcelBalanceSheetRenderer() | |
| 108 | ||
| 109 | 0 | { |
| 110 | ||
| 111 | 0 | } |
| 112 | ||
| 113 | /* (non-Javadoc) | |
| 114 | ||
| 115 | * @see net.sourceforge.demetrix.ui.balancesheets.BalanceSheetRenderer#render() | |
| 116 | ||
| 117 | */ | |
| 118 | ||
| 119 | public void render() { | |
| 120 | ||
| 121 | 0 | HSSFRow row=null; |
| 122 | ||
| 123 | 0 | HSSFCell cell=null; |
| 124 | ||
| 125 | 0 | Vector inputs=null; |
| 126 | ||
| 127 | 0 | Vector outputs=null; |
| 128 | ||
| 129 | ||
| 130 | ||
| 131 | 0 | row=this.workSheet.createRow((short)(this.workSheet.getLastRowNum()+1)); |
| 132 | ||
| 133 | 0 | cell=row.createCell(ExcelTaskBalanceSheetRenderer.TASK_NAME_LABEL_COL); |
| 134 | ||
| 135 | 0 | cell.setCellValue(ExcelTaskBalanceSheetRenderer.TASK_NAME_LABEL); |
| 136 | ||
| 137 | ||
| 138 | ||
| 139 | 0 | cell=row.createCell(ExcelTaskBalanceSheetRenderer.TASK_NAME_VALUE_COL); |
| 140 | ||
| 141 | 0 | cell.setCellValue(this.getTaskName()); |
| 142 | ||
| 143 | ||
| 144 | ||
| 145 | 0 | inputs=this.getInputs(); |
| 146 | ||
| 147 | 0 | this.printInputsOrOutputs(INPUTS_LABEL, inputs); |
| 148 | ||
| 149 | 0 | this.workSheet.createRow((short)(this.workSheet.getLastRowNum()+1)); |
| 150 | ||
| 151 | 0 | outputs=this.getOutputs(); |
| 152 | ||
| 153 | 0 | this.printInputsOrOutputs(OUTPUTS_LABEL, outputs); |
| 154 | ||
| 155 | ||
| 156 | ||
| 157 | 0 | } |
| 158 | ||
| 159 | private void printInputsOrOutputs(String label, Vector inputsOrOutputs) | |
| 160 | ||
| 161 | { | |
| 162 | ||
| 163 | 0 | HSSFRow row=null; |
| 164 | ||
| 165 | 0 | HSSFCell cell=null; |
| 166 | ||
| 167 | ||
| 168 | ||
| 169 | 0 | row=this.workSheet.createRow((short)(this.workSheet.getLastRowNum()+1)); |
| 170 | ||
| 171 | 0 | cell=row.createCell(ExcelTaskBalanceSheetRenderer.INPUTS_OR_OUTPUTS_LABEL_COL); |
| 172 | ||
| 173 | 0 | cell.setCellValue(label); |
| 174 | ||
| 175 | ||
| 176 | ||
| 177 | 0 | ProcessChainExcelWriter.writeDemetrixPropertiesHolder(this.workSheet, inputsOrOutputs); |
| 178 | ||
| 179 | 0 | } |
| 180 | ||
| 181 | public HSSFSheet getWorkSheet() { | |
| 182 | ||
| 183 | 0 | return workSheet; |
| 184 | ||
| 185 | } | |
| 186 | ||
| 187 | ||
| 188 | ||
| 189 | public void setWorkSheet(HSSFSheet sheet) { | |
| 190 | ||
| 191 | 0 | workSheet = sheet; |
| 192 | ||
| 193 | 0 | } |
| 194 | ||
| 195 | ||
| 196 | ||
| 197 | protected abstract String getTaskName(); | |
| 198 | ||
| 199 | protected abstract Vector getInputs(); | |
| 200 | ||
| 201 | protected abstract Vector getOutputs(); | |
| 202 | ||
| 203 | } | |
| 204 |
|
this report was generated by version 1.0.5 of jcoverage. |
copyright © 2003, jcoverage ltd. all rights reserved. |