/** * 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: *

*
    *
  1. Get the ImageLinkRenderer
  2. *
  3. Fetch the LinkRenderer used by the image link renderer
  4. *
  5. Init the link renderer and set the target (see {@link LinkRenderer})
  6. *
  7. Fetch the ImageRenderer used by the image link renderer
  8. *
  9. Init the image renderer and set the image (see {@link ImageRenderer})
  10. *
  11. Do render
  12. *
*

* When you have rendered once, you can re-use the renderers until you are done. Something like: *

*
    *
  1. Update the image renderer with a new image
  2. *
  3. Update the link renderer with a new target
  4. *
  5. Do render.
  6. *
* *

* 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. *

* @author Magnus Lövgren * @since Sitevision 2.6.2_04 * @see LinkRenderer * @see ImageRenderer */ export interface ImageLinkRenderer { /** * Returns the LinkRenderer instance used by this image link renderer to control linking behaviour. * @return the LinkRenderer instance used by this image link renderer * @see LinkRenderer */ getLinkRenderer(): LinkRenderer; /** * Returns the ImageRenderer instance used by this image link renderer to control (linked) image behaviour. * *

* Note! The useAutoDescription is initially set to true when the ImageRenderer instance is * created by this image link renderer, see validation note above. *

* @return the ImageRenderer instance used by this image link renderer * @see ImageRenderer */ getImageRenderer(): ImageRenderer; /** * Builds a html link based on current state of the link renderer and the image render. * *

* 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;