Some renaming and clarification.

This commit is contained in:
Michael Bayne
2016-05-15 11:56:27 -07:00
parent 04309d3bdb
commit 949eb8d718
2 changed files with 22 additions and 22 deletions
@@ -1241,9 +1241,8 @@ public class Application
* validated" resources filled in. * validated" resources filled in.
* @param unpacked a set to populate with unpacked resources. * @param unpacked a set to populate with unpacked resources.
*/ */
public List<Resource> verifyResources ( public List<Resource> verifyResources (ProgressObserver obs, int[] alreadyValid,
ProgressObserver obs, int[] alreadyValid, Set<Resource> unpacked) Set<Resource> unpacked) throws InterruptedException
throws InterruptedException
{ {
List<Resource> rsrcs = getAllActiveResources(); List<Resource> rsrcs = getAllActiveResources();
List<Resource> failures = new ArrayList<Resource>(); List<Resource> failures = new ArrayList<Resource>();
@@ -133,10 +133,10 @@ public abstract class Getdown extends Thread
{ {
try { try {
_ifc = _app.init(true); _ifc = _app.init(true);
createInterface(true); createInterfaceAsync(true);
} catch (Exception e) { } catch (Exception e) {
log.warning("Failed to preinit: " + e); log.warning("Failed to preinit: " + e);
createInterface(true); createInterfaceAsync(true);
} }
} }
@@ -373,7 +373,7 @@ public abstract class Getdown extends Thread
// and re-initalize // and re-initalize
_ifc = _app.init(true); _ifc = _app.init(true);
// now force our UI to be recreated with the updated info // now force our UI to be recreated with the updated info
createInterface(true); createInterfaceAsync(true);
} }
if (!_app.lockForUpdates()) { if (!_app.lockForUpdates()) {
throw new MultipleGetdownRunning(); throw new MultipleGetdownRunning();
@@ -429,7 +429,7 @@ public abstract class Getdown extends Thread
// make sure we have the desired version and that the metadata files are valid... // make sure we have the desired version and that the metadata files are valid...
setStep(Step.VERIFY_METADATA); setStep(Step.VERIFY_METADATA);
setStatus("m.validating", -1, -1L, false); setStatusAsync("m.validating", -1, -1L, false);
if (_app.verifyMetadata(this)) { if (_app.verifyMetadata(this)) {
log.info("Application requires update."); log.info("Application requires update.");
update(); update();
@@ -439,7 +439,7 @@ public abstract class Getdown extends Thread
// now verify our resources... // now verify our resources...
setStep(Step.VERIFY_RESOURCES); setStep(Step.VERIFY_RESOURCES);
setStatus("m.validating", -1, -1L, false); setStatusAsync("m.validating", -1, -1L, false);
List<Resource> failures = _app.verifyResources(_progobs, alreadyValid, unpacked); List<Resource> failures = _app.verifyResources(_progobs, alreadyValid, unpacked);
if (failures == null) { if (failures == null) {
log.info("Resources verified."); log.info("Resources verified.");
@@ -533,7 +533,7 @@ public abstract class Getdown extends Thread
// documentation inherited from interface // documentation inherited from interface
public void updateStatus (String message) public void updateStatus (String message)
{ {
setStatus(message, -1, -1L, true); setStatusAsync(message, -1, -1L, true);
} }
/** /**
@@ -649,7 +649,7 @@ public abstract class Getdown extends Thread
// show the patch notes button, if applicable // show the patch notes button, if applicable
if (!StringUtil.isBlank(_ifc.patchNotesUrl)) { if (!StringUtil.isBlank(_ifc.patchNotesUrl)) {
createInterface(false); createInterfaceAsync(false);
EventQueue.invokeLater(new Runnable() { EventQueue.invokeLater(new Runnable() {
public void run () { public void run () {
_patchNotes.setVisible(true); _patchNotes.setVisible(true);
@@ -701,7 +701,7 @@ public abstract class Getdown extends Thread
throws IOException, InterruptedException throws IOException, InterruptedException
{ {
// create our user interface // create our user interface
createInterface(false); createInterfaceAsync(false);
// create a downloader to download our resources // create a downloader to download our resources
Downloader.Observer obs = new Downloader.Observer() { Downloader.Observer obs = new Downloader.Observer() {
@@ -726,7 +726,7 @@ public abstract class Getdown extends Thread
// to check if this was the reason for aborting. // to check if this was the reason for aborting.
return false; return false;
} }
setStatus("m.downloading", stepToGlobalPercent(percent), remaining, true); setStatusAsync("m.downloading", stepToGlobalPercent(percent), remaining, true);
if (percent > 0) { if (percent > 0) {
reportTrackingEvent("progress", percent); reportTrackingEvent("progress", percent);
} }
@@ -759,7 +759,7 @@ public abstract class Getdown extends Thread
protected void launch () protected void launch ()
{ {
setStep(Step.LAUNCH); setStep(Step.LAUNCH);
setStatus("m.launching", stepToGlobalPercent(100), -1L, false); setStatusAsync("m.launching", stepToGlobalPercent(100), -1L, false);
try { try {
if (invokeDirect()) { if (invokeDirect()) {
@@ -834,8 +834,9 @@ public abstract class Getdown extends Thread
} }
// pump the percent up to 100% // pump the percent up to 100%
setStatus(null, 100, -1L, false); setStatusAsync(null, 100, -1L, false);
exit(0); exit(0);
if (_playAgain != null && _playAgain.isEnabled()) { if (_playAgain != null && _playAgain.isEnabled()) {
// wait a little time before showing the button // wait a little time before showing the button
Timer timer = new Timer("playAgain", true); Timer timer = new Timer("playAgain", true);
@@ -854,11 +855,11 @@ public abstract class Getdown extends Thread
/** /**
* Creates our user interface, which we avoid doing unless we actually have to update * Creates our user interface, which we avoid doing unless we actually have to update
* something. * something. NOTE: this happens on the next UI tick, not immediately.
* *
* @param reinit - if the interface should be reinitialized if it already exists. * @param reinit - if the interface should be reinitialized if it already exists.
*/ */
protected void createInterface (final boolean reinit) protected void createInterfaceAsync (final boolean reinit)
{ {
if (_silent || (_container != null && !reinit)) { if (_silent || (_container != null && !reinit)) {
return; return;
@@ -1003,7 +1004,7 @@ public abstract class Getdown extends Thread
protected void fail (String message) protected void fail (String message)
{ {
_dead = true; _dead = true;
setStatus(message, stepToGlobalPercent(0), -1L, true); setStatusAsync(message, stepToGlobalPercent(0), -1L, true);
} }
/** /**
@@ -1040,13 +1041,13 @@ public abstract class Getdown extends Thread
} }
/** /**
* Update the status. * Updates the status. NOTE: this happens on the next UI tick, not immediately.
*/ */
protected void setStatus ( protected void setStatusAsync (final String message, final int percent, final long remaining,
final String message, final int percent, final long remaining, boolean createUI) boolean createUI)
{ {
if (_status == null && createUI) { if (_status == null && createUI) {
createInterface(false); createInterfaceAsync(false);
} }
EventQueue.invokeLater(new Runnable() { EventQueue.invokeLater(new Runnable() {
@@ -1198,7 +1199,7 @@ public abstract class Getdown extends Thread
/** Used to pass progress on to our user interface. */ /** Used to pass progress on to our user interface. */
protected ProgressObserver _progobs = new ProgressObserver() { protected ProgressObserver _progobs = new ProgressObserver() {
public void progress (int percent) { public void progress (int percent) {
setStatus(null, stepToGlobalPercent(percent), -1L, false); setStatusAsync(null, stepToGlobalPercent(percent), -1L, false);
} }
}; };