KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*********************************************************************
2 *
3 * Copyright (C) 2003 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  * Enumeration for the BLIP type
24  */

25 final class BlipType
26 {
27   private int value;
28   private String JavaDoc desc;
29
30   private static BlipType[] types = new BlipType[0];
31
32   private BlipType(int val, String JavaDoc d)
33   {
34     value = val;
35     desc = d;
36
37     BlipType[] newtypes = new BlipType[types.length+1];
38     System.arraycopy(types, 0, newtypes, 0, types.length);
39     newtypes[types.length] = this;
40     types = newtypes;
41   }
42
43   public String JavaDoc getDescription()
44   {
45     return desc;
46   }
47
48   public int getValue()
49   {
50     return value;
51   }
52
53   public static BlipType getType(int val)
54   {
55     BlipType type = UNKNOWN;
56     for (int i = 0 ; i < types.length ; i++)
57     {
58       if (types[i].value == val)
59       {
60         type = types[i];
61         break;
62       }
63     }
64
65     return type;
66   }
67
68   public static final BlipType ERROR = new BlipType(0, "Error"); // An error occured during loading
69
public static final BlipType UNKNOWN = new BlipType(1, "Unknown"); // An unknown blip type
70
public static final BlipType EMF = new BlipType(2, "EMF"); // Windows Enhanced Metafile
71
public static final BlipType WMF = new BlipType(3, "WMF"); // Windows Metafile
72
public static final BlipType PICT = new BlipType(4, "PICT"); // Macintosh PICT
73
public static final BlipType JPEG = new BlipType(5, "JPEG"); // JFIF
74
public static final BlipType PNG = new BlipType(6, "PNG"); // PNG
75
public static final BlipType DIB = new BlipType(7, "DIB"); // Windows DIB
76
public static final BlipType FIRST_CLIENT = new BlipType(32, "FIRST"); // First client defined blip type
77
public static final BlipType LAST_CLIENT = new BlipType(255, "LAST"); // Last client defined blip type
78
}
79
Popular Tags