X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=forester%2Fjava%2Fsrc%2Forg%2Fforester%2Farchaeopteryx%2Ftools%2FImageLoader.java;h=b431697c675ba0096eaf8407ffcb427c8a920025;hb=9351f2c2e8af0c3bf1280f9696f1459db2819005;hp=777dacf7c9533fe7cda2592dd514baff68b26e01;hpb=5958d8c92c06f76da04a466ef7636e93a640b6a3;p=jalview.git diff --git a/forester/java/src/org/forester/archaeopteryx/tools/ImageLoader.java b/forester/java/src/org/forester/archaeopteryx/tools/ImageLoader.java index 777dacf..b431697 100644 --- a/forester/java/src/org/forester/archaeopteryx/tools/ImageLoader.java +++ b/forester/java/src/org/forester/archaeopteryx/tools/ImageLoader.java @@ -21,10 +21,11 @@ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA // // Contact: phylosoft @ gmail . com -// WWW: www.phylosoft.org/forester +// WWW: https://sites.google.com/site/cmzmasek/home/software/forester package org.forester.archaeopteryx.tools; +import java.awt.color.CMMException; import java.awt.image.BufferedImage; import java.io.IOException; import java.net.MalformedURLException; @@ -46,11 +47,17 @@ public class ImageLoader implements Runnable { private final TreePanel _tp; private static final BufferedImage PLACEHOLDER = new BufferedImage( 1, 1, BufferedImage.TYPE_INT_RGB ); + private final static boolean DEBUG = false; public ImageLoader( final TreePanel tp ) { _tp = tp; } + @Override + public void run() { + load(); + } + private void load() { Hashtable image_map = null; if ( _tp.getImageMap() != null ) { @@ -82,19 +89,27 @@ public class ImageLoader implements Runnable { || uri_str.endsWith( ".gif" ) || uri_str.endsWith( ".bmp" ) ) ) { image_map.put( uri_str, PLACEHOLDER ); BufferedImage bi = null; - if ( !Constants.__RELEASE && !Constants.__SNAPSHOT_RELEASE ) { - System.out.println( "accessing:" + uri ); + if ( DEBUG ) { + System.out.println( "accessing: " + uri ); } try { bi = ImageIO.read( uri.getValue().toURL() ); } catch ( final MalformedURLException e ) { - AptxUtil.printWarningMessage( Constants.PRG_NAME, "\"" + uri.getValue() - + "\": Malformed URL Exception: " + e.getLocalizedMessage() ); + AptxUtil.printWarningMessage( Constants.PRG_NAME, + "could not load image from \"" + uri.getValue() + + "\": Malformed URL Exception: " + + e.getLocalizedMessage() ); } catch ( final IOException e ) { - AptxUtil.printWarningMessage( Constants.PRG_NAME, "\"" + uri.getValue() - + "\": IO Exception: " + e.getLocalizedMessage() ); + AptxUtil.printWarningMessage( Constants.PRG_NAME, + "could not load image from \"" + uri.getValue() + + "\": IO Exception: " + e.getLocalizedMessage() ); + } + catch ( final CMMException e ) { + AptxUtil.printWarningMessage( Constants.PRG_NAME, + "could not load image from \"" + uri.getValue() + + "\": CMMException: " + e.getLocalizedMessage() ); } if ( bi != null ) { image_map.put( uri_str, bi ); @@ -109,9 +124,4 @@ public class ImageLoader implements Runnable { } } } - - @Override - public void run() { - load(); - } }