Updated splash frame close functionality to also cancel preloading and gui creation process if user has closed splash frame.

This commit is contained in:
Doublestrike
2011-08-30 15:50:10 +00:00
parent a9da41acb3
commit 3dd01f4b0d
2 changed files with 49 additions and 22 deletions

View File

@@ -117,7 +117,14 @@ public class ApplicationView implements FView {
} }
}); });
// For the following two blocks, check if user has cancelled SplashFrame.
// Note: Error thrown sometimes because log file cannot be accessed
if(!splashFrame.getSplashHasBeenClosed()) {
AllZone.getCardFactory(); // forces preloading of all cards AllZone.getCardFactory(); // forces preloading of all cards
}
if(!splashFrame.getSplashHasBeenClosed()) {
System.out.println("splashFrame still running");
try { try {
Constant.Runtime.GameType[0] = Constant.GameType.Constructed; Constant.Runtime.GameType[0] = Constant.GameType.Constructed;
SwingUtilities.invokeLater(new Runnable() { // NOPMD by Braids on 8/7/11 1:07 PM: this isn't a web app SwingUtilities.invokeLater(new Runnable() { // NOPMD by Braids on 8/7/11 1:07 PM: this isn't a web app
@@ -138,6 +145,7 @@ public class ApplicationView implements FView {
} catch (Exception ex) { } catch (Exception ex) {
ErrorViewer.showError(ex); ErrorViewer.showError(ex);
} }
} // End if(splashHasBeenClosed)
} } // End ApplicationView()
} }

View File

@@ -43,6 +43,8 @@ public class SplashFrame extends JFrame {
private SplashProgressModel monitorModel = null; private SplashProgressModel monitorModel = null;
private SplashProgressComponent monitorView = null; private SplashProgressComponent monitorView = null;
private boolean SplashHasBeenClosed = false;
/** /**
* <p>Create the frame; this <strong>must</strong> be called from an event * <p>Create the frame; this <strong>must</strong> be called from an event
* dispatch thread.</p> * dispatch thread.</p>
@@ -102,6 +104,7 @@ public class SplashFrame extends JFrame {
@Override @Override
public void actionPerformed(ActionEvent ae) public void actionPerformed(ActionEvent ae)
{ {
setSplashHasBeenClosed(true);
dispose(); dispose();
} }
}); });
@@ -155,10 +158,26 @@ public class SplashFrame extends JFrame {
/** /**
* Getter for progress monitor model. * Getter for progress monitor model.
* @return the BaseProgressMonitor model used in the splash frame. * @return the BraidsProgressMonitor model used in the splash frame.
*/ */
public final BraidsProgressMonitor getMonitorModel() { public final BraidsProgressMonitor getMonitorModel() {
return monitorModel; return monitorModel;
} }
/**
* Returns state of splash frame, to determine if GUI should continue loading.
* @return SplashHasBeenClosed boolean.
*/
public final boolean getSplashHasBeenClosed() {
return SplashHasBeenClosed;
}
/**
* Sets state of splash frame, to determine if GUI should continue loading.
* @param SplashHasBeenClosed boolean.
*/
public final void setSplashHasBeenClosed(boolean neoState) {
SplashHasBeenClosed = neoState;
}
} }