Class TreeView

  • All Implemented Interfaces:

    public class TreeView
    extends java.lang.Object
    TreeView definition per user session
    See Also:
    Serialized Form
    • Constructor Detail

      • TreeView

        public TreeView​(Grant g,
                        java.lang.String id,
                        java.lang.String name,
                        int mode,
                        java.lang.String display)
        g - User rights
        id - Treeview id
        name - Treeview name
        mode - Treeview mode
    • Method Detail

      • getObjects

        public java.util.List<java.lang.String> getObjects()
        Objects in tree definition (to limit index search)
      • getId

        public java.lang.String getId()
        Get the treeview id
      • getName

        public java.lang.String getName()
        Get the treeview name
      • getDisplay

        public java.lang.String getDisplay()
        Get the treeview label
      • setDisplay

        public void setDisplay​(java.lang.String label)
      • getRootObjectNames

        public java.util.List<java.lang.String> getRootObjectNames()
        Objects on the tree root
      • addRootObject

        public void addRootObject​(java.lang.String obj)
      • setMode

        public void setMode​(int mode)
        Set mode
        mode - Mode: one of TreeView.MODE_*
      • getMode

        public int getMode()
        Get mode
        one of TreeView.MODE_*
      • isDynamic

        public boolean isDynamic()
        Is dynamic: mode is not TreeView.MODE_MANUAL
      • removeId

        public void removeId​(java.lang.String id)
      • getRootObject

        public TreeView.TreeViewNode getRootObject​(java.lang.String obj)
        Search object node in root only
        obj - Optional object name
        Matching root or first root with object
      • getTreeObject

        public TreeView.TreeViewNode getTreeObject​(java.lang.String obj)
        Deep node search matching object
      • getUserMenu

        public static java.lang.String getUserMenu​(Grant g)
        Get user preference MENU_TREEVIEW = [{ treeview, object, rowid }]
      • addUserMenu

        public void addUserMenu​(java.lang.String object,
                                java.lang.String id)
        Store user preference MENU_TREEVIEW = [{ treeview, object, rowid }]
      • delUserMenu

        public void delUserMenu​(java.lang.String object,
                                java.lang.String id)
        Remove menu preference MENU_TREEVIEW = [{ treeview, object, rowid }]
      • toJSON

        public java.lang.String toJSON()
        Treeview definition { id, name, mode, label, root: { node }}
      • jsonPage

        public java.lang.String jsonPage​(java.lang.String parent,
                                         java.lang.String rowId,
                                         java.lang.String child,
                                         int page)
        Search a page for UI service (stateless)
      • toJSON

        public java.lang.String toJSON​(ObjectDB object,
                                       Parameters.InlineParam inlines,
                                       boolean metadata,
                                       TreeView.TreeViewNode node,
                                       int depth)
        Get the tree from a root node
        object - selected object
        inlines - inline documents|thumbs|objects
        metadata - get metadata
        node - optional node (default is root object)
        depth - depth of recursion (-1 = search all to leafs on manual tree)
      • toJSON

        public java.lang.String toJSON​(TreeView.TreeViewNode node,
                                       ObjectDB obj,
                                       Parameters.InlineParam inlines,
                                       boolean metadata,
                                       int depth)
        Export the object root as a JSON tree :
         { object: "myObject",
           row_id: "123", // object row ID
           item: { field1:"value", field2:"value", ... }, // record of row_id
           userkey: "user key", // object user key label
           nid: "3", // node definition id
           level: 5, // node level (0=root)
           links: [
             { object: "childObject1", // child object
               label: "child name", // object label
               count: 20, // children count
               page: 0, // current page (if pagination)
               maxpage: 3, // pages count (if pagination)
               icon: "cup", // object icon
               field: "foreignkey", // foreign key to parent
               filters: { "foreignkey":"123" }, // filter to search children
               list: [ objects... ] // recursive
             }, ...
        node - Node definition in tree
        obj - Related object
        inlines - Inlined infos (doc, image...)
        metadata - Get tree metadata
        depth - Deep search limit
      • importJSON

        public java.lang.String importJSON​(org.json.JSONObject json,
                                           ObjectDB obj)
        Import the JSON tree as an XML import
        json - JSON object
        obj - Optional root object
        Import logs
      • toString

        public java.lang.String toString()
        toString in class java.lang.Object
      • jsonTree

        public static java.lang.String jsonTree​(ObjectDB obj,
                                                java.util.List<java.lang.String[]> rows,
                                                java.lang.String fk,
                                                int treeDepth,
                                                Parameters.InlineParam inlines,
                                                int context,
                                                Parameters.ParamContext params,
                                                boolean metadata,
                                                boolean timestamp,
                                                boolean visibleOnly,
                                                java.lang.String edit)
        Build the reflexive object tree
        obj - Root object
        rows - List of records
        fk - Reflexive foreign-key name
        treeDepth - max level (-1 = deep search)
        JSON tree of rows [{ data, meta, count, list:[...]}, ...]