Fix issue with file dialog not showing when drawing mapsforge.
This commit is contained in:
parent
e0268c80af
commit
23928b2c5b
@ -163,7 +163,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, false);
|
"Weakly-Connected Components", new String[] {}, false, false);
|
||||||
wccPanel.addStartActionListener(new ActionListener() {
|
wccPanel.addStartActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
@ -208,7 +208,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, true);
|
new String[] { "Origin", "Destination" }, true, true);
|
||||||
spPanel.addStartActionListener(new ActionListener() {
|
spPanel.addStartActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
@ -261,12 +261,12 @@ public class MainWindow extends JFrame {
|
|||||||
});
|
});
|
||||||
|
|
||||||
cpPanel = new AlgorithmPanel(
|
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" },
|
"Origin Pedestrian", "Destination Car", "Destination Pedestrian" },
|
||||||
true, true);
|
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,
|
||||||
true);
|
true);
|
||||||
|
|
||||||
// add algorithm panels
|
// add algorithm panels
|
||||||
@ -463,7 +463,10 @@ public class MainWindow extends JFrame {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Runnable runnable = null;
|
||||||
|
|
||||||
if (isMapView && mfile != null) {
|
if (isMapView && mfile != null) {
|
||||||
|
final File mfileFinal = mfile;
|
||||||
// It is a mapview drawing and the file was found, so:
|
// It is a mapview drawing and the file was found, so:
|
||||||
// 1. We create the drawing if necessary.
|
// 1. We create the drawing if necessary.
|
||||||
if (drawing != mapViewDrawing) {
|
if (drawing != mapViewDrawing) {
|
||||||
@ -473,16 +476,17 @@ public class MainWindow extends JFrame {
|
|||||||
mainPanel.setDividerLocation(oldLocation);
|
mainPanel.setDividerLocation(oldLocation);
|
||||||
notifyDrawingLoaded(basicDrawing, mapViewDrawing);
|
notifyDrawingLoaded(basicDrawing, mapViewDrawing);
|
||||||
drawing.clear();
|
drawing.clear();
|
||||||
((MapViewDrawing) drawing).drawGraph(mfile);
|
isNewGraph = true;
|
||||||
}
|
}
|
||||||
else if (isNewGraph) {
|
if (isNewGraph) {
|
||||||
drawing.clear();
|
drawing.clear();
|
||||||
((MapViewDrawing) drawing).drawGraph(mfile);
|
runnable = new Runnable() {
|
||||||
}
|
public void run() {
|
||||||
else {
|
((MapViewDrawing) drawing).drawGraph(mfileFinal);
|
||||||
drawing.clearOverlays();
|
|
||||||
}
|
|
||||||
notifyRedrawRequest();
|
notifyRedrawRequest();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (!isMapView || (isMapView && mfile == null && isNewGraph)) {
|
else if (!isMapView || (isMapView && mfile == null && isNewGraph)) {
|
||||||
@ -492,18 +496,25 @@ public class MainWindow extends JFrame {
|
|||||||
mainPanel.setLeftComponent(basicDrawing);
|
mainPanel.setLeftComponent(basicDrawing);
|
||||||
mainPanel.setDividerLocation(oldLocation);
|
mainPanel.setDividerLocation(oldLocation);
|
||||||
notifyDrawingLoaded(mapViewDrawing, basicDrawing);
|
notifyDrawingLoaded(mapViewDrawing, basicDrawing);
|
||||||
this.currentPalette = palette;
|
isNewGraph = true;
|
||||||
drawing.clear();
|
|
||||||
drawing.drawGraph(graph, palette);
|
|
||||||
}
|
}
|
||||||
else if (isNewGraph || palette != this.currentPalette) {
|
if (isNewGraph || palette != this.currentPalette) {
|
||||||
this.currentPalette = palette;
|
this.currentPalette = palette;
|
||||||
drawing.clear();
|
drawing.clear();
|
||||||
|
runnable = new Runnable() {
|
||||||
|
public void run() {
|
||||||
drawing.drawGraph(graph, palette);
|
drawing.drawGraph(graph, palette);
|
||||||
|
notifyRedrawRequest();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (runnable != null) {
|
||||||
|
launchThread(runnable, false);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
drawing.clearOverlays();
|
drawing.clearOverlays();
|
||||||
}
|
|
||||||
notifyRedrawRequest();
|
notifyRedrawRequest();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -696,13 +707,8 @@ public class MainWindow extends JFrame {
|
|||||||
drawGraphItem.addActionListener(baf.createBlockingAction(new ActionListener() {
|
drawGraphItem.addActionListener(baf.createBlockingAction(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
launchThread(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
drawGraph(BasicDrawing.class, basicPalette);
|
drawGraph(BasicDrawing.class, basicPalette);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
|
||||||
}));
|
}));
|
||||||
graphLockItems.add(drawGraphItem);
|
graphLockItems.add(drawGraphItem);
|
||||||
JMenuItem drawGraphBWItem = new JMenuItem("Redraw (B&W)", KeyEvent.VK_B);
|
JMenuItem drawGraphBWItem = new JMenuItem("Redraw (B&W)", KeyEvent.VK_B);
|
||||||
@ -710,13 +716,8 @@ public class MainWindow extends JFrame {
|
|||||||
drawGraphBWItem.addActionListener(baf.createBlockingAction(new ActionListener() {
|
drawGraphBWItem.addActionListener(baf.createBlockingAction(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
launchThread(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
drawGraph(BasicDrawing.class, blackAndWhitePalette);
|
drawGraph(BasicDrawing.class, blackAndWhitePalette);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
|
||||||
}));
|
}));
|
||||||
graphLockItems.add(drawGraphBWItem);
|
graphLockItems.add(drawGraphBWItem);
|
||||||
JMenuItem drawGraphMapsforgeItem = new JMenuItem("Redraw (Map)", KeyEvent.VK_M);
|
JMenuItem drawGraphMapsforgeItem = new JMenuItem("Redraw (Map)", KeyEvent.VK_M);
|
||||||
@ -725,13 +726,8 @@ public class MainWindow extends JFrame {
|
|||||||
drawGraphMapsforgeItem.addActionListener(baf.createBlockingAction(new ActionListener() {
|
drawGraphMapsforgeItem.addActionListener(baf.createBlockingAction(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
launchThread(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
drawGraph(MapViewDrawing.class);
|
drawGraph(MapViewDrawing.class);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
|
||||||
}));
|
}));
|
||||||
graphLockItems.add(drawGraphMapsforgeItem);
|
graphLockItems.add(drawGraphMapsforgeItem);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user