KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jxl > write > Number


1 /*********************************************************************
2 *
3 * Copyright (C) 2001 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.write;
21
22 import jxl.NumberCell;
23 import jxl.write.biff.NumberRecord;
24 import jxl.format.CellFormat;
25
26 /**
27  * A cell, created by user applications, which contains a numerical value
28  */

29 public class Number extends NumberRecord implements WritableCell, NumberCell
30 {
31   /**
32    * Constructs a number, which, when added to a spreadsheet, will display the
33    * specified value at the column/row position indicated. By default, the
34    * cell will display with an accuracy of 3 decimal places
35    *
36    * @param c the column
37    * @param r the row
38    * @param val the value
39    */

40   public Number(int c, int r, double val)
41   {
42     super(c, r, val);
43   }
44
45   /**
46    * Constructs a number, which, when added to a spreadsheet, will display the
47    * specified value at the column/row position with the specified CellFormat.
48    * The CellFormat may specify font information and number format information
49    * such as the number of decimal places
50    *
51    * @param c the column
52    * @param r the row
53    * @param val the value
54    * @param st the cell format
55    */

56   public Number(int c, int r, double val, CellFormat st)
57   {
58     super(c, r, val, st);
59   }
60
61   /**
62    * Constructor used internally by the application when making a writable
63    * copy of a spreadsheet that has been read in
64    *
65    * @param nc the cell to copy
66    */

67   public Number(NumberCell nc)
68   {
69     super(nc);
70   }
71
72   /**
73    * Sets the numerical value for this cell
74    *
75    * @param val the value
76    */

77   public void setValue(double val)
78   {
79     super.setValue(val);
80   }
81
82   /**
83    * Copy constructor used for deep copying
84    *
85    * @param col the column
86    * @param row the row
87    * @param n the number to copy
88    */

89   protected Number(int col, int row, Number JavaDoc n)
90   {
91     super(col, row, n);
92   }
93
94   /**
95    * Implementation of the deep copy function
96    *
97    * @param col the column which the new cell will occupy
98    * @param row the row which the new cell will occupy
99    * @return a copy of this cell, which can then be added to the sheet
100    */

101   public WritableCell copyTo(int col, int row)
102   {
103     return new Number JavaDoc(col, row, this);
104   }
105
106 }
107
Popular Tags