Revision 47423 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
IconThemeDevelTool.java | ||
---|---|---|
23 | 23 |
*/ |
24 | 24 |
package org.gvsig.app.extension.develtools; |
25 | 25 |
|
26 |
import java.io.File;
|
|
26 |
import java.awt.Image;
|
|
27 | 27 |
import java.util.ArrayList; |
28 |
import java.util.Arrays; |
|
28 | 29 |
import java.util.Collections; |
29 |
import java.util.Comparator; |
|
30 | 30 |
import java.util.HashSet; |
31 | 31 |
import java.util.Iterator; |
32 | 32 |
import java.util.List; |
33 |
import java.util.Objects; |
|
33 | 34 |
import java.util.Set; |
35 |
import java.util.function.Predicate; |
|
34 | 36 |
import javax.swing.ImageIcon; |
35 |
import javax.swing.JOptionPane; |
|
37 |
import org.apache.commons.collections4.CollectionUtils; |
|
38 |
import org.apache.commons.lang3.StringUtils; |
|
36 | 39 |
import org.gvsig.andami.PluginsLocator; |
37 | 40 |
import org.gvsig.andami.actioninfo.ActionInfo; |
38 |
import org.gvsig.desktopopen.DesktopOpen; |
|
39 |
import org.gvsig.tools.ToolsLocator; |
|
40 |
import org.gvsig.tools.exception.BaseException; |
|
41 |
import org.gvsig.tools.folders.FoldersManager; |
|
42 |
import org.gvsig.tools.i18n.I18nManager; |
|
43 | 41 |
import org.gvsig.tools.swing.api.SimpleImage; |
44 | 42 |
import org.gvsig.tools.swing.api.ToolsSwingLocator; |
45 |
import org.gvsig.tools.swing.api.threadsafedialogs.ThreadSafeDialogsManager; |
|
46 |
import org.gvsig.tools.swing.api.windowmanager.WindowManager; |
|
43 |
import org.gvsig.tools.swing.api.ToolsSwingUtils; |
|
47 | 44 |
import org.gvsig.tools.swing.icontheme.IconTheme; |
48 | 45 |
import org.gvsig.tools.swing.icontheme.IconThemeManager; |
49 |
import org.gvsig.tools.util.ToolsUtilLocator; |
|
50 | 46 |
import org.slf4j.Logger; |
51 | 47 |
import org.slf4j.LoggerFactory; |
52 | 48 |
|
49 |
@SuppressWarnings("UseSpecificCatch") |
|
53 | 50 |
public class IconThemeDevelTool { |
54 |
|
|
51 |
|
|
55 | 52 |
public static final Logger LOGGER = LoggerFactory.getLogger(IconThemeDevelTool.class); |
56 | 53 |
|
57 |
public void showDefaultIconTheme() { |
|
58 |
try { |
|
59 |
IconThemeManager manager = ToolsSwingLocator.getIconThemeManager(); |
|
60 |
String html = "<html>" |
|
61 |
+ "<style type=\"text/css\" media=\"print\">" |
|
62 |
+ "@page {\n" |
|
63 |
+ " size: A4 landscape;\n" |
|
64 |
+ "}" |
|
65 |
+ "</style>" |
|
66 |
+ "\n<body>\n"+ this.getIconThemeInformationByGroup(manager.getDefault())+"</body>\n</html>\n"; |
|
67 |
FoldersManager fm = ToolsLocator.getFoldersManager(); |
|
68 |
File f = fm.createTemporaryFile("defaulticontheme-report.html", html); |
|
69 |
DesktopOpen desktopOpen = ToolsUtilLocator.getToolsUtilManager().createDesktopOpen(); |
|
70 |
desktopOpen.browse(f.toURI()); |
|
71 |
|
|
72 |
|
|
73 |
// ActionInfoManager actionManager = PluginsLocator.getActionInfoManager(); |
|
74 |
// ActionInfo showPdf = actionManager.getAction("show-pdf"); |
|
75 |
// if(showPdf == null) { |
|
76 |
// InfoPanel.save2file("defaulticontheme-report", html); |
|
77 |
// InfoPanel.showPanel("Default icon theme information", WindowManager.MODE.WINDOW, html); |
|
78 |
// } else { |
|
79 |
// showPdf.execute( |
|
80 |
// new Object[]{ |
|
81 |
// "--title=", "Default icon theme information", |
|
82 |
// "--mode=", WindowManager.MODE.WINDOW, |
|
83 |
// "--source=", html |
|
84 |
// } |
|
85 |
// ); |
|
86 |
// } |
|
87 |
} catch (Exception ex) { |
|
88 |
LOGGER.warn("Can't show default icon theme.'", ex); |
|
89 |
I18nManager i18n = ToolsLocator.getI18nManager(); |
|
90 |
ThreadSafeDialogsManager dialogs = ToolsSwingLocator.getThreadSafeDialogsManager(); |
|
91 |
dialogs.messageDialog( |
|
92 |
i18n.getTranslation("_Cant_show_default_icon_theme") + ")\n\n"+BaseException.getMessageStack(ex, 0), |
|
93 |
i18n.getTranslation("_Show_default_icon_theme"), |
|
94 |
JOptionPane.WARNING_MESSAGE |
|
95 |
); |
|
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); |
|
96 | 106 |
} |
107 |
} |
|
108 |
return defaultThemeIcons; |
|
109 |
} |
|
97 | 110 |
|
98 |
|
|
99 |
} |
|
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 |
} |
|
100 | 120 |
|
101 |
public void showCurrentIconTheme() { |
|
102 |
try { |
|
103 |
IconThemeManager manager = ToolsSwingLocator.getIconThemeManager(); |
|
104 |
String html = "<html>" |
|
105 |
+ "<style type=\"text/css\" media=\"print\">" |
|
106 |
+ "@page {\n" |
|
107 |
+ " size: A4 landscape;\n" |
|
108 |
+ "}" |
|
109 |
+ "</style>" |
|
110 |
+ "\n<body>\n"+ this.getIconThemeInformationByGroup(manager.getCurrent())+"</body>\n</html>\n"; |
|
111 |
|
|
112 |
FoldersManager fm = ToolsLocator.getFoldersManager(); |
|
113 |
File f = fm.createTemporaryFile("currenticontheme-report.html", html); |
|
114 |
DesktopOpen desktopOpen = ToolsUtilLocator.getToolsUtilManager().createDesktopOpen(); |
|
115 |
desktopOpen.browse(f.toURI()); |
|
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 |
} |
|
116 | 141 |
|
117 |
// ActionInfoManager actionManager = PluginsLocator.getActionInfoManager(); |
|
118 |
// ActionInfo showPdf = actionManager.getAction("show-pdf"); |
|
119 |
// if(showPdf == null) { |
|
120 |
// InfoPanel.save2file("currenticontheme-report", html); |
|
121 |
// InfoPanel.showPanel("Current icon theme information", WindowManager.MODE.WINDOW, html); |
|
122 |
// } else { |
|
123 |
// showPdf.execute( |
|
124 |
// new Object[]{ |
|
125 |
// "--title=", "Current icon theme information", |
|
126 |
// "--mode=", WindowManager.MODE.WINDOW, |
|
127 |
// "--source=", html |
|
128 |
// } |
|
129 |
// ); |
|
130 |
// } |
|
131 |
} catch (Exception ex) { |
|
132 |
LOGGER.warn("Can't show current icon theme.'", ex); |
|
133 |
I18nManager i18n = ToolsLocator.getI18nManager(); |
|
134 |
ThreadSafeDialogsManager dialogs = ToolsSwingLocator.getThreadSafeDialogsManager(); |
|
135 |
dialogs.messageDialog( |
|
136 |
i18n.getTranslation("_Cant_show_current_icon_theme") + ")\n\n"+BaseException.getMessageStack(ex, 0), |
|
137 |
i18n.getTranslation("_Show_current_icon_theme"), |
|
138 |
JOptionPane.WARNING_MESSAGE |
|
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() |
|
139 | 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 |
); |
|
140 | 235 |
} |
141 | 236 |
|
142 |
} |
|
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 |
} |
|
143 | 240 |
|
144 |
public void showDefaultIconThemeByPlugin() { |
|
145 |
String html = "<html>\n<body>\n"+ this.getIconThemeInformationByPlugin()+"</body>\n</html>\n"; |
|
146 |
InfoPanel.save2file("icontheme-report", html); |
|
147 |
InfoPanel.showPanel("Icon theme information", WindowManager.MODE.WINDOW, html); |
|
148 |
} |
|
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 |
} |
|
149 | 273 |
|
150 |
private String getIconThemeInformationByPlugin() { |
|
151 |
IconThemeManager manager = ToolsSwingLocator.getIconThemeManager(); |
|
152 |
IconTheme theme = manager.getDefault(); |
|
153 |
|
|
154 |
List<IconTheme.Icon>themeIcons = new ArrayList<IconTheme.Icon>(); |
|
155 |
Iterator<IconTheme.Icon> themeIconsIt = theme.getThemeIcons(); |
|
156 |
while (themeIconsIt.hasNext()) { |
|
157 |
themeIcons.add(themeIconsIt.next()); |
|
158 |
} |
|
159 |
Collections.sort(themeIcons, new Comparator<IconTheme.Icon>() { |
|
160 |
public int compare(IconTheme.Icon o1, IconTheme.Icon o2) { |
|
161 |
String s1 = String.format("%s:%s:%s", o1.getProviderName(), o1.getGroup(), o1.getName()); |
|
162 |
String s2 = String.format("%s:%s:%s", o2.getProviderName(), o2.getGroup(), o2.getName()); |
|
163 |
return s1.compareTo(s2); |
|
164 |
} |
|
165 |
}); |
|
166 |
themeIconsIt = themeIcons.iterator(); |
|
167 |
return getIconThemeInformation(theme, themeIconsIt); |
|
168 |
} |
|
169 |
|
|
170 |
public String getIconThemeInformationOfPlugin(String pluginName) { |
|
171 |
if( pluginName == null ) { |
|
172 |
return ""; |
|
173 |
} |
|
174 |
IconThemeManager manager = ToolsSwingLocator.getIconThemeManager(); |
|
175 |
IconTheme theme = manager.getDefault(); |
|
176 |
|
|
177 |
List<IconTheme.Icon>themeIcons = new ArrayList<IconTheme.Icon>(); |
|
178 |
Iterator<IconTheme.Icon> themeIconsIt = theme.getThemeIcons(); |
|
179 |
while (themeIconsIt.hasNext()) { |
|
180 |
IconTheme.Icon iconTheme = (IconTheme.Icon) themeIconsIt.next(); |
|
181 |
if( !pluginName.equalsIgnoreCase(iconTheme.getProviderName()) ) { |
|
182 |
continue; |
|
183 |
} |
|
184 |
themeIcons.add(iconTheme); |
|
185 |
} |
|
186 |
Collections.sort(themeIcons, new Comparator<IconTheme.Icon>() { |
|
187 |
public int compare(IconTheme.Icon o1, IconTheme.Icon o2) { |
|
188 |
String s1 = String.format("%s:%s:%s", o1.getProviderName(), o1.getGroup(), o1.getName()); |
|
189 |
String s2 = String.format("%s:%s:%s", o2.getProviderName(), o2.getGroup(), o2.getName()); |
|
190 |
return s1.compareTo(s2); |
|
191 |
} |
|
192 |
}); |
|
193 |
themeIconsIt = themeIcons.iterator(); |
|
194 |
return getIconThemeInformation(theme, themeIconsIt); |
|
195 |
} |
|
196 |
|
|
197 |
private String getIconThemeInformationByGroup(IconTheme theme) { |
|
198 |
|
|
199 |
List<IconTheme.Icon>themeIcons = new ArrayList<IconTheme.Icon>(); |
|
200 |
Iterator<IconTheme.Icon> themeIconsIt = theme.getThemeIcons(); |
|
201 |
while (themeIconsIt.hasNext()) { |
|
202 |
themeIcons.add(themeIconsIt.next()); |
|
203 |
} |
|
204 |
Collections.sort(themeIcons, new Comparator<IconTheme.Icon>() { |
|
205 |
public int compare(IconTheme.Icon o1, IconTheme.Icon o2) { |
|
206 |
String s1 = String.format("%s:%s:%s", o1.getGroup(), o1.getName(), o1.getProviderName()); |
|
207 |
String s2 = String.format("%s:%s:%s", o2.getGroup(), o2.getName(), o2.getProviderName()); |
|
208 |
return s1.compareTo(s2); |
|
209 |
} |
|
210 |
}); |
|
211 |
themeIconsIt = themeIcons.iterator(); |
|
212 |
return getIconThemeInformation(theme,themeIconsIt); |
|
213 |
} |
|
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 |
} |
|
214 | 314 |
|
215 |
private String getIconThemeInformation(IconTheme theme, Iterator<IconTheme.Icon> themeIconsIt) { |
|
216 |
Set<String> actionIcons = new HashSet<String>(); |
|
217 |
Iterator<ActionInfo> actions = PluginsLocator.getActionInfoManager().getActions(); |
|
218 |
while (actions.hasNext()) { |
|
219 |
ActionInfo action = actions.next(); |
|
220 |
if( action.getIconName()!=null ) { |
|
221 |
actionIcons.add(action.getIconName()); |
|
222 |
} |
|
223 |
} |
|
224 |
Set<String> tangoIconNames = getTangoIconNames(); |
|
225 |
|
|
226 |
StringBuffer buffer = new StringBuffer(); |
|
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"); |
|
227 | 331 |
|
228 |
String warning_open = "<b>"; |
|
229 |
String warning_close = "</b>"; |
|
230 |
|
|
231 |
String error_open = "<b><font color=\"red\">"; |
|
232 |
String error_close = "</font></b>"; |
|
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 |
} |
|
233 | 341 |
|
234 |
String tangoicon_open = "<b><font color=\"green\">";
|
|
235 |
String tangoicon_close = "</font></b>"; |
|
236 |
|
|
237 |
String previousPluginName = null;
|
|
342 |
}
|
|
343 |
|
|
344 |
|
|
345 |
buffer.append("</table>\n");
|
|
238 | 346 |
|
239 |
buffer.append("<div>\n"); |
|
240 |
buffer.append("<h2>Icon theme information</h2>\n"); |
|
241 |
buffer.append("<br>\n"); |
|
242 |
buffer.append("Theme: "); |
|
243 |
buffer.append(theme.getName()); |
|
244 |
buffer.append("<br>\n"); |
|
245 |
buffer.append("Description: "); |
|
246 |
buffer.append(theme.getDescription()); |
|
247 |
buffer.append("<br>\n"); |
|
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 = ""; |
|
248 | 357 |
|
249 |
buffer.append("<table border=\"0\">\n"); |
|
250 |
buffer.append(" <tr>\n"); |
|
251 |
buffer.append(" <td>Preview</td>\n"); |
|
252 |
buffer.append(" <td>Group</td>\n"); |
|
253 |
buffer.append(" <td>Name</td>\n"); |
|
254 |
buffer.append(" <td>Provider/Plugin</td>\n"); |
|
255 |
buffer.append(" <td>Resource</td>\n"); |
|
256 |
buffer.append(" </tr>\n"); |
|
257 |
|
|
258 |
|
|
259 |
while (themeIconsIt.hasNext()) { |
|
260 |
IconTheme.Icon themeIcon = themeIconsIt.next(); |
|
261 |
if( previousPluginName!=null && !themeIcon.getProviderName().equals(previousPluginName) ) { |
|
262 |
buffer |
|
263 |
.append(" <tr>\n") |
|
264 |
.append(" <td colspan=\"4\"><hr></td>\n") |
|
265 |
.append(" </tr>\n"); |
|
266 |
previousPluginName = themeIcon.getProviderName(); |
|
267 |
} |
|
268 |
|
|
269 |
buffer.append(" <tr valign=\"top\">\n"); |
|
270 |
|
|
271 |
// Preview |
|
272 |
if( themeIcon.getLabel().length()>0 && themeIcon.getImageIcon()!=null ) { |
|
273 |
try { |
|
274 |
ImageIcon img = themeIcon.getImageIcon(); |
|
275 |
SimpleImage simpleImg = ToolsSwingLocator.getToolsSwingManager().createSimpleImage(img); |
|
276 |
if( img.getIconHeight() > 48 || img.getIconWidth() > 48 ) { |
|
277 |
buffer |
|
278 |
.append(" <td nowrap>") |
|
279 |
.append("<img width=\"48\" height=\"48\" src=\"data:image/") |
|
280 |
.append(simpleImg.getFormatName()) |
|
281 |
.append(";base64,") |
|
282 |
.append(simpleImg.toStringBase64()) |
|
283 |
.append("\"><sup>(1)</sup>"); |
|
284 |
// buffer.append("</td>"); |
|
285 |
} else { |
|
286 |
buffer |
|
287 |
.append(" <td>") |
|
288 |
.append("<img src=\"data:image/") |
|
289 |
.append(simpleImg.getFormatName()) |
|
290 |
.append(";base64,") |
|
291 |
.append(simpleImg.toStringBase64()) |
|
292 |
.append("\">"); |
|
293 |
// buffer.append("</td>"); |
|
294 |
} |
|
295 |
if(!theme.isMyIcon(themeIcon.getName())){ |
|
296 |
buffer.append("<sup>(2)</sup>"); |
|
297 |
} |
|
298 |
buffer.append("</td>"); |
|
299 |
|
|
300 |
} catch(Exception ex) { |
|
301 |
buffer |
|
302 |
.append(" <td>") |
|
303 |
.append("<img src=\"") |
|
304 |
.append(themeIcon.getLabel()) |
|
305 |
.append("\"></td>"); |
|
306 |
} |
|
307 |
} else { |
|
308 |
buffer.append(" <td></td>"); |
|
309 |
} |
|
310 |
|
|
311 |
// Group |
|
312 |
if( themeIcon.getGroup()==null ) { |
|
313 |
buffer.append(" <td title=\"missing recomended group\">") |
|
314 |
.append(warning_open) |
|
315 |
.append(themeIcon.getGroup()) |
|
316 |
.append(warning_close) |
|
317 |
.append("</td>\n"); |
|
318 |
} else { |
|
319 |
buffer.append(" <td>") |
|
320 |
.append(themeIcon.getGroup()) |
|
321 |
.append("</td>\n"); |
|
322 |
} |
|
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 |
} |
|
323 | 371 |
|
324 |
// Name |
|
325 |
if( "action".equals(themeIcon.getGroup()) && !actionIcons.contains(themeIcon.getName())) { |
|
326 |
buffer.append(" <td title=\"Don't exists an action associated to this icon\">") |
|
327 |
.append(error_open) |
|
328 |
.append(themeIcon.getName()) |
|
329 |
.append(error_close) |
|
330 |
.append("</td>\n"); |
|
331 |
} else if( !themeIcon.getName().contains("-") ) { |
|
332 |
buffer.append(" <td title=\"Name don't have recomended format\">") |
|
333 |
.append(warning_open) |
|
334 |
.append(themeIcon.getName()) |
|
335 |
.append(warning_close) |
|
336 |
.append("</td>\n"); |
|
337 |
} else if( tangoIconNames.contains(themeIcon.getName()) ){ |
|
338 |
buffer.append(" <td>") |
|
339 |
.append(tangoicon_open) |
|
340 |
.append(themeIcon.getName()) |
|
341 |
.append(tangoicon_close) |
|
342 |
.append("</td>\n"); |
|
343 |
} else { |
|
344 |
buffer.append(" <td>") |
|
345 |
.append(themeIcon.getName()) |
|
346 |
.append("</td>\n"); |
|
347 |
} |
|
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 |
} |
|
348 | 402 |
|
349 |
// Plugin |
|
350 |
if( themeIcon.getProviderName()== null ) { |
|
351 |
buffer.append(" <td title=\"missing recomended associated plugin\">") |
|
352 |
.append(warning_open) |
|
353 |
.append(themeIcon.getProviderName()) |
|
354 |
.append(warning_close) |
|
355 |
.append("</td>\n"); |
|
356 |
|
|
357 |
} else { |
|
358 |
buffer.append(" <td>") |
|
359 |
.append(themeIcon.getProviderName()) |
|
360 |
.append("</td>\n"); |
|
361 |
} |
|
362 |
|
|
363 |
// Resource |
|
364 |
if( themeIcon.getLabel().length()<1 ) { |
|
365 |
buffer.append(" <td title=\"Resource icon not specified\">") |
|
366 |
.append(error_open) |
|
367 |
.append("(missing)") |
|
368 |
.append(error_close) |
|
369 |
.append("</td>\n"); |
|
370 |
} else if( themeIcon.getImageIcon()==null ) { |
|
371 |
buffer.append(" <td title=\"Can't locate icon\">") |
|
372 |
.append(error_open) |
|
373 |
.append(themeIcon.getLabel()) |
|
374 |
.append(error_close) |
|
375 |
.append("</td>\n"); |
|
376 |
} else { |
|
377 |
buffer.append(" <td>") |
|
378 |
.append(themeIcon.getLabel()) |
|
379 |
.append("</td>\n"); |
|
380 | 403 |
|
381 |
} |
|
382 |
buffer.append(" </tr>\n"); |
|
383 |
} |
|
384 |
buffer.append("</table>\n"); |
|
385 |
buffer.append("<p><sup>(1)</sup> Resized Icon<br><sup>(2)</sup> Icon in default theme</p>"); |
|
386 |
buffer.append("</div>\n"); |
|
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"); |
|
387 | 430 |
|
388 |
return buffer.toString();
|
|
389 |
}
|
|
431 |
return buffer.toString();
|
|
432 |
}
|
|
390 | 433 |
|
391 |
private Set<String> getTangoIconNames() { |
|
392 |
String[] iconNames = new String[] { |
|
393 |
"address-book-new", |
|
394 |
"application-exit", |
|
395 |
"appointment-new", |
|
396 |
"call-start", |
|
397 |
"call-stop", |
|
398 |
"contact-new", |
|
399 |
"document-new", |
|
400 |
"document-open", |
|
401 |
"document-open-recent", |
|
402 |
"document-page-setup", |
|
403 |
"document-print", |
|
404 |
"document-print-preview", |
|
405 |
"document-properties", |
|
406 |
"document-revert", |
|
407 |
"document-save", |
|
408 |
"document-save-as", |
|
409 |
"document-send", |
|
410 |
"edit-clear", |
|
411 |
"edit-copy", |
|
412 |
"edit-cut", |
|
413 |
"edit-delete", |
|
414 |
"edit-find", |
|
415 |
"edit-find-replace", |
|
416 |
"edit-paste", |
|
417 |
"edit-redo", |
|
418 |
"edit-select-all", |
|
419 |
"edit-undo", |
|
420 |
"folder-new", |
|
421 |
"format-indent-less", |
|
422 |
"format-indent-more", |
|
423 |
"format-justify-center", |
|
424 |
"format-justify-fill", |
|
425 |
"format-justify-left", |
|
426 |
"format-justify-right", |
|
427 |
"format-text-direction-ltr", |
|
428 |
"format-text-direction-rtl", |
|
429 |
"format-text-bold", |
|
430 |
"format-text-italic", |
|
431 |
"format-text-underline", |
|
432 |
"format-text-strikethrough", |
|
433 |
"go-bottom", |
|
434 |
"go-down", |
|
435 |
"go-first", |
|
436 |
"go-home", |
|
437 |
"go-jump", |
|
438 |
"go-last", |
|
439 |
"go-next", |
|
440 |
"go-previous", |
|
441 |
"go-top", |
|
442 |
"go-up", |
|
443 |
"help-about", |
|
444 |
"help-contents", |
|
445 |
"help-faq", |
|
446 |
"insert-image", |
|
447 |
"insert-link", |
|
448 |
"insert-object", |
|
449 |
"insert-text", |
|
450 |
"list-add", |
|
451 |
"list-remove", |
|
452 |
"mail-forward", |
|
453 |
"mail-mark-important", |
|
454 |
"mail-mark-junk", |
|
455 |
"mail-mark-notjunk", |
|
456 |
"mail-mark-read", |
|
457 |
"mail-mark-unread", |
|
458 |
"mail-message-new", |
|
459 |
"mail-reply-all", |
|
460 |
"mail-reply-sender", |
|
461 |
"mail-send", |
|
462 |
"mail-send-receive", |
|
463 |
"media-eject", |
|
464 |
"media-playback-pause", |
|
465 |
"media-playback-start", |
|
466 |
"media-playback-stop", |
|
467 |
"media-record", |
|
468 |
"media-seek-backward", |
|
469 |
"media-seek-forward", |
|
470 |
"media-skip-backward", |
|
471 |
"media-skip-forward", |
|
472 |
"object-flip-horizontal", |
|
473 |
"object-flip-vertical", |
|
474 |
"object-rotate-left", |
|
475 |
"object-rotate-right", |
|
476 |
"process-stop", |
|
477 |
"system-lock-screen", |
|
478 |
"system-log-out", |
|
479 |
"system-run", |
|
480 |
"system-search", |
|
481 |
"system-reboot", |
|
482 |
"system-shutdown", |
|
483 |
"tools-check-spelling", |
|
484 |
"view-fullscreen", |
|
485 |
"view-refresh", |
|
486 |
"view-restore", |
|
487 |
"view-sort-ascending", |
|
488 |
"view-sort-descending", |
|
489 |
"window-close", |
|
490 |
"window-new", |
|
491 |
"zoom-fit-best", |
|
492 |
"zoom-in", |
|
493 |
"zoom-original", |
|
494 |
"zoom-out", |
|
495 |
"process-working", |
|
496 |
"accessories-calculator", |
|
497 |
"accessories-character-map", |
|
498 |
"accessories-dictionary", |
|
499 |
"accessories-text-editor", |
|
500 |
"help-browser", |
|
501 |
"multimedia-volume-control", |
|
502 |
"preferences-desktop-accessibility", |
|
503 |
"preferences-desktop-font", |
|
504 |
"preferences-desktop-keyboard", |
|
505 |
"preferences-desktop-locale", |
|
506 |
"preferences-desktop-multimedia", |
|
507 |
"preferences-desktop-screensaver", |
|
508 |
"preferences-desktop-theme", |
|
509 |
"preferences-desktop-wallpaper", |
|
510 |
"system-file-manager", |
|
511 |
"system-software-install", |
|
512 |
"system-software-update", |
|
513 |
"utilities-system-monitor", |
|
514 |
"utilities-terminal", |
|
515 |
"applications-accessories", |
|
516 |
"applications-development", |
|
517 |
"applications-engineering", |
|
518 |
"applications-games", |
|
519 |
"applications-graphics", |
|
520 |
"applications-internet", |
|
521 |
"applications-multimedia", |
|
522 |
"applications-office", |
|
523 |
"applications-other", |
|
524 |
"applications-science", |
|
525 |
"applications-system", |
|
526 |
"applications-utilities", |
|
527 |
"preferences-desktop", |
|
528 |
"preferences-desktop-peripherals", |
|
529 |
"preferences-desktop-personal", |
|
530 |
"preferences-other", |
|
531 |
"preferences-system", |
|
532 |
"preferences-system-network", |
|
533 |
"system-help", |
|
534 |
"audio-card", |
|
535 |
"audio-input-microphone", |
|
536 |
"battery", |
|
537 |
"camera-photo", |
|
538 |
"camera-video", |
|
539 |
"camera-web", |
|
540 |
"computer", |
|
541 |
"drive-harddisk", |
|
542 |
"drive-optical", |
|
543 |
"drive-removable-media", |
|
544 |
"input-gaming", |
|
545 |
"input-keyboard", |
|
546 |
"input-mouse", |
|
547 |
"input-tablet", |
|
548 |
"media-flash", |
|
549 |
"media-floppy", |
|
550 |
"media-optical", |
|
551 |
"media-tape", |
|
552 |
"modem", |
|
553 |
"multimedia-player", |
|
554 |
"network-wired", |
|
555 |
"network-wireless", |
|
556 |
"pda", |
|
557 |
"phone", |
|
558 |
"printer", |
|
559 |
"scanner", |
|
560 |
"video-display", |
|
561 |
"emblem-default", |
|
562 |
"emblem-documents", |
|
563 |
"emblem-downloads", |
|
564 |
"emblem-favorite", |
|
565 |
"emblem-important", |
|
566 |
"emblem-mail", |
|
567 |
"emblem-photos", |
|
568 |
"emblem-readonly", |
|
569 |
"emblem-shared", |
|
570 |
"emblem-symbolic-link", |
|
571 |
"emblem-synchronized", |
|
572 |
"emblem-system", |
|
573 |
"emblem-unreadable", |
|
574 |
"face-angel", |
|
575 |
"face-angry", |
|
576 |
"face-cool", |
|
577 |
"face-crying", |
|
578 |
"face-devilish", |
|
579 |
"face-embarrassed", |
|
580 |
"face-kiss", |
|
581 |
"face-laugh", |
|
582 |
"face-monkey", |
|
583 |
"face-plain", |
|
584 |
"face-raspberry", |
|
585 |
"face-sad", |
|
586 |
"face-sick", |
|
587 |
"face-smile", |
|
588 |
"face-smile-big", |
|
589 |
"face-smirk", |
|
590 |
"face-surprise", |
|
591 |
"face-tired", |
|
592 |
"face-uncertain", |
|
593 |
"face-wink", |
|
594 |
"face-worried", |
|
595 |
"flag-aa", |
|
596 |
"application-x-executable", |
|
597 |
"audio-x-generic", |
|
598 |
"font-x-generic", |
|
599 |
"image-x-generic", |
|
600 |
"package-x-generic", |
|
601 |
"text-html", |
|
602 |
"text-x-generic", |
|
603 |
"text-x-generic-template", |
|
604 |
"text-x-script", |
|
605 |
"video-x-generic", |
|
606 |
"x-office-address-book", |
|
607 |
"x-office-calendar", |
|
608 |
"x-office-document", |
|
609 |
"x-office-presentation", |
|
610 |
"x-office-spreadsheet", |
|
611 |
"folder", |
|
612 |
"folder-remote", |
|
613 |
"network-server", |
|
614 |
"network-workgroup", |
|
615 |
"start-here", |
|
616 |
"user-bookmarks", |
|
617 |
"user-desktop", |
|
618 |
"user-home", |
|
619 |
"user-trash", |
|
620 |
"appointment-missed", |
|
621 |
"appointment-soon", |
|
622 |
"audio-volume-high", |
|
623 |
"audio-volume-low", |
|
624 |
"audio-volume-medium", |
|
625 |
"audio-volume-muted", |
|
626 |
"battery-caution", |
|
627 |
"battery-low", |
|
628 |
"dialog-error", |
|
629 |
"dialog-information", |
|
630 |
"dialog-password", |
|
631 |
"dialog-question", |
|
632 |
"dialog-warning", |
|
633 |
"folder-drag-accept", |
|
634 |
"folder-open", |
|
635 |
"folder-visiting", |
|
636 |
"image-loading", |
|
637 |
"image-missing", |
|
638 |
"mail-attachment", |
|
639 |
"mail-unread", |
|
640 |
"mail-read", |
|
641 |
"mail-replied", |
|
642 |
"mail-signed", |
|
643 |
"mail-signed-verified", |
|
644 |
"media-playlist-repeat", |
|
645 |
"media-playlist-shuffle", |
|
646 |
"network-error", |
|
647 |
"network-idle", |
|
648 |
"network-offline", |
|
649 |
"network-receive", |
|
650 |
"network-transmit", |
|
651 |
"network-transmit-receive", |
|
652 |
"printer-error", |
|
653 |
"printer-printing", |
|
654 |
"security-high", |
|
655 |
"security-medium", |
|
656 |
"security-low", |
|
657 |
"software-update-available", |
|
658 |
"software-update-urgent", |
|
659 |
"sync-error", |
|
660 |
"sync-synchronizing", |
|
661 |
"task-due", |
|
662 |
"task-past-due", |
|
663 |
"user-available", |
|
664 |
"user-away", |
|
665 |
"user-idle", |
|
666 |
"user-offline", |
|
667 |
"user-trash-full", |
|
668 |
"weather-clear", |
|
669 |
"weather-clear-night", |
|
670 |
"weather-few-clouds", |
|
671 |
"weather-few-clouds-night", |
|
672 |
"weather-fog", |
|
673 |
"weather-overcast", |
|
674 |
"weather-severe-alert", |
|
675 |
"weather-showers", |
|
676 |
"weather-showers-scattered", |
|
677 |
"weather-snow", |
|
678 |
"weather-storm" |
|
679 |
}; |
|
680 |
Set<String> icons = new HashSet<String>(); |
|
681 |
for (int i = 0; i < iconNames.length; i++) { |
|
682 |
icons.add(iconNames[i]); |
|
683 |
} |
|
684 |
return icons; |
|
685 |
} |
|
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 |
} |
|
686 | 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 |
|
|
687 | 748 |
} |
Also available in: Unified diff