Some small tidying.
This commit is contained in:
@@ -453,6 +453,37 @@ public abstract class Getdown extends Thread
|
|||||||
setStatus(message, -1, -1L, true);
|
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
|
* Downloads and installs an Java VM bundled with the application. This is called if we are not
|
||||||
* running with the necessary Java version.
|
* running with the necessary Java version.
|
||||||
@@ -717,7 +748,6 @@ public abstract class Getdown extends Thread
|
|||||||
}
|
}
|
||||||
|
|
||||||
EventQueue.invokeLater(new Runnable() {
|
EventQueue.invokeLater(new Runnable() {
|
||||||
|
|
||||||
public void run () {
|
public void run () {
|
||||||
if (_status == null) {
|
if (_status == null) {
|
||||||
_container = createContainer();
|
_container = createContainer();
|
||||||
@@ -735,8 +765,8 @@ public abstract class Getdown extends Thread
|
|||||||
{
|
{
|
||||||
if (_ifc.rotatingBackgrounds != null) {
|
if (_ifc.rotatingBackgrounds != null) {
|
||||||
if (_ifc.backgroundImage != null) {
|
if (_ifc.backgroundImage != null) {
|
||||||
Log.warning("ui.background_image and ui.rotating_background were "
|
Log.warning("ui.background_image and ui.rotating_background were both specified. " +
|
||||||
+ " both specified. The rotating images are being used.");
|
"The rotating images are being used.");
|
||||||
}
|
}
|
||||||
return new RotatingBackgrounds(_ifc.rotatingBackgrounds, Getdown.this);
|
return new RotatingBackgrounds(_ifc.rotatingBackgrounds, Getdown.this);
|
||||||
} else if (_ifc.backgroundImage != null) {
|
} else if (_ifc.backgroundImage != null) {
|
||||||
@@ -745,7 +775,7 @@ public abstract class Getdown extends Thread
|
|||||||
return new RotatingBackgrounds();
|
return new RotatingBackgrounds();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Image getProgressImage ()
|
protected Image getProgressImage ()
|
||||||
{
|
{
|
||||||
return loadImage(_ifc.progressImage);
|
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.
|
* 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 boolean _enableTracking = true;
|
||||||
protected int _reportedProgress = 0;
|
protected int _reportedProgress = 0;
|
||||||
|
|
||||||
/** Number of minutes to wait after startup before beginning any real heavy lifting. */
|
/** Number of minutes to wait after startup before beginning any real heavy lifting. */
|
||||||
protected int _delay;
|
protected int _delay;
|
||||||
|
|
||||||
|
|||||||
@@ -57,15 +57,15 @@ public class GetdownApplet extends JApplet
|
|||||||
if (appname == null) {
|
if (appname == null) {
|
||||||
appname = "";
|
appname = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
final RotatingBackgrounds bgimages;
|
final RotatingBackgrounds bgimages;
|
||||||
if(imgpath == null) {
|
if (imgpath == null) {
|
||||||
bgimages = new RotatingBackgrounds();
|
bgimages = new RotatingBackgrounds();
|
||||||
} else if(imgpath.contains(",")) {
|
} else if (imgpath.contains(",")) {
|
||||||
bgimages = new RotatingBackgrounds(imgpath.split(","), this);
|
bgimages = new RotatingBackgrounds(imgpath.split(","), this);
|
||||||
} else {
|
} else {
|
||||||
bgimages = new RotatingBackgrounds(loadImage(imgpath));
|
bgimages = new RotatingBackgrounds(loadImage(imgpath));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Log.info("App Base: " + appbase);
|
Log.info("App Base: " + appbase);
|
||||||
Log.info("App Name: " + appname);
|
Log.info("App Name: " + appname);
|
||||||
@@ -92,7 +92,7 @@ public class GetdownApplet extends JApplet
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
// XXX getSigners() returns all certificates used to sign this applet which may allow
|
// 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.
|
// statically included trusted keys.
|
||||||
_getdown = new Getdown(appdir, null, GetdownApplet.class.getSigners()) {
|
_getdown = new Getdown(appdir, null, GetdownApplet.class.getSigners()) {
|
||||||
protected Container createContainer () {
|
protected Container createContainer () {
|
||||||
|
|||||||
Reference in New Issue
Block a user