mirror of
https://github.com/PAMGuard/PAMGuard.git
synced 2025-04-28 02:57:22 +00:00
Update FileMapMakingdialog.java
update map making dialog to always fully dispose dialog
This commit is contained in:
parent
e69520a0b5
commit
c33ad18067
@ -23,6 +23,8 @@ public class FileMapMakingdialog extends PamDialog {
|
|||||||
private static FileMapMakingdialog singleInstance;
|
private static FileMapMakingdialog singleInstance;
|
||||||
|
|
||||||
private OfflineFileServer offlineFileServer;
|
private OfflineFileServer offlineFileServer;
|
||||||
|
|
||||||
|
private static Object synchObject = new Object();
|
||||||
|
|
||||||
private FileMapMakingdialog(Window parentFrame) {
|
private FileMapMakingdialog(Window parentFrame) {
|
||||||
super(parentFrame, "Map raw sound files", false);
|
super(parentFrame, "Map raw sound files", false);
|
||||||
@ -42,19 +44,35 @@ public class FileMapMakingdialog extends PamDialog {
|
|||||||
getCancelButton().setVisible(false);
|
getCancelButton().setVisible(false);
|
||||||
setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
|
setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
|
||||||
setModalityType(Dialog.ModalityType.MODELESS);
|
setModalityType(Dialog.ModalityType.MODELESS);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static FileMapMakingdialog showDialog(Window parent, OfflineFileServer fileServer) {
|
public static FileMapMakingdialog showDialog(Window parent, OfflineFileServer fileServer) {
|
||||||
if (singleInstance == null || singleInstance.getOwner() != parent) {
|
// copy the reference, just in case it's deleted in a call to setVisible(false)
|
||||||
singleInstance = new FileMapMakingdialog(parent);
|
FileMapMakingdialog anInstance = singleInstance;
|
||||||
|
synchronized (synchObject) {
|
||||||
|
if (singleInstance == null || singleInstance.getOwner() != parent) {
|
||||||
|
anInstance = singleInstance = new FileMapMakingdialog(parent);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
singleInstance.offlineFileServer = fileServer;
|
anInstance.offlineFileServer = fileServer;
|
||||||
singleInstance.progress.setIndeterminate(true);
|
anInstance.progress.setIndeterminate(true);
|
||||||
singleInstance.fileName.setText(" ");
|
anInstance.fileName.setText(" ");
|
||||||
singleInstance.setVisible(true);
|
anInstance.setVisible(true);
|
||||||
return singleInstance;
|
return anInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setVisible(boolean visible) {
|
||||||
|
super.setVisible(visible);
|
||||||
|
if (visible == false) {
|
||||||
|
synchronized(synchObject) {
|
||||||
|
super.dispose();
|
||||||
|
singleInstance = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void setProgress(FileMapProgress mapProgress) {
|
public void setProgress(FileMapProgress mapProgress) {
|
||||||
switch (mapProgress.countingState) {
|
switch (mapProgress.countingState) {
|
||||||
case FileMapProgress.STATE_LOADINGMAP:
|
case FileMapProgress.STATE_LOADINGMAP:
|
||||||
|
Loading…
Reference in New Issue
Block a user