KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jxl > CellView


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;
21
22 import jxl.format.CellFormat;
23
24 /**
25  * This is a bean which client applications may use to get/set various
26  * properties for a row or column on a spreadsheet
27  */

28 public final class CellView
29 {
30   /**
31    * The dimension for the associated group of cells. For columns this
32    * will be width in characters, for rows this will be the
33    * height in points
34    * This attribute is deprecated in favour of the size attribute
35    */

36   private int dimension;
37
38   /**
39    * The size for the associated group of cells. For columns this
40    * will be width in characters multiplied by 256, for rows this will be the
41    * height in points
42    */

43   private int size;
44
45   /**
46    * Indicates whether the deprecated function was used to set the dimension
47    */

48   private boolean depUsed;
49
50   /**
51    * Indicates whether or not this sheet is hidden
52    */

53   private boolean hidden;
54
55   /**
56    * The cell format for the row/column
57    */

58   private CellFormat format;
59
60   /**
61    * Default constructor
62    */

63   public CellView()
64   {
65     hidden = false;
66     depUsed =false;
67     dimension = 1;
68     size = 1;
69   }
70
71   /**
72    * Sets the hidden status of this row/column
73    *
74    * @param h the hidden flag
75    */

76   public void setHidden(boolean h)
77   {
78     hidden = h;
79   }
80
81   /**
82    * Accessor for the hidden nature of this row/column
83    *
84    * @return TRUE if this row/column is hidden, FALSE otherwise
85    */

86   public boolean isHidden()
87   {
88     return hidden;
89   }
90
91   /**
92    * Sets the dimension for this view
93    *
94    * @param d the width of the column in characters, or the height of the
95    * row in 1/20ths of a point
96    * @deprecated use the setSize method instead
97    */

98   public void setDimension(int d)
99   {
100     dimension = d;
101     depUsed = true;
102   }
103
104   /**
105    * Sets the dimension for this view
106    *
107    * @param d the width of the column in characters multiplied by 256,
108    * or the height of the
109    * row in 1/20ths of a point
110    */

111   public void setSize(int d)
112   {
113     size = d;
114     depUsed = false;
115   }
116
117   /**
118    * Gets the width of the column in characters or the height of the
119    * row in 1/20ths
120    *
121    * @return the dimension
122    * @deprecated use getSize() instead
123    */

124   public int getDimension()
125   {
126     return dimension;
127   }
128
129   /**
130    * Gets the width of the column in characters multiplied by 256, or the
131    * height of the row in 1/20ths of a point
132    *
133    * @return the dimension
134    */

135   public int getSize()
136   {
137     return size;
138   }
139
140   /**
141    * Sets the cell format for this group of cells
142    *
143    * @param cf the format for every cell in the column/row
144    */

145   public void setFormat(CellFormat cf)
146   {
147     format = cf;
148   }
149
150   /**
151    * Accessor for the cell format for this group.
152    *
153    * @return the format for the column/row, or NULL if no format was
154    * specified
155    */

156   public CellFormat getFormat()
157   {
158     return format;
159   }
160
161   /**
162    * Accessor for the depUsed attribute
163    *
164    * @return TRUE if the deprecated methods were used to set the size,
165    * FALSE otherwise
166    */

167   public boolean depUsed()
168   {
169     return depUsed;
170   }
171 }
172
Popular Tags