KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jxl > biff > drawing > ShapeType


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.biff.drawing;
21
22 /**
23  * Enumerations for the shape type
24  */

25 final class ShapeType
26 {
27   /**
28    * The value
29    */

30   int value;
31   
32   private static ShapeType[] types = new ShapeType[0];
33   ShapeType(int v)
34   {
35     value = v;
36     
37     ShapeType[] old = types;
38     types = new ShapeType[types.length+1];
39     System.arraycopy(old, 0, types, 0, old.length);
40     types[old.length] = this;
41   }
42   
43   static ShapeType getType(int v)
44   {
45     ShapeType st = UNKNOWN;
46     boolean found = false;
47     for (int i = 0 ; i < types.length && !found ; i++)
48     {
49       if (types[i].value == v)
50       {
51         found = true;
52         st = types[i];
53       }
54     }
55     return st;
56   }
57
58   public static final ShapeType MIN = new ShapeType(0);
59   public static final ShapeType PICTURE_FRAME = new ShapeType(75);
60   public static final ShapeType HOST_CONTROL = new ShapeType(201);
61   public static final ShapeType TEXT_BOX = new ShapeType(202);
62   public static final ShapeType UNKNOWN = new ShapeType(-1);
63 }
64
Popular Tags