protected Image getImage() { return SwtSvgImageUtil .getImage( shell.getDisplay(), getClass().getClassLoader(), "JOB.svg", ConstUI.LARGE_ICON_SIZE, ConstUI.LARGE_ICON_SIZE ); }
/** * Load image from several sources. */ public static SwtUniversalImage getImage( Display display, String location ) { return getImageAsResource( display, location ); }
private static SwtUniversalImage getUniversalImageInternal( Display display, ClassLoader classLoader, String filename ) { SwtUniversalImage result = loadFromClassLoader( display, classLoader, filename ); if ( result == null ) { result = loadFromClassLoader( display, classLoader, "/" + filename ); if ( result == null ) { result = loadFromClassLoader( display, classLoader, "ui/images/" + filename ); if ( result == null ) { result = getImageAsResourceInternal( display, filename ); } } } return result; }
try { ClassLoader classLoader = registry.getClassLoader( plugin ); image = SwtSvgImageUtil.getUniversalImage( display, classLoader, filename ); } catch ( Throwable t ) { log.logError( "Error occurred loading image [" + filename + "] for plugin " + plugin.getIds()[ 0 ], t ); if ( image == null ) { log.logError( "Unable to load image [" + filename + "] for plugin " + plugin.getIds()[ 0 ] ); image = SwtSvgImageUtil.getMissingImage( display );
/** * Get an image using the provided classLoader and path. An attempt will be made to load the image with the * classLoader first using SVG (regardless of extension), and falling back to PNG. If the image cannot be * loaded with the provided classLoader, the search path will be expanded to include the file system (ui/images). * * @param display the device to render the image to * @param classLoader the classLoader to use to load the image resource * @param filename the path to the image * @param width the width to scale the image to * @param height the height to scale the image to * @return an swt Image with width/height dimensions */ public static Image getImage( Display display, ClassLoader classLoader, String filename, int width, int height ) { SwtUniversalImage u = getUniversalImage( display, classLoader, filename ); return u.getAsBitmapForSize( display, width, height ); }
/** * 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; }
imageHop = SwtSvgImageUtil.getImageAsResource( display, BasePropertyHandler.getProperty( "HOP_image" ) ); SwtSvgImageUtil.getImageAsResource( display, BasePropertyHandler.getProperty( "Disabled_HOP_image" ) ); imageConnection = SwtSvgImageUtil.getImageAsResource( display, BasePropertyHandler.getProperty( "CNC_image" ) ); SwtSvgImageUtil.getImageAsResource( display, BasePropertyHandler.getProperty( "CNC_tree_image" ) ); imagePreview = SwtSvgImageUtil.getImageAsResource( display, BasePropertyHandler.getProperty( "Preview_image" ) ); imageCluster = SwtSvgImageUtil.getImageAsResource( display, BasePropertyHandler.getProperty( "Cluster_image" ) ); imageSlave = SwtSvgImageUtil.getImageAsResource( display, BasePropertyHandler.getProperty( "Slave_image" ) ); imageSlaveTree = SwtSvgImageUtil.getImageAsResource( display, BasePropertyHandler.getProperty( "Slave_tree_image" ) ); SwtSvgImageUtil.getUniversalImage( display, getClass().getClassLoader(), BasePropertyHandler .getProperty( "BOL_image" ) ); SwtSvgImageUtil.getUniversalImage( display, getClass().getClassLoader(), BasePropertyHandler .getProperty( "STR_image" ) ); SwtSvgImageUtil.getUniversalImage( display, getClass().getClassLoader(), BasePropertyHandler .getProperty( "DUM_image" ) ); SwtSvgImageUtil.getUniversalImage( display, getClass().getClassLoader(), BasePropertyHandler .getProperty( "MIS_image" ) ); imageVariable = SwtSvgImageUtil.getImageAsResource( display, BasePropertyHandler.getProperty( "Variable_image" ) );
/** * 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; }
try { ClassLoader classLoader = registry.getClassLoader( step ); image = SwtSvgImageUtil.getUniversalImage( display, classLoader, filename ); } catch ( Throwable t ) { log.logError( "Error occurred loading image [" + filename + "] for plugin " + step, t ); if ( image == null ) { log.logError( "Unable to load image file [" + filename + "] for plugin " + step ); image = SwtSvgImageUtil.getMissingImage( display );
/** * Loads an image from a location once. The second time, the image comes from a cache. Because of this, it's important * to never dispose of the image you get from here. (easy!) The images are automatically disposed when the application * ends. * * @param location the location of the image resource to load * @param classLoader the ClassLoader to use to locate resources * @param width The height to resize the image to * @param height The width to resize the image to * @return the loaded image */ public Image getImage( String location, ClassLoader classLoader, int width, int height ) { Image image = imageMap.get( location ); if ( image == null ) { SwtUniversalImage svg = SwtSvgImageUtil.getUniversalImage( display, classLoader, location ); image = new Image( display, svg.getAsBitmapForSize( display, width, height ), SWT.IMAGE_COPY ); svg.dispose(); imageMap.put( location, image ); } return image; }
protected Image getImage() { return SwtSvgImageUtil .getImage( shell.getDisplay(), getClass().getClassLoader(), "MAP.svg", ConstUI.ICON_SIZE, ConstUI.ICON_SIZE ); }
private Image getHadoopClusterImage( Display display ) { final SwtUniversalImage swtImage = SwtSvgImageUtil.getUniversalImage( display, getClass().getClassLoader(), "hadoop_clusters.svg" ); Image image = swtImage.getAsBitmapForSize( display, ConstUI.MEDIUM_ICON_SIZE, ConstUI.MEDIUM_ICON_SIZE ); display.addListener( SWT.Dispose, new Listener() { public void handleEvent( Event event ) { swtImage.dispose(); } } ); return image; } }
private Image loadAsResource( Display display, String location ) { SwtUniversalImage img = SwtSvgImageUtil.getImageAsResource( display, location ); Image image = new Image( display, img.getAsBitmap( display ), SWT.IMAGE_COPY ); img.dispose(); return image; }
protected Image getImage() { return SwtSvgImageUtil .getImage( shell.getDisplay(), getClass().getClassLoader(), "TRN.svg", ConstUI.LARGE_ICON_SIZE, ConstUI.LARGE_ICON_SIZE ); }
private Image getHadoopClusterImage( Display display ) { final SwtUniversalImage swtImage = SwtSvgImageUtil.getUniversalImage( display, getClass().getClassLoader(), "hadoop_clusters.svg" ); Image image = swtImage.getAsBitmapForSize( display, ConstUI.MEDIUM_ICON_SIZE, ConstUI.MEDIUM_ICON_SIZE ); display.addListener( SWT.Dispose, event -> swtImage.dispose() ); return image; } }
private Image loadAsResource( Display display, String location, int size ) { SwtUniversalImage img = SwtSvgImageUtil.getImageAsResource( display, location ); Image image; if ( size > 0 ) { image = new Image( display, img.getAsBitmapForSize( display, size, size ), SWT.IMAGE_COPY ); } else { image = new Image( display, img.getAsBitmap( display ), SWT.IMAGE_COPY ); } img.dispose(); return image; }
protected Image getImage() { return SwtSvgImageUtil .getImage( shell.getDisplay(), getClass().getClassLoader(), "JOBEx.svg", ConstUI.LARGE_ICON_SIZE, ConstUI.LARGE_ICON_SIZE ); }
private Image getImage() { return SwtSvgImageUtil .getImage( shell.getDisplay(), getClass().getClassLoader(), "GenericTransform.svg", ConstUI.LARGE_ICON_SIZE, ConstUI.LARGE_ICON_SIZE ); }
private Image getImage() { return SwtSvgImageUtil .getImage( shell.getDisplay(), getClass().getClassLoader(), "images/run_tree.svg", ConstUI.ICON_SIZE, ConstUI.ICON_SIZE ); }
protected Image getImage() { return SwtSvgImageUtil .getImage( shell.getDisplay(), getClass().getClassLoader(), "TRNEx.svg", ConstUI.LARGE_ICON_SIZE, ConstUI.LARGE_ICON_SIZE ); }