001: /* ====================================================================
002: Licensed to the Apache Software Foundation (ASF) under one or more
003: contributor license agreements. See the NOTICE file distributed with
004: this work for additional information regarding copyright ownership.
005: The ASF licenses this file to You under the Apache License, Version 2.0
006: (the "License"); you may not use this file except in compliance with
007: the License. You may obtain a copy of the License at
008:
009: http://www.apache.org/licenses/LICENSE-2.0
010:
011: Unless required by applicable law or agreed to in writing, software
012: distributed under the License is distributed on an "AS IS" BASIS,
013: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: See the License for the specific language governing permissions and
015: limitations under the License.
016: ==================================================================== */
017:
018: package org.apache.poi.hssf.record;
019:
020: import org.apache.poi.util.*;
021:
022: /**
023: * The axis line format record defines the axis type details.
024: * NOTE: This source is automatically generated please do not modify this file. Either subclass or
025: * remove the record in src/records/definitions.
026:
027: * @author Glen Stampoultzis (glens at apache.org)
028: */
029: public class AxisLineFormatRecord extends Record {
030: public final static short sid = 0x1021;
031: private short field_1_axisType;
032: public final static short AXIS_TYPE_AXIS_LINE = 0;
033: public final static short AXIS_TYPE_MAJOR_GRID_LINE = 1;
034: public final static short AXIS_TYPE_MINOR_GRID_LINE = 2;
035: public final static short AXIS_TYPE_WALLS_OR_FLOOR = 3;
036:
037: public AxisLineFormatRecord() {
038:
039: }
040:
041: /**
042: * Constructs a AxisLineFormat record and sets its fields appropriately.
043: *
044: * @param in the RecordInputstream to read the record from
045: */
046:
047: public AxisLineFormatRecord(RecordInputStream in) {
048: super (in);
049:
050: }
051:
052: /**
053: * Checks the sid matches the expected side for this record
054: *
055: * @param id the expected sid.
056: */
057: protected void validateSid(short id) {
058: if (id != sid) {
059: throw new RecordFormatException(
060: "Not a AxisLineFormat record");
061: }
062: }
063:
064: protected void fillFields(RecordInputStream in) {
065: field_1_axisType = in.readShort();
066: }
067:
068: public String toString() {
069: StringBuffer buffer = new StringBuffer();
070:
071: buffer.append("[AXISLINEFORMAT]\n");
072: buffer.append(" .axisType = ").append("0x")
073: .append(HexDump.toHex(getAxisType())).append(" (")
074: .append(getAxisType()).append(" )");
075: buffer.append(System.getProperty("line.separator"));
076:
077: buffer.append("[/AXISLINEFORMAT]\n");
078: return buffer.toString();
079: }
080:
081: public int serialize(int offset, byte[] data) {
082: int pos = 0;
083:
084: LittleEndian.putShort(data, 0 + offset, sid);
085: LittleEndian.putShort(data, 2 + offset,
086: (short) (getRecordSize() - 4));
087:
088: LittleEndian.putShort(data, 4 + offset + pos, field_1_axisType);
089:
090: return getRecordSize();
091: }
092:
093: /**
094: * Size of record (exluding 4 byte header)
095: */
096: public int getRecordSize() {
097: return 4 + 2;
098: }
099:
100: public short getSid() {
101: return sid;
102: }
103:
104: public Object clone() {
105: AxisLineFormatRecord rec = new AxisLineFormatRecord();
106:
107: rec.field_1_axisType = field_1_axisType;
108: return rec;
109: }
110:
111: /**
112: * Get the axis type field for the AxisLineFormat record.
113: *
114: * @return One of
115: * AXIS_TYPE_AXIS_LINE
116: * AXIS_TYPE_MAJOR_GRID_LINE
117: * AXIS_TYPE_MINOR_GRID_LINE
118: * AXIS_TYPE_WALLS_OR_FLOOR
119: */
120: public short getAxisType() {
121: return field_1_axisType;
122: }
123:
124: /**
125: * Set the axis type field for the AxisLineFormat record.
126: *
127: * @param field_1_axisType
128: * One of
129: * AXIS_TYPE_AXIS_LINE
130: * AXIS_TYPE_MAJOR_GRID_LINE
131: * AXIS_TYPE_MINOR_GRID_LINE
132: * AXIS_TYPE_WALLS_OR_FLOOR
133: */
134: public void setAxisType(short field_1_axisType) {
135: this .field_1_axisType = field_1_axisType;
136: }
137:
138: } // END OF CLASS
|