Package io.goobi.viewer.model.toc
Class TOC
java.lang.Object
io.goobi.viewer.model.toc.TOC
- All Implemented Interfaces:
Serializable
Table of contents and associated functionality for a record.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidbuildTree(String group, int visibleLevel, int collapseThreshold, int lowestLevelToCollapse, String currentElementIdDoc) voidcollapseAll.voidexpandAll.intfindTocElementIndexByIddoc(String iddoc) voidgenerate(StructElement structElement, boolean addAllSiblings, String mimeType, int tocCurrentPage) generate.Recalculates the visibility of TOC elements after a +/- button has been pressed.intGetter for the fieldcurrentPage.getFlatView.getGroupNames.Returns the label of the first found TOCElement that has the given PI as its topStructPi.Returns the label in the given language of the first found TOCElement that has the given PI as its topStructPi.Returns the label in the given locale of the first found TOCElement that has the given PI as its topStructPi.intGetter for the fieldmaxTocDepth.intReturns the number of paginator pages for the given TOC size and elements per page.getTocElements.intGetter for the fieldtocInvisible.intGetter for the fieldtocVisible.intGetter for the fieldtotalTocSize.getTreeView.getTreeViewForGroup(String group) getTreeViewForGroup.getViewForGroup(String group) getViewForGroup.booleanhasChildren.voidsetChildInvisible(int id) setChildInvisible.voidsetChildVisible(int id) setChildVisible.voidsetCurrentPage(int currentPage) Setter for the fieldcurrentPage.voidsetMaxTocDepth(int maxTocDepth) Setter for the fieldmaxTocDepth.voidsetTocInvisible(int tocInvisible) Setter for the fieldtocInvisible.voidsetTocVisible(int tocVisible) Setter for the fieldtocVisible.voidsetTotalTocSize(int totalTocSize) Setter for the fieldtotalTocSize.
-
Constructor Details
-
TOC
public TOC()Creates a new TOC instance.
-
-
Method Details
-
generate
public void generate(StructElement structElement, boolean addAllSiblings, String mimeType, int tocCurrentPage) throws PresentationException, IndexUnreachableException, DAOException, ViewerConfigurationException generate.- Parameters:
structElement- root struct element for TOC generationaddAllSiblings- if true, sibling elements are included in the TOCmimeType- MIME type of the recordtocCurrentPage- current paginator page of anchor group elements- Throws:
PresentationException- if any.IndexUnreachableException- if any.DAOException- if any.ViewerConfigurationException- if any.
-
getGroupNames
getGroupNames.- Returns:
- a list of TOC group names available in this table of contents
-
getViewForGroup
getViewForGroup.- Parameters:
group- TOC group name to retrieve elements for- Returns:
- a list of TOC elements belonging to the given group, or null if none found
-
getTreeViewForGroup
getTreeViewForGroup.- Parameters:
group- TOC group name to build the tree for- Returns:
- a list of TOC elements for the given group with tree nesting applied
-
getFlatView
getFlatView.- Returns:
- a flat list of all TOC elements in the default group
-
getTreeView
getTreeView.- Returns:
- a list of TOC elements for the default group with tree nesting applied
-
buildTree
protected void buildTree(String group, int visibleLevel, int collapseThreshold, int lowestLevelToCollapse, String currentElementIdDoc) - Parameters:
group- TOC group name to build the tree forvisibleLevel- maximum hierarchy level shown expanded initiallycollapseThreshold- sibling count above which a level is auto-collapsedlowestLevelToCollapse- minimum hierarchy level eligible for length-based collapsecurrentElementIdDoc- IDDOC of the currently displayed struct element
-
getActiveElement
Recalculates the visibility of TOC elements after a +/- button has been pressed.- Returns:
- the TOCElement that was expanded or collapsed after processing the pending visibility change, or null if none was pending
-
expandAll
public void expandAll()expandAll. -
collapseAll
public void collapseAll()collapseAll. -
setChildVisible
public void setChildVisible(int id) setChildVisible.- Parameters:
id- index of the TOC element to expand
-
setChildInvisible
public void setChildInvisible(int id) setChildInvisible.- Parameters:
id- index of the TOC element to collapse
-
getTocElements
getTocElements.- Returns:
- a list of all TOC elements in the default group
-
findTocElementIndexByIddoc
- Parameters:
iddoc- IDDOC of the element to find- Returns:
- Index of the element with the matching IDDOC within the list of elements; -1 if none found
-
getTocVisible
public int getTocVisible()Getter for the fieldtocVisible.- Returns:
- the number of visible TOC entries on the current page
-
setTocVisible
public void setTocVisible(int tocVisible) Setter for the fieldtocVisible.- Parameters:
tocVisible- the number of visible TOC entries on the current page to set
-
getTocInvisible
public int getTocInvisible()Getter for the fieldtocInvisible.- Returns:
- the number of hidden (collapsed) TOC entries on the current page
-
setTocInvisible
public void setTocInvisible(int tocInvisible) Setter for the fieldtocInvisible.- Parameters:
tocInvisible- the number of hidden (collapsed) TOC entries on the current page to set
-
getMaxTocDepth
public int getMaxTocDepth()Getter for the fieldmaxTocDepth.- Returns:
- the maximum nesting depth of the TOC tree
-
setMaxTocDepth
public void setMaxTocDepth(int maxTocDepth) Setter for the fieldmaxTocDepth.- Parameters:
maxTocDepth- the maximum nesting depth of the TOC tree to set
-
getTotalTocSize
public int getTotalTocSize()Getter for the fieldtotalTocSize.- Returns:
- the total number of TOC entries across all pages
-
setTotalTocSize
public void setTotalTocSize(int totalTocSize) Setter for the fieldtotalTocSize.- Parameters:
totalTocSize- the total number of TOC entries across all pages to set
-
getCurrentPage
public int getCurrentPage()Getter for the fieldcurrentPage.- Returns:
- the 1-based page number of the currently displayed TOC page
-
setCurrentPage
public void setCurrentPage(int currentPage) Setter for the fieldcurrentPage.- Parameters:
currentPage- the 1-based page number of the TOC page to display
-
getNumPages
public int getNumPages()Returns the number of paginator pages for the given TOC size and elements per page.- Returns:
- a int.
-
isHasChildren
public boolean isHasChildren()hasChildren.- Returns:
- true if the TOC contains more than one element or any element has child entries, false otherwise
-
getLabel
Returns the label of the first found TOCElement that has the given PI as its topStructPi.- Parameters:
pi- persistent identifier of the record- Returns:
- the label of the matching TOC element, or null if none found
-
getLabel
Returns the label in the given language of the first found TOCElement that has the given PI as its topStructPi.- Parameters:
pi- persistent identifier of the recordlanguage- ISO 639-1 language code for the desired label- Returns:
- the language-specific label of the matching TOC element, or null if none found
-
getLabel
Returns the label in the given locale of the first found TOCElement that has the given PI as its topStructPi.- Parameters:
pi- persistent identifier of the recordlocale- locale for the desired label language- Returns:
- the locale-specific label of the matching TOC element, or null if none found
-