mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 03:08:02 +00:00
Improved functionality of "Load Layout" dock button.
This commit is contained in:
@@ -93,10 +93,16 @@ public enum CDock implements ICDoc {
|
||||
@Override
|
||||
public Void doInBackground() {
|
||||
SaveOpenDialog dlgOpen = new SaveOpenDialog();
|
||||
File LoadFile = new File(SIOUtil.FILE_PREFERRED);
|
||||
LoadFile = dlgOpen.OpenDialog(LoadFile, null);
|
||||
File DefFile = new File(SIOUtil.FILE_PREFERRED);
|
||||
File LoadFile = dlgOpen.OpenDialog(DefFile, Filetypes.LAYOUT);
|
||||
|
||||
SIOUtil.loadLayout(LoadFile);
|
||||
if (LoadFile!=null) {
|
||||
SIOUtil.loadLayout(LoadFile);
|
||||
}
|
||||
else {
|
||||
SIOUtil.loadLayout(DefFile);
|
||||
}
|
||||
SIOUtil.saveLayout();
|
||||
SOverlayUtils.hideOverlay();
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -53,13 +53,18 @@ public class SaveOpenDialog extends JPanel {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* constructor for a save or open dialog
|
||||
*/
|
||||
public SaveOpenDialog() {
|
||||
fc = new JFileChooser();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Shows the open dialog for files. If no file selected, returns default. Pass null
|
||||
* to Type and Extension to allow all files to be viewed/opened.
|
||||
* Shows the open dialog for files. If no file selected, returns null. Pass null
|
||||
* to Type to allow all files to be viewed/opened.
|
||||
* @param defFileName pass the default file to use, also determines directory
|
||||
* @param type label to tell what type of file to filter
|
||||
*
|
||||
@@ -79,8 +84,9 @@ public class SaveOpenDialog extends JPanel {
|
||||
int RetValue = fc.showOpenDialog(getParent());
|
||||
if (RetValue == JFileChooser.APPROVE_OPTION) {
|
||||
RetFile = fc.getSelectedFile();
|
||||
return RetFile;
|
||||
}
|
||||
return RetFile;
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user