Copyright© 2008-2018 SiteVision AB, all rights reserved.
@Requireable(value="BuddyIconRenderer") public interface BuddyIconRenderer
An instance of the SiteVision class implementing this interface can be obtained via Utils.getBuddyIconRenderer()
.
See Utils
for how to obtain an instance of the Utils
interface.
BuddyIconRenderer has few attributes:
null
.
BuddyIconSize.SMALL
. Note that image size
settings are followed with best effort. Images will never be upscaled.
true
.
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:
When you have rendered once, you can re-use the BuddyIconRenderer until you are done. Something like:
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>
Modifier and Type | Interface and Description |
---|---|
static class |
BuddyIconRenderer.BuddyIconSize
The size of the icons rendered by the BuddyIconRenderer.
|
Modifier and Type | Method and Description |
---|---|
void |
clearUseLinkBuddyIcon()
Utility method for executing
setLinkBuddyIcon(false) |
void |
forceUseLargeBuddyIconSize()
Utility method for executing
setBuddyIconSize(BuddyIconSize.LARGE) |
void |
forceUseLinkBuddyIcon()
Utility method for executing
setLinkBuddyIcon(true) |
void |
forceUseSmallBuddyIconSize()
Utility method for executing
setBuddyIconSize(BuddyIconSize.SMALL) |
boolean |
isLoaded()
Whether or not this renderer contains a node that can be rendered.
|
boolean |
isRenderable(Node aNode)
Helper method to check if a certain node can be rendered as a buddy icon.
|
String |
render()
Builds a html string based on current state.
|
void |
setBuddyIconSize(BuddyIconRenderer.BuddyIconSize aBuddyIconSize)
Sets the size for rendered buddy icons.
|
void |
setLinkBuddyIcon(boolean aLinkBuddyIcon)
Whether or not rendered buddy icons should be linked.
|
void |
update(Node aBuddyIconNode)
Updates the renderer with a new buddy icon supported node.
|
void setBuddyIconSize(BuddyIconRenderer.BuddyIconSize aBuddyIconSize)
Default is BuddyIconSize.SMALL
aBuddyIconSize
- the icon sizevoid forceUseSmallBuddyIconSize()
setBuddyIconSize(BuddyIconSize.SMALL)
void forceUseLargeBuddyIconSize()
setBuddyIconSize(BuddyIconSize.LARGE)
void setLinkBuddyIcon(boolean aLinkBuddyIcon)
Default is true
aLinkBuddyIcon
- Whether or not buddy icons should be linked.void clearUseLinkBuddyIcon()
setLinkBuddyIcon(false)
setLinkBuddyIcon(boolean)
void forceUseLinkBuddyIcon()
setLinkBuddyIcon(true)
setLinkBuddyIcon(boolean)
void update(Node aBuddyIconNode)
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.
aBuddyIconNode
- a node that can be rendered as a buddy icon.boolean isLoaded()
true
if a renderable node is loaded, false
if not.boolean isRenderable(Node aNode)
Nodes with the following primary node types are potentially renderable:
sv:userIdentity
sv:user
(non-anonymous) » will be renderable if a sv:userIdentity can be extractedsv:simpleUser
» will be renderable if a sv:userIdentity can be extractedsv:systemUser
» will be renderable if a sv:userIdentity can be extractedsv:collaborationGroup
sv:collaborationGroupPage
» will be renderable if a sv:collaborationGroup can be extractedaNode
- the node to checktrue
if aNode
is supported by this renderer, false
if notString render()
null
.SiteVision - Portal and Content Management Made Easy
SiteVision is an advanced Java enterprise portal product and a portlet container (JSR 286) that implements Java Content Repository (JSR 283).
Copyright© 2008-2018 SiteVision AB, all rights reserved.