protected List<DocumentTreeNode> getTreeRoots(boolean showRoot, DocumentModel currentDocument) { return getTreeRoots(showRoot, currentDocument, DEFAULT_TREE_PLUGIN_NAME); }
@Override public List<DocumentTreeNode> getTreeRoots() { return getTreeRoots(true); }
protected DocumentTreeNode newDocumentTreeNode(DocumentModel doc, String treeName) { TreeManager treeManager = Framework.getService(TreeManager.class); Filter filter = treeManager.getFilter(treeName); Filter leafFilter = treeManager.getLeafFilter(treeName); Sorter sorter = treeManager.getSorter(treeName); String pageProvider = treeManager.getPageProviderName(treeName); return new DocumentTreeNodeImpl(doc, filter, leafFilter, sorter, pageProvider); }
protected DocumentTreeNode getDocumentTreeNode(DocumentModel documentModel) { DocumentTreeNode documentTreeNode = null; if (documentModel != null) { Filter filter = getTreeManager().getFilter(PUBLICATION_TREE_PLUGIN_NAME); Sorter sorter = getTreeManager().getSorter(PUBLICATION_TREE_PLUGIN_NAME); documentTreeNode = new DocumentTreeNodeImpl(documentModel, filter, sorter); } return documentTreeNode; }
@Override protected DocumentTreeNode getDocumentTreeNode(DocumentModel document) { DocumentTreeNode dtn = null; if (document != null) { Filter filter = null; Sorter sorter = null; String pageProviderName = null; try { pageProviderName = getTreeManager().getPageProviderName(PUBLICATION_TREE_PLUGIN_NAME); sorter = getTreeManager().getSorter(PUBLICATION_TREE_PLUGIN_NAME); } catch (Exception e) { log.error("Could not fetch filter, sorter or node type for tree ", e); } dtn = new DocumentTreeNodeImpl(document.getSessionId(), document, filter, null, sorter, pageProviderName); } return dtn; }
if (PLUGIN_EXTENSION_POINT.equals(extensionPoint)) { TreeManagerPluginDescriptor plugin = (TreeManagerPluginDescriptor) contribution; String name = plugin.getName(); filters.put(name, buildFilter(plugin)); leafFilters.put(name, buildLeafFilter(plugin)); sorters.put(name, buildSorter(plugin)); pageProviderNames.put(name, plugin.getPageProvider());
@Override public boolean isExpanded() { if (expanded == null) { final TreeActions treeActionBean = (TreeActionsBean) Component.getInstance("treeActions"); if (!treeActionBean.isNodeExpandEvent()) { String currentDocPath = treeActionBean.getCurrentDocumentPath(); if (currentDocPath != null && getPath() != null && currentDocPath.startsWith(getPath())) { // additional slower check for strict path prefix if ((currentDocPath + '/').startsWith(getPath() + '/') || "/".equals(getPath())) { expanded = Boolean.TRUE; } } } } return Boolean.TRUE.equals(expanded); }
protected String getUserWorkspacePath() { String currentDocumentPath = getCurrentDocumentPath(); if (StringUtils.isBlank(currentPersonalWorkspacePath)) { reset(); return currentDocumentPath; } if (userWorkspacePath == null || !userWorkspacePath.contains(currentPersonalWorkspacePath)) { // navigate to another personal workspace reset(); return documentManager.exists(new PathRef(currentPersonalWorkspacePath)) ? currentPersonalWorkspacePath : findFarthestContainerPath(currentDocumentPath); } return userWorkspacePath; }
@Observer(value = { EventNames.GO_PERSONAL_WORKSPACE }, create = true) public void switchToUserWorkspace() { userWorkspacePath = getCurrentDocumentPath(); reset(); }
public boolean isSelected(DocumentModel currentDocument) { if (currentDocument != null) { if (!currentDocument.isFolder()) { // check if it's the closest parent String currentPath = currentDocument.getPathAsString(); String nodePath = getPath(); if (currentPath != null && nodePath != null && currentPath.startsWith(nodePath) && currentPath.length() > nodePath.length() && currentPath.substring(nodePath.length()).startsWith("/") // make sure nodePath is the parent of currentPath && !currentPath.substring(nodePath.length() + 1).contains("/")) { // direct parent return true; } } else { // check equality return currentDocument.getId().equals(getId()); } } return false; }
public String forceTreeRefresh() throws IOException { resetCurrentDocumentData(); FacesContext context = FacesContext.getCurrentInstance(); HttpServletResponse response = (HttpServletResponse) context.getExternalContext().getResponse(); response.setContentType("application/xml; charset=UTF-8"); response.getWriter().write("<response>OK</response>"); context.responseComplete(); return null; }
public List<DocumentTreeNode> getChildren() { if (children == null) { fetchChildren(); } List<DocumentTreeNode> childrenNodes = new ArrayList<DocumentTreeNode>(); childrenNodes.addAll(children.values()); return childrenNodes; }
protected Filter buildLeafFilter(TreeManagerPluginDescriptor plugin) { String leafFilterClass = plugin.getLeafFilterClassName(); if (leafFilterClass == null || "".equals(leafFilterClass)) { return null; } try { Object instance = TreeManagerImpl.class.getClassLoader().loadClass(leafFilterClass).newInstance(); if (instance instanceof Filter) { return (Filter) instance; } else { log.error(String.format("Class %s should follow %s interface", leafFilterClass, Filter.class.getName())); } } catch (ReflectiveOperationException e) { log.error(e, e); } return null; }
@Observer(value = { EventNames.USER_ALL_DOCUMENT_TYPES_SELECTION_CHANGED }, create = false) @BypassInterceptors public void resetCurrentDocumentData() { currentDocumentPath = null; if (checkIfTreeInvalidationNeeded()) { trees.clear(); return; } // reset tree in case an accessible parent is finally found this time // for the new current document for (List<DocumentTreeNode> tree : trees.values()) { if (tree != null && tree.isEmpty()) { tree = null; } } }
public List<DocumentTreeNode> getTreeRoots() { return getTreeRoots(false); }
/** * @since 5.4 * @return a list containing a DocumentTreeNode for the Root document */ public List<DocumentTreeNode> getRootNode() { return getTreeRoots(true, documentManager.getRootDocument()); }
@Observer(value = { EventNames.GO_HOME, EventNames.DOMAIN_SELECTION_CHANGED, EventNames.DOCUMENT_CHANGED, EventNames.DOCUMENT_SECURITY_CHANGED, EventNames.DOCUMENT_CHILDREN_CHANGED }, create = false) @BypassInterceptors public void reset() { trees.clear(); resetCurrentDocumentData(); }
public List<DocumentTreeNode> getTreeRoots(String treeName) { return getTreeRoots(false, treeName); }
protected List<DocumentTreeNode> getTreeRoots(boolean showRoot, String treeName) { return getTreeRoots(showRoot, navigationContext.getCurrentDocument(), treeName); }
protected List<DocumentTreeNode> getTreeRoots(boolean showRoot) { return getTreeRoots(showRoot, navigationContext.getCurrentDocument(), DEFAULT_TREE_PLUGIN_NAME); }