Browse Source

Fix issue with ProgressBar for loading graphs.

Holt59 6 years ago
parent
commit
ec9cd9c601

+ 1
- 7
src/main/org/insa/graphics/GraphReaderProgressBar.java View File

1
 package org.insa.graphics;
1
 package org.insa.graphics;
2
 
2
 
3
 import java.awt.Component;
3
 import java.awt.Component;
4
-import java.awt.Dimension;
5
 
4
 
6
 import javax.swing.Box;
5
 import javax.swing.Box;
7
 import javax.swing.BoxLayout;
6
 import javax.swing.BoxLayout;
38
     private final JProgressBar[] progressBars = new JProgressBar[3];
37
     private final JProgressBar[] progressBars = new JProgressBar[3];
39
 
38
 
40
     // Current element read, and modulo.
39
     // Current element read, and modulo.
41
-    private int[] counters = new int[]{ 0, 0, 0 };
40
+    private int[] counters = new int[] { 0, 0, 0 };
42
     private int[] modulos = new int[3];
41
     private int[] modulos = new int[3];
43
 
42
 
44
     public GraphReaderProgressBar(JFrame owner) {
43
     public GraphReaderProgressBar(JFrame owner) {
63
         }
62
         }
64
 
63
 
65
         pane.add(Box.createVerticalGlue());
64
         pane.add(Box.createVerticalGlue());
66
-
67
-        pane.setPreferredSize(new Dimension(300, 120));
68
-
69
         setContentPane(pane);
65
         setContentPane(pane);
70
-
71
         pack();
66
         pack();
72
-
73
     }
67
     }
74
 
68
 
75
     @Override
69
     @Override

+ 8
- 4
src/main/org/insa/graphics/MainWindow.java View File

157
         this.currentPalette = this.basicPalette;
157
         this.currentPalette = this.basicPalette;
158
 
158
 
159
         wccPanel = new AlgorithmPanel(this, WeaklyConnectedComponentsAlgorithm.class,
159
         wccPanel = new AlgorithmPanel(this, WeaklyConnectedComponentsAlgorithm.class,
160
-                "Weakly-Connected Components", new String[]{}, false, false);
160
+                "Weakly-Connected Components", new String[] {}, false, false);
161
         wccPanel.addStartActionListener(new ActionListener() {
161
         wccPanel.addStartActionListener(new ActionListener() {
162
             @Override
162
             @Override
163
             public void actionPerformed(ActionEvent e) {
163
             public void actionPerformed(ActionEvent e) {
202
         });
202
         });
203
 
203
 
204
         spPanel = new AlgorithmPanel(this, ShortestPathAlgorithm.class, "Shortest-Path",
204
         spPanel = new AlgorithmPanel(this, ShortestPathAlgorithm.class, "Shortest-Path",
205
-                new String[]{ "Origin", "Destination" }, true, true);
205
+                new String[] { "Origin", "Destination" }, true, true);
206
         spPanel.addStartActionListener(new ActionListener() {
206
         spPanel.addStartActionListener(new ActionListener() {
207
             @Override
207
             @Override
208
             public void actionPerformed(ActionEvent e) {
208
             public void actionPerformed(ActionEvent e) {
255
         });
255
         });
256
 
256
 
257
         cpPanel = new AlgorithmPanel(
257
         cpPanel = new AlgorithmPanel(
258
-                this, CarPoolingAlgorithm.class, "Car-Pooling", new String[]{ "Origin Car",
258
+                this, CarPoolingAlgorithm.class, "Car-Pooling", new String[] { "Origin Car",
259
                         "Origin Pedestrian", "Destination Car", "Destination Pedestrian" },
259
                         "Origin Pedestrian", "Destination Car", "Destination Pedestrian" },
260
                 true, true);
260
                 true, true);
261
 
261
 
262
         psPanel = new AlgorithmPanel(this, PackageSwitchAlgorithm.class, "Car-Pooling",
262
         psPanel = new AlgorithmPanel(this, PackageSwitchAlgorithm.class, "Car-Pooling",
263
-                new String[]{ "Oribin A", "Origin B", "Destination A", "Destination B" }, true,
263
+                new String[] { "Oribin A", "Origin B", "Destination A", "Destination B" }, true,
264
                 true);
264
                 true);
265
 
265
 
266
         // add algorithm panels
266
         // add algorithm panels
592
                     return;
592
                     return;
593
                 }
593
                 }
594
 
594
 
595
+                // In case of....
596
+                progressBar.setVisible(false);
597
+                progressBar = null;
598
+
595
                 String info = graph.getMapId();
599
                 String info = graph.getMapId();
596
                 if (graph.getMapName() != null && !graph.getMapName().isEmpty()) {
600
                 if (graph.getMapName() != null && !graph.getMapName().isEmpty()) {
597
                     // The \u200e character is the left-to-right mark, we need to avoid issue with
601
                     // The \u200e character is the left-to-right mark, we need to avoid issue with

Loading…
Cancel
Save