Class DefaultLazyTreeElementRenderer
- java.lang.Object
-
- jetbrains.buildServer.web.util.lazytree.DefaultLazyTreeElementRenderer
-
- All Implemented Interfaces:
LazyTreeElementRenderer
public class DefaultLazyTreeElementRenderer extends Object implements LazyTreeElementRenderer
- Since:
- 6.0
- Author:
- Maxim Podkolzine (maxim.podkolzine@jetbrains.com)
-
-
Constructor Summary
Constructors Constructor Description DefaultLazyTreeElementRenderer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected String
encodePath(String path)
String
getCssClassForElement(Element element)
Returns the CSS class of the element to use.String
getCustomHtmlForElement(Element element, String id)
Returns the custom HTML (instead of standardspan
sequence) representing the element.protected String
getDefaultTextForElement(Element element)
String
getHrefForDirectoryDownload(Element element)
Returns a link which can be used to downloaded directory content or null if no such link should be provided.String
getHrefForLeaf(Element leaf)
Returns thehref
attribute value of the element's link.protected String
getLastModifiedTimestamp(Element element)
String
getOnClickForLeaf(Element leaf)
Returns theonclick
handler of the element's link.String
getOnClickForNonLeaf(Element element)
Returns theonclick
handler of the non-leaf element's link.protected String
getPathForJs(Element element)
protected String
getSize(Element element)
String
getTextForElement(Element element)
Returns the text representation of an element (usually name).boolean
ignoreElement(Element element)
If returns true, theelement
and its subtree won't appear in web UI.protected boolean
isInsideZip(Element element)
protected boolean
isMakeLinkFromLeaf(Element element)
protected boolean
isMakeOnclickFromLeaf(Element element)
protected boolean
isZipElement(Element element)
void
prepareForRequest(javax.servlet.http.HttpServletRequest request)
Allows the renderer to customize its behaviour depending on currentrequest
.protected String
prepareOnClickFonNonLeaf(Element element, String defaultValue)
protected boolean
showLastModified()
protected boolean
showSize()
-
-
-
Method Detail
-
prepareForRequest
public void prepareForRequest(@NotNull javax.servlet.http.HttpServletRequest request)
Description copied from interface:LazyTreeElementRenderer
Allows the renderer to customize its behaviour depending on currentrequest
.- Specified by:
prepareForRequest
in interfaceLazyTreeElementRenderer
- Parameters:
request
- http request
-
ignoreElement
public boolean ignoreElement(@NotNull Element element)
Description copied from interface:LazyTreeElementRenderer
If returns true, theelement
and its subtree won't appear in web UI. Useful for filtering redundant elements, such as".svn"
.- Specified by:
ignoreElement
in interfaceLazyTreeElementRenderer
- Parameters:
element
- the element- Returns:
- true if the element should be ignored, false otherwise
-
getTextForElement
@NotNull public String getTextForElement(@NotNull Element element)
Description copied from interface:LazyTreeElementRenderer
Returns the text representation of an element (usually name). Default implementation returns:StringUtil.escapeHTML(element.getName(), false))
.- Specified by:
getTextForElement
in interfaceLazyTreeElementRenderer
- Parameters:
element
- the element to render- Returns:
- string representation of the element
-
getOnClickForLeaf
public String getOnClickForLeaf(@NotNull Element leaf)
Description copied from interface:LazyTreeElementRenderer
Returns theonclick
handler of the element's link. Method is optional. Applies only to leaf elements.- Specified by:
getOnClickForLeaf
in interfaceLazyTreeElementRenderer
- Parameters:
leaf
- the element to render- Returns:
- string representation of the onclick handler, or null
-
getHrefForLeaf
public String getHrefForLeaf(@NotNull Element leaf)
Description copied from interface:LazyTreeElementRenderer
Returns thehref
attribute value of the element's link. Method is optional. Applies only to leaf elements.Updated in 7.0: some leaf elements can act as non-leaf ones (e.g. archives). Technically they are not leaves in a tree, but the
href
attribute is still valid for them.- Specified by:
getHrefForLeaf
in interfaceLazyTreeElementRenderer
- Parameters:
leaf
- the element to render- Returns:
- string representation of the href attribute, or null
-
getHrefForDirectoryDownload
@Nullable public String getHrefForDirectoryDownload(@NotNull Element element)
Description copied from interface:LazyTreeElementRenderer
Returns a link which can be used to downloaded directory content or null if no such link should be provided.- Specified by:
getHrefForDirectoryDownload
in interfaceLazyTreeElementRenderer
- Parameters:
element
- the element to get link for- Returns:
- see above
-
getOnClickForNonLeaf
@Nullable public String getOnClickForNonLeaf(@NotNull Element element)
Description copied from interface:LazyTreeElementRenderer
Returns theonclick
handler of the non-leaf element's link. Method is optional.- Specified by:
getOnClickForNonLeaf
in interfaceLazyTreeElementRenderer
- Parameters:
element
- the non-leaf element to render- Returns:
- string representation of the onclick handler, or null if default handler should be used
-
prepareOnClickFonNonLeaf
@NotNull protected String prepareOnClickFonNonLeaf(@NotNull Element element, @NotNull String defaultValue)
-
getCssClassForElement
@Nullable public String getCssClassForElement(@NotNull Element element)
Description copied from interface:LazyTreeElementRenderer
Returns the CSS class of the element to use. May be applied to all elements.- Specified by:
getCssClassForElement
in interfaceLazyTreeElementRenderer
- Parameters:
element
- the element to render- Returns:
- CSS class, or null if no additional class should be used
-
getCustomHtmlForElement
@Nullable public String getCustomHtmlForElement(@NotNull Element element, @NotNull String id)
Description copied from interface:LazyTreeElementRenderer
Returns the custom HTML (instead of standardspan
sequence) representing the element. Note that in this case therenderer
is responsible to attach proper javascript handlers.- Specified by:
getCustomHtmlForElement
in interfaceLazyTreeElementRenderer
- Parameters:
element
- the element (can be a leaf, can be an intermediate one)id
- its id- Returns:
- the HTML for the element, or
null
-
isInsideZip
protected boolean isInsideZip(@NotNull Element element)
-
isZipElement
protected boolean isZipElement(@NotNull Element element)
-
getDefaultTextForElement
@NotNull protected String getDefaultTextForElement(@NotNull Element element)
-
showSize
protected boolean showSize()
-
showLastModified
protected boolean showLastModified()
-
getLastModifiedTimestamp
@NotNull protected String getLastModifiedTimestamp(@NotNull Element element)
-
isMakeLinkFromLeaf
protected boolean isMakeLinkFromLeaf(@NotNull Element element)
-
isMakeOnclickFromLeaf
protected boolean isMakeOnclickFromLeaf(@NotNull Element element)
-
-