1 2 17 18 19 20 package org.apache.poi.hssf.record; 21 22 23 24 import org.apache.poi.util.*; 25 26 33 public class SeriesLabelsRecord 34 extends Record 35 { 36 public final static short sid = 0x100c; 37 private short field_1_formatFlags; 38 private BitField showActual = new BitField(0x1); 39 private BitField showPercent = new BitField(0x2); 40 private BitField labelAsPercentage = new BitField(0x4); 41 private BitField smoothedLine = new BitField(0x8); 42 private BitField showLabel = new BitField(0x10); 43 private BitField showBubbleSizes = new BitField(0x20); 44 45 46 public SeriesLabelsRecord() 47 { 48 49 } 50 51 59 60 public SeriesLabelsRecord(short id, short size, byte [] data) 61 { 62 super(id, size, data); 63 64 } 65 66 75 76 public SeriesLabelsRecord(short id, short size, byte [] data, int offset) 77 { 78 super(id, size, data, offset); 79 80 } 81 82 87 protected void validateSid(short id) 88 { 89 if (id != sid) 90 { 91 throw new RecordFormatException("Not a SeriesLabels record"); 92 } 93 } 94 95 protected void fillFields(byte [] data, short size, int offset) 96 { 97 98 int pos = 0; 99 field_1_formatFlags = LittleEndian.getShort(data, pos + 0x0 + offset); 100 101 } 102 103 public String toString() 104 { 105 StringBuffer buffer = new StringBuffer (); 106 107 buffer.append("[ATTACHEDLABEL]\n"); 108 buffer.append(" .formatFlags = ") 109 .append("0x").append(HexDump.toHex( getFormatFlags ())) 110 .append(" (").append( getFormatFlags() ).append(" )"); 111 buffer.append(System.getProperty("line.separator")); 112 buffer.append(" .showActual = ").append(isShowActual()).append('\n'); 113 buffer.append(" .showPercent = ").append(isShowPercent()).append('\n'); 114 buffer.append(" .labelAsPercentage = ").append(isLabelAsPercentage()).append('\n'); 115 buffer.append(" .smoothedLine = ").append(isSmoothedLine()).append('\n'); 116 buffer.append(" .showLabel = ").append(isShowLabel()).append('\n'); 117 buffer.append(" .showBubbleSizes = ").append(isShowBubbleSizes()).append('\n'); 118 119 buffer.append("[/ATTACHEDLABEL]\n"); 120 return buffer.toString(); 121 } 122 123 public int serialize(int offset, byte[] data) 124 { 125 int pos = 0; 126 127 LittleEndian.putShort(data, 0 + offset, sid); 128 LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4)); 129 130 LittleEndian.putShort(data, 4 + offset + pos, field_1_formatFlags); 131 132 return getRecordSize(); 133 } 134 135 138 public int getRecordSize() 139 { 140 return 4 + 2; 141 } 142 143 public short getSid() 144 { 145 return this.sid; 146 } 147 148 public Object clone() { 149 SeriesLabelsRecord rec = new SeriesLabelsRecord(); 150 151 rec.field_1_formatFlags = field_1_formatFlags; 152 return rec; 153 } 154 155 156 157 158 161 public short getFormatFlags() 162 { 163 return field_1_formatFlags; 164 } 165 166 169 public void setFormatFlags(short field_1_formatFlags) 170 { 171 this.field_1_formatFlags = field_1_formatFlags; 172 } 173 174 178 public void setShowActual(boolean value) 179 { 180 field_1_formatFlags = showActual.setShortBoolean(field_1_formatFlags, value); 181 } 182 183 187 public boolean isShowActual() 188 { 189 return showActual.isSet(field_1_formatFlags); 190 } 191 192 196 public void setShowPercent(boolean value) 197 { 198 field_1_formatFlags = showPercent.setShortBoolean(field_1_formatFlags, value); 199 } 200 201 205 public boolean isShowPercent() 206 { 207 return showPercent.isSet(field_1_formatFlags); 208 } 209 210 214 public void setLabelAsPercentage(boolean value) 215 { 216 field_1_formatFlags = labelAsPercentage.setShortBoolean(field_1_formatFlags, value); 217 } 218 219 223 public boolean isLabelAsPercentage() 224 { 225 return labelAsPercentage.isSet(field_1_formatFlags); 226 } 227 228 232 public void setSmoothedLine(boolean value) 233 { 234 field_1_formatFlags = smoothedLine.setShortBoolean(field_1_formatFlags, value); 235 } 236 237 241 public boolean isSmoothedLine() 242 { 243 return smoothedLine.isSet(field_1_formatFlags); 244 } 245 246 250 public void setShowLabel(boolean value) 251 { 252 field_1_formatFlags = showLabel.setShortBoolean(field_1_formatFlags, value); 253 } 254 255 259 public boolean isShowLabel() 260 { 261 return showLabel.isSet(field_1_formatFlags); 262 } 263 264 268 public void setShowBubbleSizes(boolean value) 269 { 270 field_1_formatFlags = showBubbleSizes.setShortBoolean(field_1_formatFlags, value); 271 } 272 273 277 public boolean isShowBubbleSizes() 278 { 279 return showBubbleSizes.isSet(field_1_formatFlags); 280 } 281 282 283 } 285 286 287 288 | Popular Tags |