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