Fix issue with ProgressBar for loading graphs.
This commit is contained in:
		
							parent
							
								
									25e35b9bc4
								
							
						
					
					
						commit
						ec9cd9c601
					
				
					 2 changed files with 9 additions and 11 deletions
				
			
		|  | @ -1,7 +1,6 @@ | |||
| package org.insa.graphics; | ||||
| 
 | ||||
| import java.awt.Component; | ||||
| import java.awt.Dimension; | ||||
| 
 | ||||
| import javax.swing.Box; | ||||
| import javax.swing.BoxLayout; | ||||
|  | @ -38,7 +37,7 @@ public class GraphReaderProgressBar extends JDialog implements GraphReaderObserv | |||
|     private final JProgressBar[] progressBars = new JProgressBar[3]; | ||||
| 
 | ||||
|     // Current element read, and modulo. | ||||
|     private int[] counters = new int[]{ 0, 0, 0 }; | ||||
|     private int[] counters = new int[] { 0, 0, 0 }; | ||||
|     private int[] modulos = new int[3]; | ||||
| 
 | ||||
|     public GraphReaderProgressBar(JFrame owner) { | ||||
|  | @ -63,13 +62,8 @@ public class GraphReaderProgressBar extends JDialog implements GraphReaderObserv | |||
|         } | ||||
| 
 | ||||
|         pane.add(Box.createVerticalGlue()); | ||||
| 
 | ||||
|         pane.setPreferredSize(new Dimension(300, 120)); | ||||
| 
 | ||||
|         setContentPane(pane); | ||||
| 
 | ||||
|         pack(); | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|  |  | |||
|  | @ -157,7 +157,7 @@ public class MainWindow extends JFrame { | |||
|         this.currentPalette = this.basicPalette; | ||||
| 
 | ||||
|         wccPanel = new AlgorithmPanel(this, WeaklyConnectedComponentsAlgorithm.class, | ||||
|                 "Weakly-Connected Components", new String[]{}, false, false); | ||||
|                 "Weakly-Connected Components", new String[] {}, false, false); | ||||
|         wccPanel.addStartActionListener(new ActionListener() { | ||||
|             @Override | ||||
|             public void actionPerformed(ActionEvent e) { | ||||
|  | @ -202,7 +202,7 @@ public class MainWindow extends JFrame { | |||
|         }); | ||||
| 
 | ||||
|         spPanel = new AlgorithmPanel(this, ShortestPathAlgorithm.class, "Shortest-Path", | ||||
|                 new String[]{ "Origin", "Destination" }, true, true); | ||||
|                 new String[] { "Origin", "Destination" }, true, true); | ||||
|         spPanel.addStartActionListener(new ActionListener() { | ||||
|             @Override | ||||
|             public void actionPerformed(ActionEvent e) { | ||||
|  | @ -255,12 +255,12 @@ public class MainWindow extends JFrame { | |||
|         }); | ||||
| 
 | ||||
|         cpPanel = new AlgorithmPanel( | ||||
|                 this, CarPoolingAlgorithm.class, "Car-Pooling", new String[]{ "Origin Car", | ||||
|                 this, CarPoolingAlgorithm.class, "Car-Pooling", new String[] { "Origin Car", | ||||
|                         "Origin Pedestrian", "Destination Car", "Destination Pedestrian" }, | ||||
|                 true, true); | ||||
| 
 | ||||
|         psPanel = new AlgorithmPanel(this, PackageSwitchAlgorithm.class, "Car-Pooling", | ||||
|                 new String[]{ "Oribin A", "Origin B", "Destination A", "Destination B" }, true, | ||||
|                 new String[] { "Oribin A", "Origin B", "Destination A", "Destination B" }, true, | ||||
|                 true); | ||||
| 
 | ||||
|         // add algorithm panels | ||||
|  | @ -592,6 +592,10 @@ public class MainWindow extends JFrame { | |||
|                     return; | ||||
|                 } | ||||
| 
 | ||||
|                 // In case of.... | ||||
|                 progressBar.setVisible(false); | ||||
|                 progressBar = null; | ||||
| 
 | ||||
|                 String info = graph.getMapId(); | ||||
|                 if (graph.getMapName() != null && !graph.getMapName().isEmpty()) { | ||||
|                     // The \u200e character is the left-to-right mark, we need to avoid issue with | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue