Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.plugin / org.gvsig.app / org.gvsig.app.mainplugin / src / main / java / org / gvsig / app / extension / develtools / IconThemeDevelTool.java @ 47423

History | View | Annotate | Download (29.4 KB)

1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 3
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
package org.gvsig.app.extension.develtools;
25

    
26
import java.awt.Image;
27
import java.util.ArrayList;
28
import java.util.Arrays;
29
import java.util.Collections;
30
import java.util.HashSet;
31
import java.util.Iterator;
32
import java.util.List;
33
import java.util.Objects;
34
import java.util.Set;
35
import java.util.function.Predicate;
36
import javax.swing.ImageIcon;
37
import org.apache.commons.collections4.CollectionUtils;
38
import org.apache.commons.lang3.StringUtils;
39
import org.gvsig.andami.PluginsLocator;
40
import org.gvsig.andami.actioninfo.ActionInfo;
41
import org.gvsig.tools.swing.api.SimpleImage;
42
import org.gvsig.tools.swing.api.ToolsSwingLocator;
43
import org.gvsig.tools.swing.api.ToolsSwingUtils;
44
import org.gvsig.tools.swing.icontheme.IconTheme;
45
import org.gvsig.tools.swing.icontheme.IconThemeManager;
46
import org.slf4j.Logger;
47
import org.slf4j.LoggerFactory;
48

    
49
@SuppressWarnings("UseSpecificCatch")
50
public class IconThemeDevelTool {
51

    
52
    public static final Logger LOGGER = LoggerFactory.getLogger(IconThemeDevelTool.class);
53

    
54
    public void showDefaultIconTheme() {
55
        IconThemeManager manager = ToolsSwingLocator.getIconThemeManager();
56
        IconTheme theme = manager.getDefault();
57
        String html = "<html>"
58
                + "<style type=\"text/css\" media=\"print\">"
59
                + "@page {\n"
60
//                + "  size: A4 landscape;\n"
61
                + "  size: A4 portrait;\n"
62
                + "}"
63
                + "</style>"
64
                + "\n<body>\n" + this.getIconThemeInformationByGroup(theme) + "</body>\n</html>\n";
65
        InfoPanel.showInBrowser("default-icontheme-report", "Icon theme "+theme.getName(), html);
66
    }
67

    
68
    public void showCurrentIconTheme() {
69
        IconThemeManager manager = ToolsSwingLocator.getIconThemeManager();
70
        IconTheme theme = manager.getCurrent();
71
        String html = "<html>"
72
                + "<style type=\"text/css\" media=\"print\">"
73
                + "@page {\n"
74
//                + "  size: A4 landscape;\n"
75
                + "  size: A4 portrait;\n"
76
                + "}"
77
                + "</style>"
78
                + "\n<body>\n" + this.getIconThemeInformationByGroup(theme) + "</body>\n</html>\n";
79
        InfoPanel.showInBrowser("current-icontheme-report", "Icon theme "+theme.getName(), html);
80
    }
81

    
82
    public void showDefaultIconThemeByPlugin() {
83
        IconThemeManager manager = ToolsSwingLocator.getIconThemeManager();
84
        IconTheme theme = manager.getDefault();
85
        String html = "<html>"
86
                + "<style type=\"text/css\" media=\"print\">"
87
                + "@page {\n"
88
//                + "  size: A4 landscape;\n"
89
                + "  size: A4 portrait;\n"
90
                + "}"
91
                + "</style>"
92
                + "\n<body>\n" + this.getIconThemeInformationByPlugin(theme) + "</body>\n</html>\n";
93
        InfoPanel.showInBrowser("default-icontheme-report-byplugin", "Icon theme "+theme.getName(), html);
94
    }
95

    
96
    private List<IconTheme.Icon> getIconsFromDefaultTheme(Predicate<IconTheme.Icon> filter) {
97
        IconThemeManager manager = ToolsSwingLocator.getIconThemeManager();
98
        IconTheme defaultTheme = manager.getDefault();
99

    
100
        List<IconTheme.Icon> defaultThemeIcons = new ArrayList<>();
101
        Iterator<IconTheme.Icon> defaultThemeIconsIt = defaultTheme.getThemeIcons();
102
        while (defaultThemeIconsIt.hasNext()) {
103
            IconTheme.Icon defaultTheIcon = defaultThemeIconsIt.next();
104
            if (filter == null || filter.test(defaultTheIcon)) {
105
                defaultThemeIcons.add(defaultTheIcon);
106
            }
107
        }
108
        return defaultThemeIcons;
109
    }
110

    
111
    private String getIconThemeInformationByPlugin(IconTheme theme) {
112
        List<IconTheme.Icon> defaultThemeIcons = this.getIconsFromDefaultTheme(null);
113
        Collections.sort(defaultThemeIcons, (IconTheme.Icon o1, IconTheme.Icon o2) -> {
114
            String s1 = String.format("%s:%s:%s:%s", o1.getProviderName(), o1.getGroup(), StringUtils.defaultIfEmpty(o1.getSubgroup(), ""), o1.getName());
115
            String s2 = String.format("%s:%s:%s:%s", o2.getProviderName(), o2.getGroup(), StringUtils.defaultIfEmpty(o2.getSubgroup(), ""), o2.getName());
116
            return s1.compareTo(s2);
117
        });
118
        return getIconThemeInformation(theme, defaultThemeIcons);
119
    }
120

    
121
    public String getIconThemeInformationOfPlugin(String pluginName) {
122
        IconThemeManager manager = ToolsSwingLocator.getIconThemeManager();
123
        IconTheme defaultTheme = manager.getDefault();
124
        return getIconThemeInformationOfPlugin(defaultTheme, pluginName);
125
    }
126
    
127
    public String getIconThemeInformationOfPlugin(IconTheme theme, String pluginName) {
128
        if (pluginName == null) {
129
            return "";
130
        }
131
        List<IconTheme.Icon> defaultThemeIcons = this.getIconsFromDefaultTheme(
132
                (IconTheme.Icon t) -> StringUtils.equalsIgnoreCase(pluginName, t.getProviderName())
133
        );
134
        Collections.sort(defaultThemeIcons, (IconTheme.Icon o1, IconTheme.Icon o2) -> {
135
            String s1 = String.format("%s:%s:%s:%s", o1.getProviderName(), o1.getGroup(), StringUtils.defaultIfEmpty(o1.getSubgroup(), ""), o1.getName());
136
            String s2 = String.format("%s:%s:%s:%s", o2.getProviderName(), o2.getGroup(), StringUtils.defaultIfEmpty(o2.getSubgroup(), ""), o2.getName());
137
            return s1.compareTo(s2);
138
        });
139
        return getIconThemeInformation(theme, defaultThemeIcons);
140
    }
141

    
142
    private String getIconThemeInformationByGroup(IconTheme theme) {
143
        List<IconTheme.Icon> defaultThemeIcons = this.getIconsFromDefaultTheme(null);
144
        Collections.sort(defaultThemeIcons, (IconTheme.Icon o1, IconTheme.Icon o2) -> {
145
            String s1 = String.format("%s:%s:%s:%s", o1.getGroup(), StringUtils.defaultIfEmpty(o1.getSubgroup(), ""), o1.getName(), o1.getProviderName());
146
            String s2 = String.format("%s:%s:%s:%s", o2.getGroup(), StringUtils.defaultIfEmpty(o2.getSubgroup(), ""), o2.getName(), o2.getProviderName());
147
            return s1.compareTo(s2);
148
        });
149
        return getIconThemeInformation(theme, defaultThemeIcons);
150
    }
151

    
152
    private String getIconThemeInformation(IconTheme theme, Iterable<IconTheme.Icon> defaultThemeIcons) {
153
        IconThemeManager manager = ToolsSwingLocator.getIconThemeManager();
154
        IconTheme defaultTheme = manager.getDefault();
155

    
156
        Set<String> actionIcons = new HashSet<>();
157

    
158
        Iterator<ActionInfo> actions = PluginsLocator.getActionInfoManager().getActions();
159
        while (actions.hasNext()) {
160
            ActionInfo action = actions.next();
161
            if (action.getIconName() != null) {
162
                actionIcons.add(action.getIconName());
163
            }
164
        }
165
        Set<String> tangoIconNames = getTangoIconNames();
166

    
167
        String previousGroup = "----- none -----";
168
        String previousSubgroup = "----- none -----";
169

    
170
        StringBuilder buffer = new StringBuilder();
171

    
172
        buffer.append("<div>\n");
173
        buffer.append("<style>\n");
174
        buffer.append(".fullscreen-image { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background-color: rgba(0, 0, 0, 0.5); display: flex; justify-content: center; align-items: center; z-index: 999; }");// backdrop-filter: blur(5px); }");
175
        buffer.append("</style>\n");
176
        buffer.append("<script>\n");
177
        buffer.append("function showFullscreen(image) {\n");
178
        buffer.append("    const fullscreen = document.createElement('div');\n");
179
        buffer.append("    fullscreen.classList.add('fullscreen-image');\n");
180
        buffer.append("    fullscreen.innerHTML = '<img src=\"'+image.src+'\">';\n");
181
        buffer.append("    fullscreen.addEventListener('click', (event) => {\n");
182
        buffer.append("        if (event.target === fullscreen) {\n");
183
        buffer.append("            fullscreen.remove();\n");
184
        buffer.append("        }\n");
185
        buffer.append("    });\n");
186
        buffer.append("    document.body.appendChild(fullscreen);\n");
187
        buffer.append("}\n");        
188
        buffer.append("</script>\n");
189
        buffer.append("<h2>Icon theme information</h2>\n");
190
        buffer.append("<br>\n");
191
        buffer.append("Theme: ");
192
        buffer.append(theme.getName());
193
        buffer.append("<br>\n");
194
        buffer.append("Description: ");
195
        buffer.append(theme.getDescription());
196
        buffer.append("<br>\n");
197

    
198
        buffer.append("<table border=\"0\">\n");
199

    
200
        for (IconTheme.Icon defaultThemeIcon : defaultThemeIcons) {
201
            if (defaultThemeIcon == null) {
202
                continue;
203
            }
204
            IconTheme.Icon themeIcon = theme.getThemeIcon(defaultThemeIcon.getName());
205
            if (themeIcon == null) {
206
                themeIcon = defaultThemeIcon;
207
            }
208

    
209
            String nameTag = "";
210
            String imageTag = "";
211
            String note1Tag = "";
212
            String note2Tag = "";
213
            String note3Tag = "";
214

    
215
            if (StringUtils.equalsIgnoreCase("action", defaultThemeIcon.getGroup()) && !actionIcons.contains(defaultThemeIcon.getName())) {
216
                nameTag = String.format(
217
                        "<span title=\"Don't exists an action associated to this icon\"><b><font color=\"red\">%s</font></b></span>",
218
                        defaultThemeIcon.getName()
219
                );
220
            } else if (!defaultThemeIcon.getName().contains("-")) {
221
                nameTag = String.format(
222
                        "<span title=\"Name don't have recomended format\"><b>%s</b></span>",
223
                        defaultThemeIcon.getName()
224
                );
225
            } else if (tangoIconNames.contains(defaultThemeIcon.getName())) {
226
                nameTag = String.format(
227
                        "<span title=\"The name conforms to the Tango directives\"><b><font color=\"green\">%s</font></b></span>",
228
                        defaultThemeIcon.getName()
229
                );
230
            } else {
231
                nameTag = String.format(
232
                        "<span>%s</span>",
233
                        defaultThemeIcon.getName()
234
                );
235
            }
236

    
237
            if (!theme.isMyIcon(themeIcon.getName())) {
238
                note2Tag = "<span title=\"The image not found in this theme, get from default theme.\"><small><sup>(2)</sup></small></span>";
239
            }
240

    
241
            ImageIcon img = themeIcon.getImageIcon();
242
            if (img != null) {
243
                try {
244
                    SimpleImage simpleImg = ToolsSwingLocator.getToolsSwingManager().createSimpleImage(img);
245
                    if (img.getIconHeight() > 48 || img.getIconWidth() > 48) {
246
                        imageTag = String.format(
247
                                "<img onclick=\"showFullscreen(this)\" width=\"48\" height=\"48\" src=\"data:image/%s;base64,%s\" title=\"%s\">",
248
                                simpleImg.getFormatName(),
249
                                simpleImg.toStringBase64(),
250
                                Objects.toString(themeIcon.getURL())
251
                        );
252
                        note1Tag = "<span title=\"The image is big, resized to 48x48.\"><small><sup>(1)</sup></small></span>";
253
                    } else {
254
                        imageTag = String.format(
255
                                "<img src=\"data:image/%s;base64,%s\" title=\"%s\">",
256
                                simpleImg.getFormatName(),
257
                                simpleImg.toStringBase64(),
258
                                Objects.toString(themeIcon.getURL())
259
                        );
260
                        note1Tag = "";
261
                    }
262
                } catch (Exception ex) {
263
                    imageTag = String.format(
264
                            "<img src=\"%s\">",
265
                            themeIcon.getLabel()
266
                    );
267
                    note3Tag = String.format(
268
                            "<span title=\"Problems loading image. %s\"><small><sup>(3)</sup></small></span>",
269
                            ex.getMessage()
270
                    );
271
                }
272
            }
273

    
274
            if (!StringUtils.equalsIgnoreCase(previousGroup, defaultThemeIcon.getGroup())) {
275
                previousGroup = defaultThemeIcon.getGroup();
276
                previousSubgroup = "----- none -----";
277
                buffer.append("  <tr valign=\"top\">\n");
278
                buffer.append("    <td colspan=\"2\">");
279
                buffer.append("    <hr><b>Group ");
280
                buffer.append(defaultThemeIcon.getGroup());
281
                buffer.append("    </b>");
282
                if (StringUtils.isNotEmpty(defaultThemeIcon.getGroupDescription())) {
283
                    buffer.append("<br>");
284
                    buffer.append(ToolsSwingUtils.toHTML(defaultThemeIcon.getGroupDescription()));
285
                }
286
                List<SimpleImage> images = defaultTheme.getGroupImages(
287
                        defaultThemeIcon.getGroup()
288
                );
289
                buffer.append(this.createImagesTag(images));
290
                buffer.append("    </td>");
291
                buffer.append("  </tr>\n");
292
            }
293
            if (!StringUtils.equalsIgnoreCase(previousSubgroup, defaultThemeIcon.getSubgroup())) {
294
                previousSubgroup = defaultThemeIcon.getSubgroup();
295
                if( StringUtils.isNotEmpty(defaultThemeIcon.getSubgroup())) {
296
                    buffer.append("  <tr valign=\"top\">\n");
297
                    buffer.append("    <td colspan=\"2\">");
298
                    buffer.append("    <b>Subgroup ");
299
                    buffer.append(defaultThemeIcon.getSubgroup());
300
                    buffer.append("    </b>");
301
                    if (StringUtils.isNotEmpty(defaultThemeIcon.getSubgroupDescription())) {
302
                        buffer.append("<br>");
303
                        buffer.append(ToolsSwingUtils.toHTML(defaultThemeIcon.getSubgroupDescription()));
304
                    }
305
                    List<SimpleImage> images = defaultTheme.getSubgroupImages(
306
                            defaultThemeIcon.getGroup(), 
307
                            defaultThemeIcon.getSubgroup()
308
                    );
309
                    buffer.append(this.createImagesTag(images));
310
                    buffer.append("    </td>");
311
                    buffer.append("  </tr>\n");
312
                }
313
            }
314

    
315
            buffer.append("  <tr valign=\"top\">\n");
316
            buffer.append("    <td>\n");
317
            buffer.append(imageTag);
318
            buffer.append(note1Tag);
319
            buffer.append(note2Tag);
320
            buffer.append(note3Tag);
321
            buffer.append("    </td>\n");
322
            buffer.append("    <td>\n");
323
            buffer.append(nameTag);
324
            if (StringUtils.isNotEmpty(defaultThemeIcon.getProviderName())) {
325
                buffer.append(" (");
326
                buffer.append(defaultThemeIcon.getProviderName());
327
                buffer.append(")");
328
            }
329
            buffer.append("    </td>\n");
330
            buffer.append("  </tr>\n");
331

    
332
            String s = defaultThemeIcon.getDescription();
333
            if (StringUtils.isNotEmpty(s)) {
334
                buffer.append("  <tr valign=\"top\">\n<td></td>");
335
                buffer.append("    <td>");
336
                buffer.append(ToolsSwingUtils.toHTML(s));
337
                buffer.append("\n");
338
                buffer.append("    </td>\n");
339
                buffer.append("  </tr>\n");
340
            }
341

    
342
        }
343
        
344
        
345
        buffer.append("</table>\n");
346

    
347
        
348
        boolean first = true;
349
        Iterator<IconTheme.Icon> it = theme.getThemeIcons();
350
        while( it.hasNext() ) {
351
            IconTheme.Icon themeIcon = it.next();
352
            if( themeIcon == null ) {
353
                continue;
354
            }            
355
            String imageTag = "";
356
            String note3Tag = "";
357

    
358
            IconTheme.Icon defaultThemeIcon = defaultTheme.getThemeIcon(themeIcon.getName());
359
            if( defaultThemeIcon == null ) {
360
                if( first ) {
361
                    first = false;
362
                    buffer.append("<hr>\n");
363
                    buffer.append("<p>Imagenes que no estan en el tema por defecto.</p>\n");
364
                    buffer.append("<table border=\"0\">\n");
365
                    buffer.append("  <tr valign=\"top\">\n");
366
                    buffer.append("    <td>Image</td>\n");
367
                    buffer.append("    <td>Group</td>\n");
368
                    buffer.append("    <td>Name</td>\n");
369
                    buffer.append("  </tr>\n");
370
                }
371

    
372
                ImageIcon img = themeIcon.getImageIcon();
373
                if (img != null) {
374
                    try {
375
                        SimpleImage simpleImg = ToolsSwingLocator.getToolsSwingManager().createSimpleImage(img);
376
                        if (img.getIconHeight() > 48 || img.getIconWidth() > 48) {
377
                            imageTag = String.format(
378
                                    "<img onclick=\"showFullscreen(this)\" width=\"48\" height=\"48\" src=\"data:image/%s;base64,%s\" title=\"%s\">",
379
                                    simpleImg.getFormatName(),
380
                                    simpleImg.toStringBase64(),
381
                                    Objects.toString(themeIcon.getURL())
382
                            );
383
                        } else {
384
                            imageTag = String.format(
385
                                    "<img src=\"data:image/%s;base64,%s\" title=\"%s\">",
386
                                    simpleImg.getFormatName(),
387
                                    simpleImg.toStringBase64(),
388
                                    Objects.toString(themeIcon.getURL())
389
                            );
390
                        }
391
                    } catch (Exception ex) {
392
                        imageTag = String.format(
393
                                "<img src=\"%s\">",
394
                                themeIcon.getLabel()
395
                        );
396
                        note3Tag = String.format(
397
                                "<span title=\"Problems loading image. %s\"><small><sup>(3)</sup></small></span>",
398
                                ex.getMessage()
399
                        );
400
                    }
401
                }
402

    
403

    
404
                buffer.append("  <tr valign=\"top\">\n");
405
                buffer.append("    <td>");
406
                buffer.append(imageTag);
407
                buffer.append(note3Tag);
408
                buffer.append("</td>\n");
409
                buffer.append("    <td>");
410
                buffer.append(themeIcon.getGroup());
411
                buffer.append("</td>\n");
412
                buffer.append("    <td>");
413
                buffer.append(themeIcon.getName());
414
                buffer.append("</td>\n");
415
                buffer.append("  </tr>\n");
416
            }
417
        }
418
        if( !first ) {
419
            buffer.append("</table>\n");
420
        }
421
        
422
        
423
        
424
        buffer.append("<p>");
425
        buffer.append("<sup>(1)</sup> Resized Icon<br>");
426
        buffer.append("<sup>(2)</sup> Image not found in this theme, get from default theme<br>");
427
        buffer.append("<sup>(3)</sup> Problems loading the image<br>");
428
        buffer.append("</p>");
429
        buffer.append("</div>\n");
430

    
431
        return buffer.toString();
432
    }
433

    
434
    private Set<String> getTangoIconNames() {
435
        String[] iconNames = new String[]{
436
            "address-book-new",
437
            "application-exit",
438
            "appointment-new",
439
            "call-start",
440
            "call-stop",
441
            "contact-new",
442
            "document-new",
443
            "document-open",
444
            "document-open-recent",
445
            "document-page-setup",
446
            "document-print",
447
            "document-print-preview",
448
            "document-properties",
449
            "document-revert",
450
            "document-save",
451
            "document-save-as",
452
            "document-send",
453
            "edit-clear",
454
            "edit-copy",
455
            "edit-cut",
456
            "edit-delete",
457
            "edit-find",
458
            "edit-find-replace",
459
            "edit-paste",
460
            "edit-redo",
461
            "edit-select-all",
462
            "edit-undo",
463
            "folder-new",
464
            "format-indent-less",
465
            "format-indent-more",
466
            "format-justify-center",
467
            "format-justify-fill",
468
            "format-justify-left",
469
            "format-justify-right",
470
            "format-text-direction-ltr",
471
            "format-text-direction-rtl",
472
            "format-text-bold",
473
            "format-text-italic",
474
            "format-text-underline",
475
            "format-text-strikethrough",
476
            "go-bottom",
477
            "go-down",
478
            "go-first",
479
            "go-home",
480
            "go-jump",
481
            "go-last",
482
            "go-next",
483
            "go-previous",
484
            "go-top",
485
            "go-up",
486
            "help-about",
487
            "help-contents",
488
            "help-faq",
489
            "insert-image",
490
            "insert-link",
491
            "insert-object",
492
            "insert-text",
493
            "list-add",
494
            "list-remove",
495
            "mail-forward",
496
            "mail-mark-important",
497
            "mail-mark-junk",
498
            "mail-mark-notjunk",
499
            "mail-mark-read",
500
            "mail-mark-unread",
501
            "mail-message-new",
502
            "mail-reply-all",
503
            "mail-reply-sender",
504
            "mail-send",
505
            "mail-send-receive",
506
            "media-eject",
507
            "media-playback-pause",
508
            "media-playback-start",
509
            "media-playback-stop",
510
            "media-record",
511
            "media-seek-backward",
512
            "media-seek-forward",
513
            "media-skip-backward",
514
            "media-skip-forward",
515
            "object-flip-horizontal",
516
            "object-flip-vertical",
517
            "object-rotate-left",
518
            "object-rotate-right",
519
            "process-stop",
520
            "system-lock-screen",
521
            "system-log-out",
522
            "system-run",
523
            "system-search",
524
            "system-reboot",
525
            "system-shutdown",
526
            "tools-check-spelling",
527
            "view-fullscreen",
528
            "view-refresh",
529
            "view-restore",
530
            "view-sort-ascending",
531
            "view-sort-descending",
532
            "window-close",
533
            "window-new",
534
            "zoom-fit-best",
535
            "zoom-in",
536
            "zoom-original",
537
            "zoom-out",
538
            "process-working",
539
            "accessories-calculator",
540
            "accessories-character-map",
541
            "accessories-dictionary",
542
            "accessories-text-editor",
543
            "help-browser",
544
            "multimedia-volume-control",
545
            "preferences-desktop-accessibility",
546
            "preferences-desktop-font",
547
            "preferences-desktop-keyboard",
548
            "preferences-desktop-locale",
549
            "preferences-desktop-multimedia",
550
            "preferences-desktop-screensaver",
551
            "preferences-desktop-theme",
552
            "preferences-desktop-wallpaper",
553
            "system-file-manager",
554
            "system-software-install",
555
            "system-software-update",
556
            "utilities-system-monitor",
557
            "utilities-terminal",
558
            "applications-accessories",
559
            "applications-development",
560
            "applications-engineering",
561
            "applications-games",
562
            "applications-graphics",
563
            "applications-internet",
564
            "applications-multimedia",
565
            "applications-office",
566
            "applications-other",
567
            "applications-science",
568
            "applications-system",
569
            "applications-utilities",
570
            "preferences-desktop",
571
            "preferences-desktop-peripherals",
572
            "preferences-desktop-personal",
573
            "preferences-other",
574
            "preferences-system",
575
            "preferences-system-network",
576
            "system-help",
577
            "audio-card",
578
            "audio-input-microphone",
579
            "battery",
580
            "camera-photo",
581
            "camera-video",
582
            "camera-web",
583
            "computer",
584
            "drive-harddisk",
585
            "drive-optical",
586
            "drive-removable-media",
587
            "input-gaming",
588
            "input-keyboard",
589
            "input-mouse",
590
            "input-tablet",
591
            "media-flash",
592
            "media-floppy",
593
            "media-optical",
594
            "media-tape",
595
            "modem",
596
            "multimedia-player",
597
            "network-wired",
598
            "network-wireless",
599
            "pda",
600
            "phone",
601
            "printer",
602
            "scanner",
603
            "video-display",
604
            "emblem-default",
605
            "emblem-documents",
606
            "emblem-downloads",
607
            "emblem-favorite",
608
            "emblem-important",
609
            "emblem-mail",
610
            "emblem-photos",
611
            "emblem-readonly",
612
            "emblem-shared",
613
            "emblem-symbolic-link",
614
            "emblem-synchronized",
615
            "emblem-system",
616
            "emblem-unreadable",
617
            "face-angel",
618
            "face-angry",
619
            "face-cool",
620
            "face-crying",
621
            "face-devilish",
622
            "face-embarrassed",
623
            "face-kiss",
624
            "face-laugh",
625
            "face-monkey",
626
            "face-plain",
627
            "face-raspberry",
628
            "face-sad",
629
            "face-sick",
630
            "face-smile",
631
            "face-smile-big",
632
            "face-smirk",
633
            "face-surprise",
634
            "face-tired",
635
            "face-uncertain",
636
            "face-wink",
637
            "face-worried",
638
            "flag-aa",
639
            "application-x-executable",
640
            "audio-x-generic",
641
            "font-x-generic",
642
            "image-x-generic",
643
            "package-x-generic",
644
            "text-html",
645
            "text-x-generic",
646
            "text-x-generic-template",
647
            "text-x-script",
648
            "video-x-generic",
649
            "x-office-address-book",
650
            "x-office-calendar",
651
            "x-office-document",
652
            "x-office-presentation",
653
            "x-office-spreadsheet",
654
            "folder",
655
            "folder-remote",
656
            "network-server",
657
            "network-workgroup",
658
            "start-here",
659
            "user-bookmarks",
660
            "user-desktop",
661
            "user-home",
662
            "user-trash",
663
            "appointment-missed",
664
            "appointment-soon",
665
            "audio-volume-high",
666
            "audio-volume-low",
667
            "audio-volume-medium",
668
            "audio-volume-muted",
669
            "battery-caution",
670
            "battery-low",
671
            "dialog-error",
672
            "dialog-information",
673
            "dialog-password",
674
            "dialog-question",
675
            "dialog-warning",
676
            "folder-drag-accept",
677
            "folder-open",
678
            "folder-visiting",
679
            "image-loading",
680
            "image-missing",
681
            "mail-attachment",
682
            "mail-unread",
683
            "mail-read",
684
            "mail-replied",
685
            "mail-signed",
686
            "mail-signed-verified",
687
            "media-playlist-repeat",
688
            "media-playlist-shuffle",
689
            "network-error",
690
            "network-idle",
691
            "network-offline",
692
            "network-receive",
693
            "network-transmit",
694
            "network-transmit-receive",
695
            "printer-error",
696
            "printer-printing",
697
            "security-high",
698
            "security-medium",
699
            "security-low",
700
            "software-update-available",
701
            "software-update-urgent",
702
            "sync-error",
703
            "sync-synchronizing",
704
            "task-due",
705
            "task-past-due",
706
            "user-available",
707
            "user-away",
708
            "user-idle",
709
            "user-offline",
710
            "user-trash-full",
711
            "weather-clear",
712
            "weather-clear-night",
713
            "weather-few-clouds",
714
            "weather-few-clouds-night",
715
            "weather-fog",
716
            "weather-overcast",
717
            "weather-severe-alert",
718
            "weather-showers",
719
            "weather-showers-scattered",
720
            "weather-snow",
721
            "weather-storm"
722
        };
723
        Set<String> icons = new HashSet<>();
724
        icons.addAll(Arrays.asList(iconNames));
725
        return icons;
726
    }
727

    
728
    private String createImagesTag(List<SimpleImage> images) {
729
        if( CollectionUtils.isEmpty(images) ) {
730
            return "";
731
        }
732
        StringBuilder buffer = new StringBuilder();
733
        buffer.append("<br>");
734
        buffer.append("<span>\n");
735
        for (SimpleImage image : images) {
736
            String imageTag = String.format(
737
                    "<img onclick=\"showFullscreen(this)\" width=\"48\" height=\"48\" src=\"data:image/%s;base64,%s\">",
738
                    image.getFormatName(),
739
                    image.toStringBase64()
740
            );
741
            buffer.append(imageTag);
742
            buffer.append(" ");
743
        }
744
        buffer.append("<span>\n");
745
        return buffer.toString();
746
    }
747

    
748
}