summaryrefslogtreecommitdiff
path: root/source/com/c2kernel/utils/Resource.java
diff options
context:
space:
mode:
authorabranson <andrew.branson@cern.ch>2011-08-04 00:42:34 +0200
committerabranson <andrew.branson@cern.ch>2011-08-04 00:42:34 +0200
commit0ec8481c10cd8277d84c7c1a785483a0a739e5a0 (patch)
tree5f6e5d9ae75193e67e6f3b3dfa488960c5cde1d5 /source/com/c2kernel/utils/Resource.java
parent036cbdba66f804743c4c838ed598d6972c4b3e17 (diff)
More code cleanup:
Refactored Entity Proxy Subscription to handle generics better Rewrote RemoteMap to use TreeMap instead of the internal array for order. It now sorts its keys by number if they parse, else as strings. Removed a no-longer-in-progress outcome form class
Diffstat (limited to 'source/com/c2kernel/utils/Resource.java')
-rw-r--r--source/com/c2kernel/utils/Resource.java24
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";
}
-
+
}
}