/** * This file is auto generated from JavaDoc. Do not modify it manually. */ import type { LinkRenderer } from "../LinkRenderer"; import type { ImageRenderer } from "../ImageRenderer"; import type { String } from "../../types/java/lang/String"; /** * ImageLinkRenderer is a stateful utility interface that combines an ImageRenderer and a LinkRenderer to render valid image links. * *
* Using the ImageLinkRenderer is pretty straightforward. All setup and state are maintained in an ImageRenderer instance and an * LinkRenderer instance that both can be retrieved via their corresponding getters. Conceptually you would typically use ImageLinkRenderer * like this: *
** When you have rendered once, you can re-use the renderers until you are done. Something like: *
*
* Example of how this strategy could be implemented in Velocity:
* (You want to do a simple thumbnail listing of some image nodes in a collection/iterator "$images", and each thumbnail should be linked to
* the original image (and opened in a new window)
*
* ## Get the ImageLinkRenderer
* #set ($imageLinkRenderer = $sitevisionUtils.imageLinkRenderer)
*
* ## Fetch the ImageRenderer and apply an image scaler (200x100 px)
* #set ($imageScaler = $sitevisionUtils.getImageScaler(200, 100))
* #set ($imageRenderer = $imageLinkRenderer.imageRenderer)
* $imageRenderer.setImageScaler($imageScaler)
*
* ## Fetch the LinkRenderer and ensure links will be opened in a new window
* #set ($linkRenderer = $imageLinkRenderer.linkRenderer)
* $linkRenderer.forceOpenNewWindow()
*
* ## Iterate through images and render them
* <ul style="list-style:none">
* #foreach ($image in $images)
* ## Load an image (that will be rendered as a 200x100 thumbnail)
* $imageRenderer.update($image)
*
* ## Link the image
* $linkRenderer.update($image)
*
* <li>
* ## Render the image link (i.e. a thumbnail image linked to the original image)
* $imageLinkRenderer.render()
* </li>
* #end
* </ul>
*
*
*
*
* Validation Note! Some validation tools consider image links to be invalid if the linked content
* (i.e. in this case an <img> element) does not have a textual representation (i.e. the alt
* attribute of the <img> element is empty). In order to minimize work to encompass this, the
* {@link ImageRenderer#forceUseAutoDescription()} is initially invoked for the {@link ImageRenderer} used by the ImageLinkRenderer.
*
*
* Thread Note! The render method is NOT thread safe! During execution of the render method the
* ImageLinkRenderer might temporarily modify the state of the LinkRenderer and/or the ImageRenderer. In other words:
* if two threads simultaneously executes the render method on the SAME ImageLinkRenderer instance, the rendered
* result might differ. This is in almost all cases nothing you need to worry about, unless your portlet or servlet actually
* creates a separate Thread and starts it. If so - ensure all your created
* threads creates and uses their own ImageLinkRenderer instance!
*
* An instance of the Sitevision class implementing this interface can be obtained via
* {@link senselogic.sitevision.api.Utils#getImageLinkRenderer()}.
* See {@link senselogic.sitevision.api.Utils} for how to obtain an instance of the Utils interface.
*
* Note! The useAutoDescription is initially set to true when the ImageRenderer instance is
* created by this image link renderer, see validation note above.
*
* Note! The render method is not thread safe, see thread note above. *
* @return a html link, ready to print out on a page */ render(): string; } declare namespace ImageLinkRenderer {} declare var imageLinkRenderer: ImageLinkRenderer; export default imageLinkRenderer;