KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jxl > read > biff > LabelSSTRecord


1 /*********************************************************************
2 *
3 * Copyright (C) 2002 Andrew Khan
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 ***************************************************************************/

19
20 package jxl.read.biff;
21
22 import jxl.LabelCell;
23 import jxl.CellType;
24 import jxl.biff.IntegerHelper;
25 import jxl.biff.FormattingRecords;
26
27 /**
28  * A label which is stored in the shared string table
29  */

30 class LabelSSTRecord extends CellValue implements LabelCell
31 {
32   /**
33    * The index into the shared string table
34    */

35   private int index;
36   /**
37    * The label
38    */

39   private String JavaDoc string;
40
41   /**
42    * Constructor. Retrieves the index from the raw data and looks it up
43    * in the shared string table
44    *
45    * @param stringTable the shared string table
46    * @param t the raw data
47    * @param fr the formatting records
48    * @param si the sheet
49    */

50   public LabelSSTRecord(Record t, SSTRecord stringTable, FormattingRecords fr,
51                         SheetImpl si)
52   {
53     super(t, fr, si);
54     byte[] data = getRecord().getData();
55     index = IntegerHelper.getInt(data[6], data[7], data[8], data[9]);
56     string = stringTable.getString(index);
57   }
58
59   /**
60    * Gets the label
61    *
62    * @return the label
63    */

64   public String JavaDoc getString()
65   {
66     return string;
67   }
68
69   /**
70    * Gets this cell's contents as a string
71    *
72    * @return the label
73    */

74   public String JavaDoc getContents()
75   {
76     return string;
77   }
78
79   /**
80    * Returns the cell type
81    *
82    * @return the cell type
83    */

84   public CellType getType()
85   {
86     return CellType.LABEL;
87   }
88 }
89
Popular Tags