/** * Load image from several sources. */ public static SwingUniversalImage getUniversalImage( ClassLoader classLoader, String filename ) { if ( StringUtils.isBlank( filename ) ) { throw new RuntimeException( "Filename not provided" ); } SwingUniversalImage result = null; if ( SvgSupport.isSvgEnabled() ) { result = getUniversalImageInternal( classLoader, SvgSupport.toSvgName( filename ) ); } // if we haven't loaded SVG attempt to use PNG if ( result == null ) { result = getUniversalImageInternal( classLoader, SvgSupport.toPngName( filename ) ); } // if we can't load PNG, use default "no_image" graphic if ( result == null ) { result = getImageAsResource( NO_IMAGE ); } return result; }
/** * Load image from several sources. */ public static SwingUniversalImage getImageAsResource( String location ) { SwingUniversalImage result = null; if ( result == null && SvgSupport.isSvgEnabled() ) { result = getImageAsResourceInternal( SvgSupport.toSvgName( location ) ); } if ( result == null ) { result = getImageAsResourceInternal( SvgSupport.toPngName( location ) ); } if ( result == null && !location.equals( NO_IMAGE ) ) { result = getImageAsResource( NO_IMAGE ); } return result; }
IOUtils.closeQuietly( in ); resource = SvgSupport.toPngName( resource );
fileName = SvgSupport.toPngName( fileName );
fileName = SvgSupport.toPngName( fileName );
filename = SvgSupport.toPngName( filename );
/** * Load image from several sources. */ public static SwtUniversalImage getImageAsResource( Display display, String location ) { SwtUniversalImage result = null; if ( result == null && SvgSupport.isSvgEnabled() ) { result = getImageAsResourceInternal( display, SvgSupport.toSvgName( location ) ); } if ( result == null ) { result = getImageAsResourceInternal( display, SvgSupport.toPngName( location ) ); } if ( result == null && !location.equals( NO_IMAGE ) ) { log.logError( "Unable to load image [" + location + "]" ); result = getImageAsResource( display, NO_IMAGE ); } if ( result == null ) { log.logError( "Unable to load image [" + location + "]" ); result = getMissingImage( display ); } return result; }
/** * Load image from several sources. */ public static SwtUniversalImage getUniversalImage( Display display, ClassLoader classLoader, String filename ) { if ( StringUtils.isBlank( filename ) ) { log.logError( "Unable to load image [" + filename + "]" ); return getImageAsResource( display, NO_IMAGE ); } SwtUniversalImage result = null; if ( SvgSupport.isSvgEnabled() ) { result = getUniversalImageInternal( display, classLoader, SvgSupport.toSvgName( filename ) ); } // if we haven't loaded SVG attempt to use PNG if ( result == null ) { result = getUniversalImageInternal( display, classLoader, SvgSupport.toPngName( filename ) ); } // if we can't load PNG, use default "no_image" graphic if ( result == null ) { log.logError( "Unable to load image [" + filename + "]" ); result = getImageAsResource( display, NO_IMAGE ); } return result; }
IOUtils.closeQuietly( in ); resource = SvgSupport.toPngName( resource );