1 28 package net.sf.jasperreports.engine.fill; 29 30 import net.sf.jasperreports.engine.JRExpression; 31 import net.sf.jasperreports.engine.JRField; 32 33 34 38 public class JRFillField implements JRField 39 { 40 41 42 45 protected JRField parent = null; 46 47 50 private Object previousOldValue = null; 51 private Object oldValue = null; 52 private Object value = null; 53 private Object savedValue; 54 55 56 59 protected JRFillField( 60 JRField field, 61 JRFillObjectFactory factory 62 ) 63 { 64 factory.put(field, this); 65 66 parent = field; 67 } 68 69 70 73 public String getName() 74 { 75 return parent.getName(); 76 } 77 78 81 public String getDescription() 82 { 83 return parent.getDescription(); 84 } 85 86 89 public void setDescription(String description) 90 { 91 } 92 93 96 public Class getValueClass() 97 { 98 return parent.getValueClass(); 99 } 100 101 104 public String getValueClassName() 105 { 106 return parent.getValueClassName(); 107 } 108 109 112 public Object getOldValue() 113 { 114 return oldValue; 115 } 116 117 120 public void setOldValue(Object oldValue) 121 { 122 this.oldValue = oldValue; 123 } 124 125 128 public Object getValue() 129 { 130 return value; 131 } 132 133 136 public void setValue(Object value) 137 { 138 this.value = value; 139 } 140 141 public Object getValue(byte evaluation) 142 { 143 Object returnValue; 144 switch (evaluation) 145 { 146 case JRExpression.EVALUATION_OLD: 147 returnValue = oldValue; 148 break; 149 default: 150 returnValue = value; 151 break; 152 } 153 return returnValue; 154 } 155 156 public void overwriteValue(Object newValue, byte evaluation) 157 { 158 switch (evaluation) 159 { 160 case JRExpression.EVALUATION_OLD: 161 savedValue = oldValue; 162 oldValue = newValue; 163 break; 164 default: 165 savedValue = value; 166 value = newValue; 167 break; 168 } 169 } 170 171 public void restoreValue(byte evaluation) 172 { 173 switch (evaluation) 174 { 175 case JRExpression.EVALUATION_OLD: 176 oldValue = savedValue; 177 break; 178 default: 179 value = savedValue; 180 break; 181 } 182 savedValue = null; 183 } 184 185 186 187 public Object getPreviousOldValue() 188 { 189 return previousOldValue; 190 } 191 192 193 194 public void setPreviousOldValue(Object previousOldValue) 195 { 196 this.previousOldValue = previousOldValue; 197 } 198 199 } 200 | Popular Tags |