Merge lp:~yrke/tapaal/updateResourceManager-2 into lp:tapaal
- updateResourceManager-2
- Merge into trunk
Proposed by
Kenneth Yrke Jørgensen
Status: | Merged |
---|---|
Approved by: | Jiri Srba |
Approved revision: | 1060 |
Merged at revision: | 1064 |
Proposed branch: | lp:~yrke/tapaal/updateResourceManager-2 |
Merge into: | lp:tapaal |
Diff against target: |
408 lines (+51/-34) 13 files modified
src/dk/aau/cs/gui/SharedPlacesAndTransitionsPanel.java (+4/-3) src/dk/aau/cs/gui/TemplateExplorer.java (+4/-3) src/dk/aau/cs/gui/smartDraw/SmartDrawDialog.java (+3/-2) src/dk/aau/cs/verification/IconSelector.java (+1/-1) src/net/tapaal/resourcemanager/ResourceManager.java (+17/-2) src/pipe/gui/CreateGui.java (+0/-2) src/pipe/gui/GuiFrame.java (+8/-10) src/pipe/gui/GuiFrameController.java (+1/-1) src/pipe/gui/RunKBoundAnalysis.java (+1/-1) src/pipe/gui/VersionChecker.java (+1/-1) src/pipe/gui/action/GuiAction.java (+3/-2) src/pipe/gui/widgets/ConstantsPane.java (+4/-3) src/pipe/gui/widgets/QueryPane.java (+4/-3) |
To merge this branch: | bzr merge lp:~yrke/tapaal/updateResourceManager-2 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jiri Srba | Approve | ||
Review via email: mp+384628@code.launchpad.net |
Commit message
Description of the change
Added a new function in ResoruceManager to acces icons, to avoid errors accessing not from classloader thread
Check icons are loaded correctly
To post a comment you must log in.
Revision history for this message
Jiri Srba (srba) : | # |
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'src/dk/aau/cs/gui/SharedPlacesAndTransitionsPanel.java' |
2 | --- src/dk/aau/cs/gui/SharedPlacesAndTransitionsPanel.java 2020-05-03 11:28:45 +0000 |
3 | +++ src/dk/aau/cs/gui/SharedPlacesAndTransitionsPanel.java 2020-05-27 13:29:25 +0000 |
4 | @@ -25,6 +25,7 @@ |
5 | import javax.swing.event.ListSelectionListener; |
6 | |
7 | import dk.aau.cs.gui.undo.*; |
8 | +import net.tapaal.resourcemanager.ResourceManager; |
9 | import pipe.gui.CreateGui; |
10 | import pipe.gui.undo.UndoManager; |
11 | import pipe.gui.widgets.ConstantsPane; |
12 | @@ -189,7 +190,7 @@ |
13 | gbc.anchor = GridBagConstraints.NORTHWEST; |
14 | listPanel.add(scrollPane, gbc); |
15 | |
16 | - moveUpButton = new JButton(new ImageIcon(Thread.currentThread().getContextClassLoader().getResource("resources/Images/Up.png"))); |
17 | + moveUpButton = new JButton(ResourceManager.getIcon("Up.png")); |
18 | moveUpButton.setEnabled(false); |
19 | moveUpButton.setToolTipText(toolTipMoveUp); |
20 | moveUpButton.addActionListener(e -> { |
21 | @@ -210,7 +211,7 @@ |
22 | gbc.anchor = GridBagConstraints.SOUTH; |
23 | listPanel.add(moveUpButton,gbc); |
24 | |
25 | - moveDownButton = new JButton(new ImageIcon(Thread.currentThread().getContextClassLoader().getResource("resources/Images/Down.png"))); |
26 | + moveDownButton = new JButton(ResourceManager.getIcon("Down.png")); |
27 | moveDownButton.setEnabled(false); |
28 | moveDownButton.setToolTipText(toolTipMoveDown); |
29 | moveDownButton.addActionListener(e -> { |
30 | @@ -230,7 +231,7 @@ |
31 | listPanel.add(moveDownButton,gbc); |
32 | |
33 | //Sort button |
34 | - sortButton = new JButton(new ImageIcon(Thread.currentThread().getContextClassLoader().getResource("resources/Images/Sort.png"))); |
35 | + sortButton = new JButton(ResourceManager.getIcon("Sort.png")); |
36 | sortButton.setToolTipText(toolTipSortPlaces); |
37 | sortButton.setEnabled(false); |
38 | sortButton.addActionListener(e -> { |
39 | |
40 | === modified file 'src/dk/aau/cs/gui/TemplateExplorer.java' |
41 | --- src/dk/aau/cs/gui/TemplateExplorer.java 2020-05-03 11:28:45 +0000 |
42 | +++ src/dk/aau/cs/gui/TemplateExplorer.java 2020-05-27 13:29:25 +0000 |
43 | @@ -39,6 +39,7 @@ |
44 | |
45 | import dk.aau.cs.gui.undo.MoveElementDownCommand; |
46 | import dk.aau.cs.gui.undo.MoveElementUpCommand; |
47 | +import net.tapaal.resourcemanager.ResourceManager; |
48 | import pipe.dataLayer.DataLayer; |
49 | import pipe.dataLayer.TAPNQuery; |
50 | import pipe.dataLayer.Template; |
51 | @@ -239,7 +240,7 @@ |
52 | gbc.anchor = GridBagConstraints.NORTHWEST; |
53 | templatePanel.add(scrollpane, gbc); |
54 | |
55 | - moveUpButton = new JButton(new ImageIcon(Thread.currentThread().getContextClassLoader().getResource("resources/Images/Up.png"))); |
56 | + moveUpButton = new JButton(ResourceManager.getIcon("Up.png")); |
57 | moveUpButton.setEnabled(false); |
58 | moveUpButton.setToolTipText(toolTipMoveUp); |
59 | moveUpButton.addActionListener(new ActionListener() { |
60 | @@ -262,7 +263,7 @@ |
61 | gbc.anchor = GridBagConstraints.SOUTH; |
62 | templatePanel.add(moveUpButton,gbc); |
63 | |
64 | - moveDownButton = new JButton(new ImageIcon(Thread.currentThread().getContextClassLoader().getResource("resources/Images/Down.png"))); |
65 | + moveDownButton = new JButton(ResourceManager.getIcon("Down.png")); |
66 | moveDownButton.setEnabled(false); |
67 | moveDownButton.setToolTipText(toolTipMoveDown); |
68 | moveDownButton.addActionListener(new ActionListener() { |
69 | @@ -286,7 +287,7 @@ |
70 | templatePanel.add(moveDownButton,gbc); |
71 | |
72 | //Sort button |
73 | - sortButton = new JButton(new ImageIcon(Thread.currentThread().getContextClassLoader().getResource("resources/Images/Sort.png"))); |
74 | + sortButton = new JButton(ResourceManager.getIcon("Sort.png")); |
75 | sortButton.setToolTipText(toolTipSortComponents); |
76 | sortButton.setEnabled(false); |
77 | sortButton.addActionListener(e -> { |
78 | |
79 | === modified file 'src/dk/aau/cs/gui/smartDraw/SmartDrawDialog.java' |
80 | --- src/dk/aau/cs/gui/smartDraw/SmartDrawDialog.java 2020-04-18 12:27:02 +0000 |
81 | +++ src/dk/aau/cs/gui/smartDraw/SmartDrawDialog.java 2020-05-27 13:29:25 +0000 |
82 | @@ -35,6 +35,7 @@ |
83 | import javax.swing.event.ChangeEvent; |
84 | import javax.swing.event.ChangeListener; |
85 | |
86 | +import net.tapaal.resourcemanager.ResourceManager; |
87 | import net.tapaal.swinghelpers.CustomJSpinner; |
88 | import pipe.gui.CreateGui; |
89 | import pipe.gui.graphicElements.PetriNetObject; |
90 | @@ -83,7 +84,7 @@ |
91 | buffer.append("<br/><br/>"); |
92 | buffer.append("<b>Example:</b><br/>"); |
93 | buffer.append("<br/><br/>"); |
94 | - buffer.append("<img src=\"" + Thread.currentThread().getContextClassLoader().getResource(CreateGui.imgPath + "SmartDrawExampleWithLayers.png") +"\" />"); |
95 | + buffer.append("<img src=\"" + Thread.currentThread().getContextClassLoader().getResource(ResourceManager.imgPath + "SmartDrawExampleWithLayers.png") +"\" />"); |
96 | buffer.append("<br/><br/>"); |
97 | buffer.append("This layout was created with the default values.\n"); |
98 | buffer.append("On the figure the numbers and boxes describe the layer. Furthermore, the effect of the <em>Overlapping arc penalty</em> can be seen\n"); |
99 | @@ -690,7 +691,7 @@ |
100 | loadingDialogFrame = new JDialog(CreateGui.getApp(), "Working...", true); |
101 | loadingDialogFrame.setLayout(new GridBagLayout()); |
102 | loadingDialogFrame.setType(Window.Type.POPUP); |
103 | - ImageIcon loadingGIF = new ImageIcon(Thread.currentThread().getContextClassLoader().getResource(CreateGui.imgPath + "ajax-loader.gif")); |
104 | + ImageIcon loadingGIF = ResourceManager.getIcon("ajax-loader.gif"); |
105 | |
106 | JLabel workingLabel = new JLabel("<html><div style='text-align: center;'>Currently doing layout...<br/>This may take several minutes depending on the size of the net...</div></html>", SwingConstants.CENTER); |
107 | GridBagConstraints gbc = new GridBagConstraints(); |
108 | |
109 | === modified file 'src/dk/aau/cs/verification/IconSelector.java' |
110 | --- src/dk/aau/cs/verification/IconSelector.java 2013-12-05 13:46:06 +0000 |
111 | +++ src/dk/aau/cs/verification/IconSelector.java 2020-05-27 13:29:25 +0000 |
112 | @@ -2,7 +2,7 @@ |
113 | |
114 | import javax.swing.ImageIcon; |
115 | |
116 | -import dk.aau.cs.io.ResourceManager; |
117 | +import net.tapaal.resourcemanager.ResourceManager; |
118 | |
119 | public abstract class IconSelector { |
120 | protected static ImageIcon satisfiedIcon = ResourceManager.satisfiedIcon(); |
121 | |
122 | === added directory 'src/net/tapaal/resourcemanager' |
123 | === renamed file 'src/dk/aau/cs/io/ResourceManager.java' => 'src/net/tapaal/resourcemanager/ResourceManager.java' |
124 | --- src/dk/aau/cs/io/ResourceManager.java 2019-03-22 12:45:44 +0000 |
125 | +++ src/net/tapaal/resourcemanager/ResourceManager.java 2020-05-27 13:29:25 +0000 |
126 | @@ -1,7 +1,9 @@ |
127 | -package dk.aau.cs.io; |
128 | +package net.tapaal.resourcemanager; |
129 | |
130 | import java.awt.Image; |
131 | import java.io.IOException; |
132 | +import java.net.URL; |
133 | +import java.util.Objects; |
134 | |
135 | import javax.imageio.ImageIO; |
136 | import javax.swing.ImageIcon; |
137 | @@ -9,6 +11,8 @@ |
138 | import pipe.gui.CreateGui; |
139 | |
140 | public class ResourceManager { |
141 | + public static final String imgPath = "resources/Images/"; |
142 | + |
143 | private static ImageIcon satisfiedIcon = loadIcon("satisfied.png"); |
144 | private static ImageIcon notSatisfiedIcon = loadIcon("notsatisfied.png"); |
145 | private static ImageIcon inconclusiveIcon = loadIcon("maybe1.png"); |
146 | @@ -18,12 +22,23 @@ |
147 | |
148 | private static ImageIcon loadIcon(String name) { |
149 | try { |
150 | - return new ImageIcon(ImageIO.read(Thread.currentThread().getContextClassLoader().getResource(CreateGui.imgPath + name)).getScaledInstance(52, 52, Image.SCALE_SMOOTH)); |
151 | + return new ImageIcon(ImageIO.read(Objects.requireNonNull(Thread.currentThread().getContextClassLoader().getResource(imgPath + name))).getScaledInstance(52, 52, Image.SCALE_SMOOTH)); |
152 | } catch (IOException | IllegalArgumentException e) { |
153 | e.printStackTrace(); |
154 | } |
155 | return null; |
156 | } |
157 | + |
158 | + public static ImageIcon getIcon(String name) { |
159 | + return Objects.requireNonNull(getIconIfExists(name), "Icon " + name + " not found"); |
160 | + } |
161 | + |
162 | + public static ImageIcon getIconIfExists(String name) { |
163 | + URL resourceURL = Thread.currentThread().getContextClassLoader().getResource(ResourceManager.imgPath + name); |
164 | + if (resourceURL == null) return null; |
165 | + |
166 | + return new ImageIcon(resourceURL); |
167 | + } |
168 | |
169 | public static ImageIcon satisfiedIcon(){ |
170 | return satisfiedIcon; |
171 | |
172 | === modified file 'src/pipe/gui/CreateGui.java' |
173 | --- src/pipe/gui/CreateGui.java 2020-05-25 19:02:55 +0000 |
174 | +++ src/pipe/gui/CreateGui.java 2020-05-27 13:29:25 +0000 |
175 | @@ -18,8 +18,6 @@ |
176 | private static GuiFrameController appGuiController; |
177 | |
178 | private static ArrayList<TabContent> tabs = new ArrayList<TabContent>(); |
179 | - |
180 | - public static final String imgPath = "resources/Images/"; |
181 | |
182 | public static void init() { |
183 | appGui = new GuiFrame(TAPAAL.getProgramName()); |
184 | |
185 | === modified file 'src/pipe/gui/GuiFrame.java' |
186 | --- src/pipe/gui/GuiFrame.java 2020-04-30 12:52:28 +0000 |
187 | +++ src/pipe/gui/GuiFrame.java 2020-05-27 13:29:25 +0000 |
188 | @@ -34,7 +34,7 @@ |
189 | import pipe.gui.widgets.WorkflowDialog; |
190 | import dk.aau.cs.debug.Logger; |
191 | import dk.aau.cs.gui.smartDraw.SmartDrawDialog; |
192 | -import dk.aau.cs.io.ResourceManager; |
193 | +import net.tapaal.resourcemanager.ResourceManager; |
194 | import dk.aau.cs.verification.UPPAAL.Verifyta; |
195 | import dk.aau.cs.verification.VerifyTAPN.VerifyTAPN; |
196 | import dk.aau.cs.verification.VerifyTAPN.VerifyTAPNDiscreteVerification; |
197 | @@ -243,7 +243,7 @@ |
198 | Application app = Application.getApplication(); |
199 | try { |
200 | Image appImage; |
201 | - appImage = ImageIO.read(Thread.currentThread().getContextClassLoader().getResource(CreateGui.imgPath + "icon.png")); |
202 | + appImage = ImageIO.read(Thread.currentThread().getContextClassLoader().getResource(ResourceManager.imgPath + "icon.png")); |
203 | app.setDockIconImage(appImage); |
204 | } catch (IOException e) { |
205 | Logger.log("Error loading Image"); |
206 | @@ -261,7 +261,7 @@ |
207 | |
208 | } |
209 | |
210 | - this.setIconImage(new ImageIcon(Thread.currentThread().getContextClassLoader().getResource(CreateGui.imgPath + "icon.png")).getImage()); |
211 | + this.setIconImage(ResourceManager.getIcon("icon.png").getImage()); |
212 | } |
213 | |
214 | |
215 | @@ -407,7 +407,7 @@ |
216 | viewMenu.setMnemonic('V'); |
217 | |
218 | zoomMenu = new JMenu("Zoom"); |
219 | - zoomMenu.setIcon(new ImageIcon(Thread.currentThread().getContextClassLoader().getResource(CreateGui.imgPath + "Zoom.png"))); |
220 | + zoomMenu.setIcon(ResourceManager.getIcon("Zoom.png")); |
221 | |
222 | addZoomMenuItems(zoomMenu); |
223 | |
224 | @@ -1387,7 +1387,7 @@ |
225 | |
226 | // Import menu |
227 | JMenu importMenu = new JMenu("Import"); |
228 | - importMenu.setIcon(new ImageIcon(Thread.currentThread().getContextClassLoader().getResource(CreateGui.imgPath + "Export.png"))); |
229 | + importMenu.setIcon(ResourceManager.getIcon("Export.png")); |
230 | |
231 | importMenu.add(importPNMLAction = new GuiAction("PNML untimed net", "Import an untimed net in the PNML format", KeyStroke.getKeyStroke('X', shortcutkey)) { |
232 | public void actionPerformed(ActionEvent arg0) { |
233 | @@ -1412,7 +1412,7 @@ |
234 | |
235 | // Export menu |
236 | JMenu exportMenu = new JMenu("Export"); |
237 | - exportMenu.setIcon(new ImageIcon(Thread.currentThread().getContextClassLoader().getResource(CreateGui.imgPath + "Export.png"))); |
238 | + exportMenu.setIcon(ResourceManager.getIcon("Export.png")); |
239 | |
240 | exportMenu.add(exportPNGAction = new GuiAction("PNG", "Export the net to PNG format", KeyStroke.getKeyStroke('G', shortcutkey)) { |
241 | public void actionPerformed(ActionEvent arg0) { |
242 | @@ -1493,7 +1493,7 @@ |
243 | // is ignored |
244 | if (nets != null && nets.length > 0) { |
245 | JMenu exampleMenu = new JMenu("Example nets"); |
246 | - exampleMenu.setIcon(new ImageIcon(Thread.currentThread().getContextClassLoader().getResource(CreateGui.imgPath + "Example.png"))); |
247 | + exampleMenu.setIcon(ResourceManager.getIcon("Example.png")); |
248 | |
249 | for (String filename : nets) { |
250 | if (filename.toLowerCase().endsWith(".tapn")) { |
251 | @@ -1512,9 +1512,7 @@ |
252 | } |
253 | } |
254 | }; |
255 | - tmp.putValue(Action.SMALL_ICON, new ImageIcon(Thread.currentThread() |
256 | - .getContextClassLoader().getResource( |
257 | - CreateGui.imgPath + "Net.png"))); |
258 | + tmp.putValue(Action.SMALL_ICON, ResourceManager.getIcon("Net.png")); |
259 | exampleMenu.add(tmp); |
260 | } |
261 | } |
262 | |
263 | === modified file 'src/pipe/gui/GuiFrameController.java' |
264 | --- src/pipe/gui/GuiFrameController.java 2020-04-18 14:20:41 +0000 |
265 | +++ src/pipe/gui/GuiFrameController.java 2020-05-27 13:29:25 +0000 |
266 | @@ -5,7 +5,7 @@ |
267 | import dk.aau.cs.gui.TabContent; |
268 | import dk.aau.cs.gui.TabContentActions; |
269 | import dk.aau.cs.gui.smartDraw.SmartDrawDialog; |
270 | -import dk.aau.cs.io.ResourceManager; |
271 | +import net.tapaal.resourcemanager.ResourceManager; |
272 | import dk.aau.cs.model.tapn.simulation.ShortestDelayMode; |
273 | import dk.aau.cs.verification.UPPAAL.Verifyta; |
274 | import dk.aau.cs.verification.VerifyTAPN.VerifyTAPN; |
275 | |
276 | === modified file 'src/pipe/gui/RunKBoundAnalysis.java' |
277 | --- src/pipe/gui/RunKBoundAnalysis.java 2020-03-24 16:53:17 +0000 |
278 | +++ src/pipe/gui/RunKBoundAnalysis.java 2020-05-27 13:29:25 +0000 |
279 | @@ -4,7 +4,7 @@ |
280 | import javax.swing.JSpinner; |
281 | |
282 | import dk.aau.cs.Messenger; |
283 | -import dk.aau.cs.io.ResourceManager; |
284 | +import net.tapaal.resourcemanager.ResourceManager; |
285 | import dk.aau.cs.model.tapn.simulation.TAPNNetworkTrace; |
286 | import dk.aau.cs.verification.Boundedness; |
287 | import dk.aau.cs.verification.ModelChecker; |
288 | |
289 | === modified file 'src/pipe/gui/VersionChecker.java' |
290 | --- src/pipe/gui/VersionChecker.java 2020-03-28 08:33:31 +0000 |
291 | +++ src/pipe/gui/VersionChecker.java 2020-05-27 13:29:25 +0000 |
292 | @@ -13,7 +13,7 @@ |
293 | import net.tapaal.TAPAAL; |
294 | |
295 | import dk.aau.cs.debug.Logger; |
296 | -import dk.aau.cs.io.ResourceManager; |
297 | +import net.tapaal.resourcemanager.ResourceManager; |
298 | |
299 | public class VersionChecker { |
300 | private static final String versionURL = "http://versioncheck.tapaal.net/fileadmin/version.txt"; |
301 | |
302 | === modified file 'src/pipe/gui/action/GuiAction.java' |
303 | --- src/pipe/gui/action/GuiAction.java 2019-11-05 14:16:18 +0000 |
304 | +++ src/pipe/gui/action/GuiAction.java 2020-05-27 13:29:25 +0000 |
305 | @@ -9,6 +9,7 @@ |
306 | import javax.swing.ImageIcon; |
307 | import javax.swing.KeyStroke; |
308 | |
309 | +import net.tapaal.resourcemanager.ResourceManager; |
310 | import pipe.gui.CreateGui; |
311 | |
312 | /** |
313 | @@ -32,7 +33,7 @@ |
314 | super(name); |
315 | URL iconURL = null; |
316 | |
317 | - iconURL = Thread.currentThread().getContextClassLoader().getResource(CreateGui.imgPath + name + ".png"); |
318 | + iconURL = Thread.currentThread().getContextClassLoader().getResource(ResourceManager.imgPath + name + ".png"); |
319 | |
320 | if (iconURL != null) { |
321 | putValue(SMALL_ICON, new ImageIcon(iconURL)); |
322 | @@ -77,7 +78,7 @@ |
323 | super(name); |
324 | URL iconURL = null; |
325 | |
326 | - iconURL = Thread.currentThread().getContextClassLoader().getResource(CreateGui.imgPath + name + ".png"); |
327 | + iconURL = Thread.currentThread().getContextClassLoader().getResource(ResourceManager.imgPath + name + ".png"); |
328 | |
329 | if (iconURL != null) { |
330 | putValue(SMALL_ICON, new ImageIcon(iconURL)); |
331 | |
332 | === modified file 'src/pipe/gui/widgets/ConstantsPane.java' |
333 | --- src/pipe/gui/widgets/ConstantsPane.java 2020-05-18 07:39:27 +0000 |
334 | +++ src/pipe/gui/widgets/ConstantsPane.java 2020-05-27 13:29:25 +0000 |
335 | @@ -38,6 +38,7 @@ |
336 | |
337 | import dk.aau.cs.gui.undo.MoveElementDownCommand; |
338 | import dk.aau.cs.gui.undo.MoveElementUpCommand; |
339 | +import net.tapaal.resourcemanager.ResourceManager; |
340 | import pipe.gui.CreateGui; |
341 | import dk.aau.cs.gui.TabContent; |
342 | import dk.aau.cs.gui.undo.Command; |
343 | @@ -348,7 +349,7 @@ |
344 | gbc.anchor = GridBagConstraints.NORTHWEST; |
345 | constantsPanel.add(constantsScroller, gbc); |
346 | |
347 | - moveUpButton = new JButton(new ImageIcon(Thread.currentThread().getContextClassLoader().getResource("resources/Images/Up.png"))); |
348 | + moveUpButton = new JButton(ResourceManager.getIcon("Up.png")); |
349 | moveUpButton.setEnabled(false); |
350 | moveUpButton.setToolTipText(toolTipMoveUp); |
351 | moveUpButton.addActionListener(e -> { |
352 | @@ -368,7 +369,7 @@ |
353 | gbc.anchor = GridBagConstraints.SOUTH; |
354 | constantsPanel.add(moveUpButton,gbc); |
355 | |
356 | - moveDownButton = new JButton(new ImageIcon(Thread.currentThread().getContextClassLoader().getResource("resources/Images/Down.png"))); |
357 | + moveDownButton = new JButton(ResourceManager.getIcon("Down.png")); |
358 | moveDownButton.setEnabled(false); |
359 | moveDownButton.setToolTipText(toolTipMoveDown); |
360 | moveDownButton.addActionListener(e -> { |
361 | @@ -389,7 +390,7 @@ |
362 | constantsPanel.add(moveDownButton,gbc); |
363 | |
364 | //Sort button |
365 | - sortButton = new JButton(new ImageIcon(Thread.currentThread().getContextClassLoader().getResource("resources/Images/Sort.png"))); |
366 | + sortButton = new JButton(ResourceManager.getIcon("Sort.png")); |
367 | sortButton.setToolTipText(toolTipSortConstants); |
368 | sortButton.setEnabled(false); |
369 | sortButton.addActionListener(e -> { |
370 | |
371 | === modified file 'src/pipe/gui/widgets/QueryPane.java' |
372 | --- src/pipe/gui/widgets/QueryPane.java 2020-05-03 11:28:45 +0000 |
373 | +++ src/pipe/gui/widgets/QueryPane.java 2020-05-27 13:29:25 +0000 |
374 | @@ -32,6 +32,7 @@ |
375 | import dk.aau.cs.gui.TemplateExplorer; |
376 | import dk.aau.cs.gui.undo.MoveElementDownCommand; |
377 | import dk.aau.cs.gui.undo.MoveElementUpCommand; |
378 | +import net.tapaal.resourcemanager.ResourceManager; |
379 | import pipe.dataLayer.TAPNQuery; |
380 | import pipe.gui.CreateGui; |
381 | import pipe.gui.MessengerImpl; |
382 | @@ -208,7 +209,7 @@ |
383 | gbc.anchor = GridBagConstraints.NORTHWEST; |
384 | queryCollectionPanel.add(queryScroller, gbc); |
385 | |
386 | - moveUpButton = new JButton(new ImageIcon(Thread.currentThread().getContextClassLoader().getResource("resources/Images/Up.png"))); |
387 | + moveUpButton = new JButton(ResourceManager.getIcon("Up.png")); |
388 | moveUpButton.setEnabled(false); |
389 | moveUpButton.setToolTipText(toolTipMoveUp); |
390 | moveUpButton.addActionListener(new ActionListener() { |
391 | @@ -232,7 +233,7 @@ |
392 | gbc.anchor = GridBagConstraints.SOUTH; |
393 | queryCollectionPanel.add(moveUpButton,gbc); |
394 | |
395 | - moveDownButton = new JButton(new ImageIcon(Thread.currentThread().getContextClassLoader().getResource("resources/Images/Down.png"))); |
396 | + moveDownButton = new JButton(ResourceManager.getIcon("Down.png")); |
397 | moveDownButton.setEnabled(false); |
398 | moveDownButton.setToolTipText(toolTipMoveDown); |
399 | moveDownButton.addActionListener(new ActionListener() { |
400 | @@ -258,7 +259,7 @@ |
401 | queryCollectionPanel.add(moveDownButton,gbc); |
402 | |
403 | //Sort button |
404 | - sortButton = new JButton(new ImageIcon(Thread.currentThread().getContextClassLoader().getResource("resources/Images/Sort.png"))); |
405 | + sortButton = new JButton(ResourceManager.getIcon("Sort.png")); |
406 | sortButton.setToolTipText(toolTipSortQueries); |
407 | sortButton.setEnabled(false); |
408 | sortButton.addActionListener(e -> { |