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

org.openl.rules.ui.tree.TreeNodeBuilder Maven / Gradle / Ivy

There is a newer version: 5.27.9
Show newest version
package org.openl.rules.ui.tree;

/**
 * Provides methods for tree node building.
 *
 * @param  type of node object
 */
public interface TreeNodeBuilder {

    /**
     * Generates comparable key that will be used for detecting similar nodes.
     *
     * @param object The object for key generating.
     * @return Key for object.
     */
    Comparable makeKey(T object);

    /**
     * @param object The object that will be displayed in the tree
     * @param i      Order number of object.
     * @return TreeNode generated for the object.
     */
    ProjectTreeNode makeNode(T object, int i);

    /**
     * Generates comparable key for similar keys. It only used if isUnique==true. Then we have to create
     * nodes for each similar object. The key will be generated with using of order number of key. (The first node have
     * number 0, the second - 2, the third 3 etc.)
     *
     * @param object The object for displaying in the tree.
     * @param i      Order number of object.
     * @return Key for object.
     */
    Comparable makeKey(T object, int i);

    /**
     * @param object The object that can be processed by tree builder.
     * @return true if specified object must be processed by tree builder false if current
     * tree builder must skip object.
     */
    boolean isBuilderApplicableForObject(T object);

    /**
     * @param object The object to check.
     * @return true if node is obligatory to display even if the tree already has element with similar key
     */
    boolean isUnique(T object);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy