001/*
002 * (C) Copyright 2006-2007 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 *
016 * Contributors:
017 *     Nuxeo - initial API and implementation
018 *
019 * $Id$
020 */
021package org.nuxeo.ecm.webapp.tree;
022
023import java.io.Serializable;
024import java.util.List;
025
026import org.nuxeo.ecm.core.api.DocumentModel;
027import org.nuxeo.ecm.core.api.quota.QuotaStats;
028
029/**
030 * Tree node of documents.
031 *
032 * @author Anahide Tchertchian
033 */
034public interface DocumentTreeNode extends Serializable {
035
036    List<DocumentTreeNode> getChildren();
037
038    String getId();
039
040    String getPath();
041
042    /**
043     * Returns the {@link QuotaStats} adapter for the underlying document of this {@code DocumentTreeNode}.
044     *
045     * @since 5.5
046     */
047    QuotaStats getQuotaStats();
048
049    /**
050     * Returns true if node represents current document, or if it's the direct parent of a non-folderish document that
051     * is not be represented in the tree.
052     *
053     * @since 5.7
054     * @param currentDocument
055     */
056    boolean isSelected(DocumentModel currentDocument);
057
058    /**
059     * Returns the document corresponding to this node
060     */
061    DocumentModel getDocument();
062
063    void resetChildren();
064
065    void fetchChildren();
066
067    /**
068     * @since 6.0
069     */
070    void setExpanded(boolean expanded);
071
072    /**
073     * @since 6.0
074     */
075    boolean isExpanded();
076
077}