1 | class AttachmentImageIconLoader {↵ | | 1 | class AttachmentImageIconLoader {↵
|
|
2 | /**↵ | | 2 | /**↵
|
3 | * Utility constructor.↵ | | 3 | * Utility constructor.↵
|
4 | */↵ | | 4 | */↵
|
5 | private AttachmentImageIconLoader() {↵ | | 5 | private AttachmentImageIconLoader() {↵
|
6 | }↵ | | 6 | }↵
|
|
7 | /**↵ | | 7 | /**↵
|
8 | * Returns the image icon for the content type.↵ | | 8 | * Returns the image icon for the content type.↵
|
9 | * ↵ | | 9 | * ↵
|
10 | * @param contentType↵ | | 10 | * @param contentType↵
|
11 | * content type↵ | | 11 | * content type↵
|
12 | * @param contentSubtype↵ | | 12 | * @param contentSubtype↵
|
13 | * content sub type↵ | | 13 | * content sub type↵
|
14 | * @return an Image Icon for the content type.↵ | | 14 | * @return an Image Icon for the content type.↵
|
15 | */↵ | | 15 | */↵
|
16 | public ImageIcon getImageIcon(String contentType, String contentSubtype) {↵ | | 16 | public ImageIcon getImageIcon(String contentType, String contentSubtype) {↵
|
17 | StringBuffer buf = new StringBuffer();↵ | | 17 | StringBuffer buf = new StringBuffer();↵
|
18 | buf.append("gnome-");↵ | | 18 | buf.append("gnome-");↵
|
19 | buf.append(contentType);↵ | | 19 | buf.append(contentType);↵
|
20 | buf.append("-");↵ | | 20 | buf.append("-");↵
|
21 | buf.append(contentSubtype);↵ | | 21 | buf.append(contentSubtype);↵
|
22 | buf.append(".png");↵ | | 22 | buf.append(".png");↵
|
|
23 | ImageIcon icon = ImageLoader.getMimetypeIcon(buf.toString());↵ | | 23 | ImageIcon icon = ImageLoader.getMimetypeIcon(buf.toString());↵
|
|
24 | if (icon == null) {↵ | | 24 | if (icon == null) {↵
|
25 | icon = ImageLoader.getMimetypeIcon("gnome-" + contentType↵ | | 25 | icon = ImageLoader.getMimetypeIcon("gnome-" + contentType↵
|
26 | + ".png");↵ | | 26 | + ".png");↵
|
27 | }↵ | | 27 | }↵
|
|
28 | if (icon == null) {↵ | | 28 | if (icon == null) {↵
|
29 | icon = ImageLoader.getMimetypeIcon("gnome-text.png");↵ | | 29 | icon = ImageLoader.getMimetypeIcon("gnome-text.png");↵
|
30 | }↵ | | 30 | }↵
|
|
31 | return icon;↵ | | 31 | return icon;↵
|
32 | }↵ | | 32 | }↵
|
33 | } | | 33 | }
|