| 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.ArrayList; | |
| 66 | ||
| 67 | ||
| 68 | ||
| 69 | import javax.swing.table.DefaultTableModel; | |
| 70 | ||
| 71 | ||
| 72 | ||
| 73 | import net.sourceforge.demetrix.properties.DemetrixPropertiesHolder; | |
| 74 | ||
| 75 | import net.sourceforge.demetrix.properties.DemetrixPropertiesStorage; | |
| 76 | ||
| 77 | ||
| 78 | ||
| 79 | public class BalanceSheetTableModel extends DefaultTableModel { | |
| 80 | ||
| 81 | private ArrayList columnNames; | |
| 82 | ||
| 83 | private ArrayList rows; | |
| 84 | ||
| 85 | public BalanceSheetTableModel(ArrayList resources) | |
| 86 | ||
| 87 | { | |
| 88 | ||
| 89 | 2 | super(); |
| 90 | ||
| 91 | ||
| 92 | ||
| 93 | 2 | this.rows=resources; |
| 94 | ||
| 95 | 2 | this.columnNames=DemetrixPropertiesStorage.getAllPropertyNames(this.rows); |
| 96 | ||
| 97 | 2 | } |
| 98 | ||
| 99 | ||
| 100 | ||
| 101 | /* (non-Javadoc) | |
| 102 | ||
| 103 | * @see javax.swing.table.TableModel#getColumnClass(int) | |
| 104 | ||
| 105 | */ | |
| 106 | ||
| 107 | public Class getColumnClass(int col) { | |
| 108 | ||
| 109 | 0 | return getValueAt(0, col).getClass(); |
| 110 | ||
| 111 | } | |
| 112 | ||
| 113 | /* (non-Javadoc) | |
| 114 | ||
| 115 | * @see javax.swing.table.TableModel#getColumnCount() | |
| 116 | ||
| 117 | */ | |
| 118 | ||
| 119 | public int getColumnCount() { | |
| 120 | ||
| 121 | 2 | return this.columnNames.size(); |
| 122 | ||
| 123 | } | |
| 124 | ||
| 125 | /* (non-Javadoc) | |
| 126 | ||
| 127 | * @see javax.swing.table.TableModel#getColumnName(int) | |
| 128 | ||
| 129 | */ | |
| 130 | ||
| 131 | public String getColumnName(int index) { | |
| 132 | ||
| 133 | 0 | return (String)this.columnNames.get(index); |
| 134 | ||
| 135 | } | |
| 136 | ||
| 137 | ||
| 138 | ||
| 139 | /* (non-Javadoc) | |
| 140 | ||
| 141 | * @see javax.swing.table.TableModel#getRowCount() | |
| 142 | ||
| 143 | */ | |
| 144 | ||
| 145 | public int getRowCount() { | |
| 146 | ||
| 147 | 4 | if (this.rows!=null) |
| 148 | ||
| 149 | { | |
| 150 | ||
| 151 | 0 | return this.rows.size(); |
| 152 | ||
| 153 | } | |
| 154 | ||
| 155 | else | |
| 156 | ||
| 157 | { | |
| 158 | ||
| 159 | 4 | return 0; |
| 160 | ||
| 161 | } | |
| 162 | ||
| 163 | } | |
| 164 | ||
| 165 | ||
| 166 | ||
| 167 | /* (non-Javadoc) | |
| 168 | ||
| 169 | * @see javax.swing.table.TableModel#getValueAt(int, int) | |
| 170 | ||
| 171 | */ | |
| 172 | ||
| 173 | public Object getValueAt(int row, int col) { | |
| 174 | ||
| 175 | 0 | DemetrixPropertiesHolder inputOrOutput=null; |
| 176 | ||
| 177 | 0 | String propertyName=null; |
| 178 | ||
| 179 | ||
| 180 | ||
| 181 | 0 | inputOrOutput=(DemetrixPropertiesHolder)this.rows.get(row); |
| 182 | ||
| 183 | 0 | propertyName=(String)this.columnNames.get(col); |
| 184 | ||
| 185 | ||
| 186 | ||
| 187 | 0 | return inputOrOutput.getProperty(propertyName).getValue(); |
| 188 | ||
| 189 | } | |
| 190 | ||
| 191 | ||
| 192 | ||
| 193 | /* (non-Javadoc) | |
| 194 | ||
| 195 | * @see javax.swing.table.TableModel#isCellEditable(int, int) | |
| 196 | ||
| 197 | */ | |
| 198 | ||
| 199 | public boolean isCellEditable(int row, int col) { | |
| 200 | ||
| 201 | 0 | DemetrixPropertiesHolder inputOrOutput=null; |
| 202 | ||
| 203 | 0 | String propertyName=null; |
| 204 | ||
| 205 | ||
| 206 | ||
| 207 | 0 | inputOrOutput=(DemetrixPropertiesHolder)this.rows.get(row); |
| 208 | ||
| 209 | 0 | propertyName=(String)this.columnNames.get(col); |
| 210 | ||
| 211 | ||
| 212 | ||
| 213 | 0 | return !(inputOrOutput.getProperty(propertyName).isReadOnly()); |
| 214 | ||
| 215 | ||
| 216 | ||
| 217 | } | |
| 218 | ||
| 219 | ||
| 220 | ||
| 221 | /* (non-Javadoc) | |
| 222 | ||
| 223 | * @see javax.swing.table.TableModel#setValueAt(java.lang.Object, int, int) | |
| 224 | ||
| 225 | */ | |
| 226 | ||
| 227 | public void setValueAt(Object value, int row, int col) { | |
| 228 | ||
| 229 | 0 | DemetrixPropertiesHolder inputOrOutput=null; |
| 230 | ||
| 231 | 0 | String propertyName=null; |
| 232 | ||
| 233 | ||
| 234 | ||
| 235 | 0 | inputOrOutput=(DemetrixPropertiesHolder)this.rows.get(row); |
| 236 | ||
| 237 | 0 | propertyName=(String)this.columnNames.get(col); |
| 238 | ||
| 239 | ||
| 240 | ||
| 241 | 0 | inputOrOutput.getProperty(propertyName).setValue(value); |
| 242 | ||
| 243 | 0 | } |
| 244 | ||
| 245 | } | |
| 246 |
|
this report was generated by version 1.0.5 of jcoverage. |
copyright © 2003, jcoverage ltd. all rights reserved. |