KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*********************************************************************
2 *
3 * Copyright (C) 2004 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 common.Assert;
23
24 /**
25  * Class which encapsulates a data validation (typically in the form of a 7
26  * dropdown list box
27  */

28 public class DataValidation
29 {
30   /**
31    * The data validity list
32    */

33   private DataValidityListRecord validityList;
34
35   /**
36    * The data validity record
37    */

38   private DataValiditySettingsRecord[] validitySettings;
39
40   /**
41    * The current position in the validitySettins array
42    */

43   private int pos;
44
45   /**
46    * Constructor
47    */

48   DataValidation(DataValidityListRecord dvlr)
49   {
50     validityList = dvlr;
51     validitySettings =
52       new DataValiditySettingsRecord[validityList.getNumberOfSettings()];
53     pos = 0;
54   }
55
56   /**
57    * Adds a new settings object to this data validation
58    */

59   void add(DataValiditySettingsRecord dvsr)
60   {
61     Assert.verify(pos < validitySettings.length);
62
63     validitySettings[pos] = dvsr;
64     pos++;
65   }
66
67   /**
68    * Accessor for the validity list. Used when copying sheets
69    */

70   public DataValidityListRecord getDataValidityList()
71   {
72     return validityList;
73   }
74
75   /**
76    * Accessor for the validity settings. Used when copying sheets
77    */

78   public DataValiditySettingsRecord[] getDataValiditySettings()
79   {
80     return validitySettings;
81   }
82
83 }
84
Popular Tags