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 DefaultDataLabelTextPropertiesRecord 34 extends Record 35 { 36 public final static short sid = 0x1024; 37 private short field_1_categoryDataType; 38 public final static short CATEGORY_DATA_TYPE_SHOW_LABELS_CHARACTERISTIC = 0; 39 public final static short CATEGORY_DATA_TYPE_VALUE_AND_PERCENTAGE_CHARACTERISTIC = 1; 40 public final static short CATEGORY_DATA_TYPE_ALL_TEXT_CHARACTERISTIC = 2; 41 42 43 public DefaultDataLabelTextPropertiesRecord() 44 { 45 46 } 47 48 56 57 public DefaultDataLabelTextPropertiesRecord(short id, short size, byte [] data) 58 { 59 super(id, size, data); 60 61 } 62 63 72 73 public DefaultDataLabelTextPropertiesRecord(short id, short size, byte [] data, int offset) 74 { 75 super(id, size, data, offset); 76 77 } 78 79 84 protected void validateSid(short id) 85 { 86 if (id != sid) 87 { 88 throw new RecordFormatException("Not a DefaultDataLabelTextProperties record"); 89 } 90 } 91 92 protected void fillFields(byte [] data, short size, int offset) 93 { 94 95 int pos = 0; 96 field_1_categoryDataType = LittleEndian.getShort(data, pos + 0x0 + offset); 97 98 } 99 100 public String toString() 101 { 102 StringBuffer buffer = new StringBuffer (); 103 104 buffer.append("[DEFAULTTEXT]\n"); 105 buffer.append(" .categoryDataType = ") 106 .append("0x").append(HexDump.toHex( getCategoryDataType ())) 107 .append(" (").append( getCategoryDataType() ).append(" )"); 108 buffer.append(System.getProperty("line.separator")); 109 110 buffer.append("[/DEFAULTTEXT]\n"); 111 return buffer.toString(); 112 } 113 114 public int serialize(int offset, byte[] data) 115 { 116 int pos = 0; 117 118 LittleEndian.putShort(data, 0 + offset, sid); 119 LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4)); 120 121 LittleEndian.putShort(data, 4 + offset + pos, field_1_categoryDataType); 122 123 return getRecordSize(); 124 } 125 126 129 public int getRecordSize() 130 { 131 return 4 + 2; 132 } 133 134 public short getSid() 135 { 136 return this.sid; 137 } 138 139 public Object clone() { 140 DefaultDataLabelTextPropertiesRecord rec = new DefaultDataLabelTextPropertiesRecord(); 141 142 rec.field_1_categoryDataType = field_1_categoryDataType; 143 return rec; 144 } 145 146 147 148 149 157 public short getCategoryDataType() 158 { 159 return field_1_categoryDataType; 160 } 161 162 171 public void setCategoryDataType(short field_1_categoryDataType) 172 { 173 this.field_1_categoryDataType = field_1_categoryDataType; 174 } 175 176 177 } 179 180 181 182 | Popular Tags |