1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 package org.utgenome.gwt.utgb.client.track;
26
27 import java.util.HashMap;
28
29 import org.utgenome.gwt.utgb.client.ui.IconImage;
30
31 import com.google.gwt.user.client.ui.Image;
32
33
34
35
36
37
38
39 public class Design {
40
41 public static int ICON_UNKNOWN = 0;
42 public static int ICON_CONFIG = 1;
43 public static int ICON_PACK = 2;
44 public static int ICON_UNPACK = 3;
45 public static int ICON_HIDE = 4;
46 public static int ICON_SHOW = 5;
47 public static int ICON_CLOSE = 6;
48 public static int TRACK_BORDER_V = 101;
49 public static int TRACK_BORDER_H = 102;
50
51 public static String PREFIX = "theme/image/";
52
53 public static String IMAGE_NOT_AVAILABLE = PREFIX + "na.png";
54 public static String IMAGE_RULER_TICK = PREFIX + "ruler-tick.gif";
55 public static String IMAGE_TRANSPARENT = PREFIX + "transparent.gif";
56 public static String IMAGE_DELETE_BUTTON = PREFIX + "tree_closed.gif";
57 public static String IMAGE_NOW_LOADING = PREFIX + "nowloading.gif";
58
59 private static HashMap<Integer, IconImage> _iconTable = new HashMap<Integer, IconImage>();
60
61 static {
62
63 Image.prefetch(IMAGE_NOT_AVAILABLE);
64 Image.prefetch(IMAGE_RULER_TICK);
65 Image.prefetch(IMAGE_TRANSPARENT);
66 Image.prefetch(IMAGE_DELETE_BUTTON);
67 Image.prefetch(IMAGE_NOW_LOADING);
68
69
70 addIcon(ICON_UNKNOWN, new IconImage(PREFIX + "transparent.gif", PREFIX + "transparent.gif"));
71 addIcon(ICON_CONFIG, new IconImage(PREFIX + "track-config.gif", PREFIX + "track-config-w.gif"));
72 addIcon(ICON_PACK, new IconImage(PREFIX + "track-pack.gif", PREFIX + "track-pack-w.gif"));
73 addIcon(ICON_UNPACK, new IconImage(PREFIX + "track-unpack.gif", PREFIX + "track-unpack.gif"));
74 addIcon(ICON_HIDE, new IconImage(PREFIX + "track-hide.gif", PREFIX + "track-hide-w.gif"));
75 addIcon(ICON_SHOW, new IconImage(PREFIX + "track-open.gif", PREFIX + "track-open-w.gif"));
76 addIcon(ICON_CLOSE, new IconImage(PREFIX + "track-close.gif", PREFIX + "track-close-w.gif"));
77
78
79 addIcon(TRACK_BORDER_V, new IconImage(PREFIX + "dragbar.png", PREFIX + "dragbar_active.png"));
80 addIcon(TRACK_BORDER_H, new IconImage(PREFIX + "resizebar.png", PREFIX + "resizebar_active.png"));
81 }
82
83 public static void addIcon(int iconType, IconImage icon) {
84 _iconTable.put(new Integer(iconType), icon);
85 }
86
87
88
89
90
91
92
93 public static IconImage getIconImage(int iconType) {
94 Integer key = new Integer(iconType);
95 if (_iconTable.containsKey(key))
96 return _iconTable.get(key);
97 else
98 return _iconTable.get(new Integer(ICON_UNKNOWN));
99
100 }
101
102
103
104
105 private Design() {
106 }
107 }