diff options
Diffstat (limited to 'source/com/c2kernel/utils/Resource.java')
| -rw-r--r-- | source/com/c2kernel/utils/Resource.java | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/source/com/c2kernel/utils/Resource.java b/source/com/c2kernel/utils/Resource.java index 33100d8..361549d 100644 --- a/source/com/c2kernel/utils/Resource.java +++ b/source/com/c2kernel/utils/Resource.java @@ -62,7 +62,7 @@ public class Resource { static public URL getDomainResourceURL(String resName) throws MalformedURLException {
return new URL(domainBaseURL, resName);
}
-
+
private static URL getURLorResURL(String newURL) {
URL result;
try {
@@ -83,16 +83,16 @@ public class Resource { Logger.msg(8, "Resource::getTextResource() - Getting resource: " + resName);
if (txtCache.containsKey(resName)) {
- return (String)txtCache.get(resName);
+ return txtCache.get(resName);
}
try {
-
+
String newRes = null;
try {
newRes = FileStringUtility.url2String(getDomainResourceURL(resName));
} catch (Exception ex) { } // no domain base
-
+
if (newRes == null || newRes.length() == 0) { // not found in domain
newRes = FileStringUtility.url2String(getKernelResourceURL(resName));
}
@@ -104,7 +104,7 @@ public class Resource { }
/**
* Gets an image from the resource directories
- *
+ *
* @param resName - filename after resources/images
* @return
*/
@@ -116,13 +116,13 @@ public class Resource { return nullImg;
}
}
-
+
static public ImageIcon getImage(String resName) throws ObjectNotFoundException {
if (resName == null)
return nullImg;
if (imgCache.containsKey(resName)) {
- return (ImageIcon)imgCache.get(resName);
+ return imgCache.get(resName);
}
URL imgLocation = null;
@@ -134,7 +134,7 @@ public class Resource { newImg = new ImageIcon(imgLocation);
} catch (MalformedURLException e) { }
}
-
+
// try kernel resources next
if (newImg == null || newImg.getIconHeight() == -1) {
try {
@@ -142,12 +142,12 @@ public class Resource { newImg = new ImageIcon(imgLocation);
} catch (MalformedURLException e) { }
}
-
+
// else return null image
if (newImg == null || newImg.getIconHeight() == -1) {
throw new ObjectNotFoundException();
}
-
+
else imgCache.put(resName, newImg);
Logger.msg(7, "Loaded "+resName+" "+newImg.getIconWidth()+"x"+newImg.getIconHeight());
return newImg;
@@ -175,13 +175,13 @@ public class Resource { return "Domain application version not found";
}
}
-
+
static public String getKernelVersion() {
try {
return FileStringUtility.url2String(getKernelResourceURL("textFiles/version.txt"));
} catch (Exception ex) {
return "No version info found";
}
-
+
}
}
|
