/** * This file is auto generated from JavaDoc. Do not modify it manually. */ import type BuddyIconSize from "../BuddyIconRenderer.BuddyIconSize"; import type { Node } from "../../types/javax/jcr/Node"; import type { BuddyIconInfo } from "../../types/senselogic/sitevision/api/render/BuddyIconRenderer.BuddyIconInfo"; import type { String } from "../../types/java/lang/String"; /** * BuddyIconRenderer is a stateful utility interface for rendering of buddy icons for user identities and collaboration groups. * *

* An instance of the Sitevision class implementing this interface can be obtained via {@link senselogic.sitevision.api.Utils#getBuddyIconRenderer()}. * See {@link senselogic.sitevision.api.Utils} for how to obtain an instance of the Utils interface. *

* *

* BuddyIconRenderer has few attributes: *

* * *

* Using the BuddyIconRenderer is pretty straightforward, if you remember that it is stateful and that the previously * loaded buddy icon node will be cleared whenever you try to load a new one. Conceptually you would typically use it like this: *

*
    *
  1. Get the BuddyIconRenderer
  2. *
  3. Possibly init the renderer with rendering settings (buddyIconSize, linkBuddyIcon)
  4. *
  5. Set a buddy icon node
  6. *
  7. Do render
  8. *
*

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

*
    *
  1. Update the buddy icon node
  2. *
  3. Do render.
  4. *
* *

* Example of how this strategy could be implemented in Velocity:
* (You want to do a simple listing of buddy icons for some collaboration groups, collaboration group pages, user identities or users) *

*

 *    ## Get BuddyIconRenderer
 *    #set ($buddyIconRenderer = $sitevisionUtils.buddyIconRenderer)
 *
 *    ## Iterate through the list of nodes and render a buddy icon for all supported nodes
 *    <ul class="sv-no-list-style">
 *    #foreach ($item in $items)
 *      ## Check if this node can be rendered as a buddy icon
 *      #if ($buddyIconRenderer.isRenderable($item))
 *        ## Update the renderer and render
 *        $buddyIconRenderer.update($item)
 *        <li>
 *           $buddyIconRenderer.render()
 *        </li>
 *      #end
 *    #end
 *    </ul>
 *  
* @author Magnus Lövgren * @since Sitevision 3.5.3 */ export interface BuddyIconRenderer { /** * Sets the size for rendered buddy icons. * *

Default is BuddyIconSize.SMALL

* @param aBuddyIconSize the icon size */ setBuddyIconSize(aBuddyIconSize: BuddyIconSize): void; /** * Utility method for executing setBuddyIconSize(BuddyIconSize.SMALL) * @see #setBuddyIconSize(senselogic.sitevision.api.render.BuddyIconRenderer.BuddyIconSize) * @see BuddyIconSize#SMALL */ forceUseSmallBuddyIconSize(): void; /** * Utility method for executing setBuddyIconSize(BuddyIconSize.LARGE) * @see #setBuddyIconSize(senselogic.sitevision.api.render.BuddyIconRenderer.BuddyIconSize) * @see BuddyIconSize#LARGE */ forceUseLargeBuddyIconSize(): void; /** * Utility method for executing setBuddyIconSize(BuddyIconSize.X_LARGE) * @since Sitevision 8.2 * @see #setBuddyIconSize(senselogic.sitevision.api.render.BuddyIconRenderer.BuddyIconSize) * @see BuddyIconSize#X_LARGE */ forceUseXLargeBuddyIconSize(): void; /** * Whether or not rendered buddy icons should be linked. * *

Default is true

* @param aLinkBuddyIcon Whether or not buddy icons should be linked. */ setLinkBuddyIcon(aLinkBuddyIcon: boolean): void; /** * Utility method for executing setLinkBuddyIcon(false) * @see #setLinkBuddyIcon(boolean) */ clearUseLinkBuddyIcon(): void; /** * Utility method for executing setLinkBuddyIcon(true) * @see #setLinkBuddyIcon(boolean) */ forceUseLinkBuddyIcon(): void; /** * Updates the renderer with a new buddy icon supported node. * *

* If aBuddyIconNode is not a type that can be represented by a buddy icon, the argument will be considered as null, * i.e. the renderer will not have any renderable node in subsequent render execution. *

* @param aBuddyIconNode a node that can be rendered as a buddy icon. */ update(aBuddyIconNode: Node): void; /** * Whether or not this renderer contains a node that can be rendered. * @return true if a renderable node is loaded, false if not. */ isLoaded(): boolean; /** * Helper method to check if a certain node can be rendered as a buddy icon. * *

* Nodes with the following primary node types are potentially renderable: *

* * @param aNode the node to check * @return true if aNode is supported by this renderer, false if not */ isRenderable(aNode: Node): boolean; /** * BuddyIconInfo for current state. * *

* * The data this method provides is used by the {@link #render()} method. * The intent of this method is to facilitate custom buddy icon rendering solutions. * See {@link BuddyIconInfo} for such example. * *

* *

* Note! Returned BuddyIconInfo object is never null but its uri will potentially be null and its * width/height might be zero. * Typically when this renderer has no valid/renderable node loaded, see {@link #isLoaded()}. *

* @return the BuddyIconInfo for current state, is never null. * @since Sitevision 8.2 */ getBuddyIconInfo(): BuddyIconInfo; /** * Builds a html string based on current state. * * Size note! Profile images will never be upscaled. If a buddy icon size is larger than the actual size of the profile image, * the image will be rendered with the largest possible buddy icon size. * @return a html string, ready to print out on a page. Might be empty but never null. */ render(): string; } declare namespace BuddyIconRenderer {} declare var buddyIconRenderer: BuddyIconRenderer; export default buddyIconRenderer;