All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.legyver.fenxlib.widgets.filetree.tree.internal.TreeRoot Maven / Gradle / Ivy

There is a newer version: 3.0.2
Show newest version
package com.legyver.fenxlib.widgets.filetree.tree.internal;

import com.legyver.fenxlib.widgets.filetree.factory.FileTreeRemoveEventHandlerFactory;
import com.legyver.fenxlib.widgets.filetree.nodes.FileReference;
import com.legyver.fenxlib.widgets.filetree.tree.FileTreeItem;
import com.legyver.fenxlib.widgets.filetree.tree.TreeFolder;
import javafx.beans.property.SimpleBooleanProperty;

import java.util.Collection;
import java.util.Iterator;

/**
 * Tree root node that files/folders can be associated with
 */
public class TreeRoot extends TreeFolder {

    /**
     * Construct a Tree root node that files/folders can be associated with
     * @param fileReference the pseudo-reference
     */
	public TreeRoot(FileReference fileReference) {
        super("", fileReference);
    }

    /**
     * Refresh children
     * @return true if this node can be removed from parent
     */
    @Override
    @SuppressWarnings("unchecked")
    public boolean refreshAndCheckIfRemovable() {
        Collection children = getChildren();
        for (Iterator childIt = children.iterator(); childIt.hasNext(); ) {
            FileTreeItem child = childIt.next();
            if (child.refreshAndCheckIfRemovable()) {
                childIt.remove();
            }
        }
        return false;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy