summaryrefslogtreecommitdiff
path: root/src/main/java/com/c2kernel/utils/Resource.java
diff options
context:
space:
mode:
authorAndrew Branson <andrew.branson@cern.ch>2012-06-29 16:20:11 +0200
committerAndrew Branson <andrew.branson@cern.ch>2012-06-29 16:20:11 +0200
commit11eb9557a35e17450c0aefb758471f1ff3148336 (patch)
tree10251f415012336189dd8a7f4385434ad807d7ad /src/main/java/com/c2kernel/utils/Resource.java
parentbc4d8f9fca275eceee86e38c52975461ca504d07 (diff)
Pull remaining graph GUI components into cristal-gui
Diffstat (limited to 'src/main/java/com/c2kernel/utils/Resource.java')
-rw-r--r--src/main/java/com/c2kernel/utils/Resource.java53
1 files changed, 0 insertions, 53 deletions
diff --git a/src/main/java/com/c2kernel/utils/Resource.java b/src/main/java/com/c2kernel/utils/Resource.java
index 10228da..3065f6a 100644
--- a/src/main/java/com/c2kernel/utils/Resource.java
+++ b/src/main/java/com/c2kernel/utils/Resource.java
@@ -6,8 +6,6 @@ import java.net.URL;
import java.util.HashMap;
import java.util.Hashtable;
-import javax.swing.ImageIcon;
-
import com.c2kernel.common.ObjectNotFoundException;
/**************************************************************************
@@ -17,10 +15,8 @@ import com.c2kernel.common.ObjectNotFoundException;
**************************************************************************/
public class Resource {
static private Hashtable<String, String> txtCache = new Hashtable<String, String>();
- static private Hashtable<String, ImageIcon> imgCache = new Hashtable<String, ImageIcon>();
static private URL baseURL = getURLorResURL("com/c2kernel/utils/resources/");
static private HashMap<String, URL> moduleBaseURLs = new HashMap<String, URL>();
- static public final ImageIcon nullImg = new ImageIcon(new byte[] { 0 });
public static URL getKernelBaseURL() {
return baseURL;
@@ -105,55 +101,6 @@ public class Resource {
throw new ObjectNotFoundException(e.getMessage(),null);
}
}
- /**
- * Gets an image from the resource directories
- *
- * @param resName - filename after resources/images
- * @return
- */
- static public ImageIcon findImage(String resName) {
- try {
- for (String ns : getModuleBaseURLs().keySet()) {
- try {
- return getImage(ns, resName);
- } catch (ObjectNotFoundException ex) { }
- }
- return getImage(null, resName);
- } catch (ObjectNotFoundException ex) {
- Logger.warning("Image '"+resName+"' not found. Using null icon");
- return nullImg;
- }
- }
-
- static public ImageIcon getImage(String ns, String resName) throws ObjectNotFoundException {
- if (resName == null)
- return nullImg;
-
- if (imgCache.containsKey(ns+'/'+resName)) {
- return imgCache.get(ns+'/'+resName);
- }
-
- URL imgLocation = null;
- if (ns == null)
- try {
- imgLocation = getKernelResourceURL("images/"+resName);
- } catch (MalformedURLException ex) { }
- else
- try {
- imgLocation = getModuleResourceURL(ns, "images/"+resName);
- } catch (MalformedURLException ex) { }
-
- if (imgLocation!= null) {
- ImageIcon newImg = new ImageIcon(imgLocation);
-
- if (newImg.getIconHeight() > -1) {
- imgCache.put(ns+'/'+resName, newImg);
- Logger.msg(0, "Loaded "+resName+" "+newImg.getIconWidth()+"x"+newImg.getIconHeight());
- return newImg;
- }
- }
- throw new ObjectNotFoundException();
- }
static public String getKernelVersion() {
try {