Fix issue with graph progress bar.
This commit is contained in:
parent
51e166600d
commit
4e541e67cf
@ -37,7 +37,7 @@ public class GraphReaderProgressBar extends JDialog implements GraphReaderObserv
|
|||||||
private final JProgressBar[] progressBars = new JProgressBar[3];
|
private final JProgressBar[] progressBars = new JProgressBar[3];
|
||||||
|
|
||||||
// Current element read, and modulo.
|
// 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];
|
private int[] modulos = new int[3];
|
||||||
|
|
||||||
public GraphReaderProgressBar(JFrame owner) {
|
public GraphReaderProgressBar(JFrame owner) {
|
||||||
@ -75,6 +75,7 @@ public class GraphReaderProgressBar extends JDialog implements GraphReaderObserv
|
|||||||
@Override
|
@Override
|
||||||
public void notifyEndReading() {
|
public void notifyEndReading() {
|
||||||
setVisible(false);
|
setVisible(false);
|
||||||
|
dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void initProgressBar(int index, int max) {
|
protected void initProgressBar(int index, int max) {
|
||||||
|
@ -157,7 +157,7 @@ public class MainWindow extends JFrame {
|
|||||||
this.currentPalette = this.basicPalette;
|
this.currentPalette = this.basicPalette;
|
||||||
|
|
||||||
wccPanel = new AlgorithmPanel(this, WeaklyConnectedComponentsAlgorithm.class,
|
wccPanel = new AlgorithmPanel(this, WeaklyConnectedComponentsAlgorithm.class,
|
||||||
"Weakly-Connected Components", new String[] {}, false);
|
"Weakly-Connected Components", new String[]{}, false);
|
||||||
wccPanel.addStartActionListener(new ActionListener() {
|
wccPanel.addStartActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
@ -202,7 +202,7 @@ public class MainWindow extends JFrame {
|
|||||||
});
|
});
|
||||||
|
|
||||||
spPanel = new AlgorithmPanel(this, ShortestPathAlgorithm.class, "Shortest-Path",
|
spPanel = new AlgorithmPanel(this, ShortestPathAlgorithm.class, "Shortest-Path",
|
||||||
new String[] { "Origin", "Destination" }, true);
|
new String[]{ "Origin", "Destination" }, true);
|
||||||
spPanel.addStartActionListener(new ActionListener() {
|
spPanel.addStartActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
@ -254,13 +254,12 @@ public class MainWindow extends JFrame {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
cpPanel = new AlgorithmPanel(
|
cpPanel = new AlgorithmPanel(this, CarPoolingAlgorithm.class, "Car-Pooling", new String[]{
|
||||||
this, CarPoolingAlgorithm.class, "Car-Pooling", new String[] { "Origin Car",
|
"Origin Car", "Origin Pedestrian", "Destination Car", "Destination Pedestrian" },
|
||||||
"Origin Pedestrian", "Destination Car", "Destination Pedestrian" },
|
|
||||||
true);
|
true);
|
||||||
|
|
||||||
psPanel = new AlgorithmPanel(this, PackageSwitchAlgorithm.class, "Car-Pooling",
|
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);
|
||||||
|
|
||||||
// add algorithm panels
|
// add algorithm panels
|
||||||
algoPanels.add(wccPanel);
|
algoPanels.add(wccPanel);
|
||||||
@ -580,10 +579,10 @@ public class MainWindow extends JFrame {
|
|||||||
reader.addObserver(progressBar);
|
reader.addObserver(progressBar);
|
||||||
try {
|
try {
|
||||||
graph = reader.read();
|
graph = reader.read();
|
||||||
System.out.flush();
|
|
||||||
}
|
}
|
||||||
catch (Exception exception) {
|
catch (Exception exception) {
|
||||||
progressBar.setVisible(false);
|
progressBar.setVisible(false);
|
||||||
|
progressBar.dispose();
|
||||||
progressBar = null;
|
progressBar = null;
|
||||||
JOptionPane.showMessageDialog(MainWindow.this,
|
JOptionPane.showMessageDialog(MainWindow.this,
|
||||||
"Unable to read graph from the selected file.");
|
"Unable to read graph from the selected file.");
|
||||||
@ -593,6 +592,7 @@ public class MainWindow extends JFrame {
|
|||||||
|
|
||||||
// In case of....
|
// In case of....
|
||||||
progressBar.setVisible(false);
|
progressBar.setVisible(false);
|
||||||
|
progressBar.dispose();
|
||||||
progressBar = null;
|
progressBar = null;
|
||||||
|
|
||||||
String info = graph.getMapId();
|
String info = graph.getMapId();
|
||||||
|
Loading…
Reference in New Issue
Block a user