Some small tidying.

This commit is contained in:
Michael Bayne
2007-10-22 06:39:26 +00:00
parent a22d5c3707
commit 3b18e77805
2 changed files with 39 additions and 41 deletions
@@ -453,6 +453,37 @@ public abstract class Getdown extends Thread
setStatus(message, -1, -1L, true);
}
/**
* Load the image at the path. Before trying the exact path/file specified we will look to see
* if we can find a localized version by sticking a _<language> in front of the "." in the
* filename.
*/
public BufferedImage loadImage (String path)
{
if (StringUtil.isBlank(path)) {
return null;
}
File imgpath = null;
try {
// First try for a localized image.
String localeStr = Locale.getDefault().getLanguage();
imgpath = _app.getLocalPath(StringUtil.replace(path, ".", "_" + localeStr + "."));
return ImageIO.read(imgpath);
} catch (IOException ioe) {
// No biggie, we'll try the generic one.
}
// If that didn't work, try a generic one.
try {
imgpath = _app.getLocalPath(path);
return ImageIO.read(imgpath);
} catch (IOException ioe2) {
Log.warning("Failed to load image [path=" + imgpath + ", error=" + ioe2 + "].");
return null;
}
}
/**
* Downloads and installs an Java VM bundled with the application. This is called if we are not
* running with the necessary Java version.
@@ -717,7 +748,6 @@ public abstract class Getdown extends Thread
}
EventQueue.invokeLater(new Runnable() {
public void run () {
if (_status == null) {
_container = createContainer();
@@ -735,8 +765,8 @@ public abstract class Getdown extends Thread
{
if (_ifc.rotatingBackgrounds != null) {
if (_ifc.backgroundImage != null) {
Log.warning("ui.background_image and ui.rotating_background were "
+ " both specified. The rotating images are being used.");
Log.warning("ui.background_image and ui.rotating_background were both specified. " +
"The rotating images are being used.");
}
return new RotatingBackgrounds(_ifc.rotatingBackgrounds, Getdown.this);
} else if (_ifc.backgroundImage != null) {
@@ -745,7 +775,7 @@ public abstract class Getdown extends Thread
return new RotatingBackgrounds();
}
}
protected Image getProgressImage ()
{
return loadImage(_ifc.progressImage);
@@ -812,38 +842,6 @@ public abstract class Getdown extends Thread
}
}
/**
* Load the image at the path. Before trying the exact path/file specified
* we will look to see if we can find a localized version by sticking a
* _<language> in front of the "." in the filename.
*/
public BufferedImage loadImage (String path)
{
String localeStr = Locale.getDefault().getLanguage();
if (StringUtil.isBlank(path)) {
return null;
}
File imgpath = null;
try {
// First try for a localized image.
imgpath = _app.getLocalPath(StringUtil.replace(path, ".", "_" + localeStr + "."));
return ImageIO.read(imgpath);
} catch (IOException ioe) {
// No biggie, we'll try the generic one.
}
// If that didn't work, try a generic one.
try {
imgpath = _app.getLocalPath(path);
return ImageIO.read(imgpath);
} catch (IOException ioe2) {
Log.warning("Failed to load image [path=" + imgpath + ", error=" + ioe2 + "].");
return null;
}
}
/**
* Creates the container in which our user interface will be displayed.
*/
@@ -946,7 +944,7 @@ public abstract class Getdown extends Thread
protected boolean _enableTracking = true;
protected int _reportedProgress = 0;
/** Number of minutes to wait after startup before beginning any real heavy lifting. */
protected int _delay;
@@ -57,15 +57,15 @@ public class GetdownApplet extends JApplet
if (appname == null) {
appname = "";
}
final RotatingBackgrounds bgimages;
if(imgpath == null) {
if (imgpath == null) {
bgimages = new RotatingBackgrounds();
} else if(imgpath.contains(",")) {
} else if (imgpath.contains(",")) {
bgimages = new RotatingBackgrounds(imgpath.split(","), this);
} else {
bgimages = new RotatingBackgrounds(loadImage(imgpath));
}
Log.info("App Base: " + appbase);
Log.info("App Name: " + appname);
@@ -92,7 +92,7 @@ public class GetdownApplet extends JApplet
try {
// XXX getSigners() returns all certificates used to sign this applet which may allow
// a third party to insert a trusted certificate. This should be replaced with
// a third party to insert a trusted certificate. This should be replaced with
// statically included trusted keys.
_getdown = new Getdown(appdir, null, GetdownApplet.class.getSigners()) {
protected Container createContainer () {