/** * Get the image to include in the label for the given VisualItem. * @param item the item to get an image for * @return the image for the item, or null for no image */ protected Image getImage(VisualItem item) { String imageLoc = getImageLocation(item); return ( imageLoc == null ? null : m_images.getImage(imageLoc) ); }
/** * <p>Pre-loads images for use in a visualization. Images to load are * determined by taking objects from the given iterator and retrieving * the value of the specified field. The items in the iterator must * be instances of the {@link prefuse.data.Tuple} class.</p> * * <p>Images are loaded in the order specified by the iterator until the * the iterator is empty or the maximum image cache size is met. Thus * higher priority images should appear sooner in the iteration.</p> * * @param iter an Iterator of {@link prefuse.data.Tuple} instances * @param field the data field that contains the image location */ public void preloadImages(Iterator iter, String field) { boolean sync = m_asynch; m_asynch = false; String loc; while ( iter.hasNext() && imageCache.size() <= m_imageCacheSize ) { // get the string describing the image location Tuple t = (Tuple)iter.next(); loc = t.getString(field); if ( loc != null ) { getImage(loc); } } m_asynch = sync; }