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: * Record for the bottom margin.
024: * NOTE: This source was automatically generated.
025: *
026: * @author Shawn Laubach (slaubach at apache dot org)
027: */
028: public class BottomMarginRecord extends Record implements Margin {
029: public final static short sid = 0x29;
030: private double field_1_margin;
031:
032: public BottomMarginRecord() {
033:
034: }
035:
036: /**
037: * Constructs a BottomMargin record and sets its fields appropriately.
038: *
039: * @param in the RecordInputstream to read the record from
040: */
041: public BottomMarginRecord(RecordInputStream in) {
042: super (in);
043: }
044:
045: /**
046: * Checks the sid matches the expected side for this record
047: *
048: * @param id the expected sid.
049: */
050: protected void validateSid(short id) {
051: if (id != sid) {
052: throw new RecordFormatException("Not a BottomMargin record");
053: }
054: }
055:
056: protected void fillFields(RecordInputStream in) {
057: field_1_margin = in.readDouble();
058: }
059:
060: public String toString() {
061: StringBuffer buffer = new StringBuffer();
062: buffer.append("[BottomMargin]\n");
063: buffer.append(" .margin = ").append(" (")
064: .append(getMargin()).append(" )\n");
065: buffer.append("[/BottomMargin]\n");
066: return buffer.toString();
067: }
068:
069: public int serialize(int offset, byte[] data) {
070: LittleEndian.putShort(data, 0 + offset, sid);
071: LittleEndian.putShort(data, 2 + offset,
072: (short) (getRecordSize() - 4));
073: LittleEndian.putDouble(data, 4 + offset, field_1_margin);
074: return getRecordSize();
075: }
076:
077: /**
078: * Size of record (exluding 4 byte header)
079: */
080: public int getRecordSize() {
081: return 4 + 8;
082: }
083:
084: public short getSid() {
085: return sid;
086: }
087:
088: /**
089: * Get the margin field for the BottomMargin record.
090: */
091: public double getMargin() {
092: return field_1_margin;
093: }
094:
095: /**
096: * Set the margin field for the BottomMargin record.
097: */
098: public void setMargin(double field_1_margin) {
099: this .field_1_margin = field_1_margin;
100: }
101:
102: public Object clone() {
103: BottomMarginRecord rec = new BottomMarginRecord();
104: rec.field_1_margin = this .field_1_margin;
105: return rec;
106: }
107:
108: } // END OF CLASS
|