public ApplicationContext.ResourceCacheDictionary getResourceCache() { return ApplicationContext.getResourceCache(); }
public static Image loadFromCache(URL location) { if (location == null) { throw new IllegalArgumentException("location is null."); } Image image = (Image)ApplicationContext.getResourceCache().get(location); if (image == null) { try { image = Image.load(location); ApplicationContext.getResourceCache().put(location, image); } catch (TaskExecutionException exception) { throw new IllegalArgumentException(exception); } } return image; }
/** * Sets the image that will be painted over this decorator's component by * URL. * <p> * If the icon already exists in the application context resource cache, * the cached value will be used. Otherwise, the icon will be loaded * synchronously and added to the cache. * * @param imageURL * The location of the image to set. */ public void setImage(URL imageURL) { if (imageURL == null) { throw new IllegalArgumentException("imageURL is null."); } Image image = (Image)ApplicationContext.getResourceCache().get(imageURL); if (image == null) { try { image = Image.load(imageURL); } catch (TaskExecutionException exception) { throw new IllegalArgumentException(exception); } ApplicationContext.getResourceCache().put(imageURL, image); } setImage(image); }
/** * Sets the list item's icon by URL. * <p> * If the icon already exists in the application context resource cache, * the cached value will be used. Otherwise, the icon will be loaded * synchronously and added to the cache. * * @param iconURL * The location of the icon to set. */ public void setIcon(URL iconURL) { if (iconURL == null) { throw new IllegalArgumentException("iconURL is null."); } Image icon = (Image)ApplicationContext.getResourceCache().get(iconURL); if (icon == null) { try { icon = Image.load(iconURL); } catch (TaskExecutionException exception) { throw new IllegalArgumentException(exception); } ApplicationContext.getResourceCache().put(iconURL, icon); } setIcon(icon); }
/** * Sets the tree branch's expanded icon by URL. * <p> * If the icon already exists in the application context resource cache, * the cached value will be used. Otherwise, the icon will be loaded * synchronously and added to the cache. * * @param expandedIconURL * The location of the expanded icon to set. */ public void setExpandedIcon(URL expandedIconURL) { if (expandedIconURL == null) { throw new IllegalArgumentException("expandedIconURL is null."); } Image icon = (Image)ApplicationContext.getResourceCache().get(expandedIconURL); if (icon == null) { try { icon = Image.load(expandedIconURL); } catch (TaskExecutionException exception) { throw new IllegalArgumentException(exception); } ApplicationContext.getResourceCache().put(expandedIconURL, icon); } setExpandedIcon(icon); }
/** * Sets the button data's icon by URL. * <p> * If the icon already exists in the application context resource cache, * the cached value will be used. Otherwise, the icon will be loaded * synchronously and added to the cache. * * @param iconURL * The location of the icon to set. */ public void setIcon(URL iconURL) { if (iconURL == null) { throw new IllegalArgumentException("iconURL is null."); } Image icon = (Image)ApplicationContext.getResourceCache().get(iconURL); if (icon == null) { try { icon = Image.load(iconURL); } catch (TaskExecutionException exception) { throw new IllegalArgumentException(exception); } ApplicationContext.getResourceCache().put(iconURL, icon); } setIcon(icon); }
/** * Sets the tree node's icon by URL. * <p> * If the icon already exists in the application context resource cache, * the cached value will be used. Otherwise, the icon will be loaded * synchronously and added to the cache. * * @param iconURL * The location of the icon to set. */ public void setIcon(URL iconURL) { if (iconURL == null) { throw new IllegalArgumentException("iconURL is null."); } Image icon = (Image)ApplicationContext.getResourceCache().get(iconURL); if (icon == null) { try { icon = Image.load(iconURL); } catch (TaskExecutionException exception) { throw new IllegalArgumentException(exception); } ApplicationContext.getResourceCache().put(iconURL, icon); } setIcon(icon); }
/** * Sets the image node's current image by URL. * <p> * If the icon already exists in the application context resource cache, * the cached value will be used. Otherwise, the icon will be loaded * synchronously and added to the cache. * * @param imageURL * The location of the image to set. */ public void setImage(URL imageURL) { if (imageURL == null) { throw new IllegalArgumentException("imageURL is null."); } Image image = (Image)ApplicationContext.getResourceCache().get(imageURL); if (image == null) { try { image = Image.load(imageURL); } catch (TaskExecutionException exception) { throw new IllegalArgumentException(exception); } ApplicationContext.getResourceCache().put(imageURL, image); } setImage(image); }
/** * Sets the header data's icon by URL. * <p> * If the icon already exists in the application context resource cache, * the cached value will be used. Otherwise, the icon will be loaded * synchronously and added to the cache. * * @param iconURL * The location of the icon to set. */ public void setIcon(URL iconURL) { if (iconURL == null) { throw new IllegalArgumentException("iconURL is null."); } Image icon = (Image)ApplicationContext.getResourceCache().get(iconURL); if (icon == null) { try { icon = Image.load(iconURL); } catch (TaskExecutionException exception) { throw new IllegalArgumentException(exception); } ApplicationContext.getResourceCache().put(iconURL, icon); } setIcon(icon); }
/** * Sets the window's icon by URL. * <p> * If the icon already exists in the application context resource cache, * the cached value will be used. Otherwise, the icon will be loaded * synchronously and added to the cache. * * @param iconURL * The location of the icon to set. */ public void setIcon(URL iconURL) { if (iconURL == null) { throw new IllegalArgumentException("iconURL is null."); } Image icon = (Image)ApplicationContext.getResourceCache().get(iconURL); if (icon == null) { try { icon = Image.load(iconURL); } catch (TaskExecutionException exception) { throw new IllegalArgumentException(exception); } ApplicationContext.getResourceCache().put(iconURL, icon); } getIcons().remove(0, getIcons().getLength()); getIcons().add(icon); }
@Override public void taskExecuted(Task<Image> task) { Image image = task.getResult(); // Update the contents of all image views that requested this // image for (ImageView imageView : loadMap.get(imageURI)) { imageView.setImage(image); } loadMap.remove(imageURI); // Add the image to the cache ApplicationContext.getResourceCache().put(imageURL, image); }
@Override public void taskExecuted(Task<Image> task) { Image imageLoadedLocal = task.getResult(); // Update the contents of all image views that requested this // image for (ImageView imageView : loadMap.get(imageURI)) { imageView.setImage(imageLoadedLocal); } loadMap.remove(imageURI); // Add the image to the cache ApplicationContext.getResourceCache().put(imageURL, imageLoadedLocal); }
Image image = (Image)ApplicationContext.getResourceCache().get(imageURL); ApplicationContext.getResourceCache().put(imageURL, image);
Image imageLocal = (Image)ApplicationContext.getResourceCache().get(imageURL);