From 0ec8481c10cd8277d84c7c1a785483a0a739e5a0 Mon Sep 17 00:00:00 2001 From: abranson Date: Thu, 4 Aug 2011 00:42:34 +0200 Subject: 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 --- source/com/c2kernel/utils/Resource.java | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'source/com/c2kernel/utils/Resource.java') 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"; } - + } } -- cgit v1.2.3