public String getItemImageUrl(final TreeItemImage item, final String itemId) {

		if (item == null) {
			return null;
		}

		// Check if has image url
		String url = item.getUrl();
		if (!Util.empty(url)) {
			return url;
		}

		// Check if has image
		Image image = item.getImage();
		if (image == null) {
			return null;
		}

		// Check static resource
		if (image instanceof InternalResource) {
			return ((InternalResource) image).getTargetUrl();
		}

		// Build targetted url
		Environment env = getEnvironment();
		Map<String, String> parameters = env.getHiddenParameters();
		parameters.put(Environment.TARGET_ID, getTargetId());

		String cacheKey = item.getImageCacheKey();

		if (Util.empty(cacheKey)) {
			// Add some randomness to the URL to prevent caching
			String random = WebUtilities.generateRandom();
			parameters.put(Environment.UNIQUE_RANDOM_PARAM, random);
		} else {
			// Remove step counter as not required for cached content
			parameters.remove(Environment.STEP_VARIABLE);
			parameters.remove(Environment.SESSION_TOKEN_VARIABLE);
			// Add the cache key
			parameters.put(Environment.CONTENT_CACHE_KEY, cacheKey);
		}

		// Item id
		parameters.put(ITEM_REQUEST_KEY, itemId);

		// The targetable path needs to be configured for the portal environment.
		url = env.getWServletPath();

		// Note the last parameter. In javascript we don't want to encode "&".
		return WebUtilities.getPath(url, parameters, true);
	}
public String getItemImageUrl ( final TreeItemImage item , final String itemId ) { if ( item == null ) { return null ; } String url = item . getUrl ( ) ; if ( ! Util . empty ( url ) ) { return url ; } Image image = item . getImage ( ) ; if ( image == null ) { return null ; } if ( image instanceof InternalResource ) { return ( ( InternalResource ) image ) . getTargetUrl ( ) ; } Environment env = getEnvironment ( ) ; Map < String , String > parameters = env . getHiddenParameters ( ) ; parameters . put ( Environment . TARGET_ID , getTargetId ( ) ) ; String cacheKey = item . getImageCacheKey ( ) ; if ( Util . empty ( cacheKey ) ) { String random = WebUtilities . generateRandom ( ) ; parameters . put ( Environment . UNIQUE_RANDOM_PARAM , random ) ; } else { parameters . remove ( Environment . STEP_VARIABLE ) ; parameters . remove ( Environment . SESSION_TOKEN_VARIABLE ) ; parameters . put ( Environment . CONTENT_CACHE_KEY , cacheKey ) ; } parameters . put ( ITEM_REQUEST_KEY , itemId ) ; url = env . getWServletPath ( ) ; return WebUtilities . getPath ( url , parameters , true ) ; }
Retrieves a URL for the tree item image.
<p>
This method is used by the WTree Renderer.
</p>

@param item the tree item
@param itemId the tree item id
@return the URL to access the tree item image.