Fudge User Interface
    Preparing search index...

    Class TreeController<T>Abstract

    Subclass this to create a broker between your data and a Tree to display and manipulate it. The Tree doesn't know how your data is structured and how to handle it, the controller implements the methods needed

    Type Parameters

    • T

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    dragDropIndicator: HTMLHRElement = ...

    Used by the tree to indicate the drop position while dragging

    selection: T[] = []

    Stores references to selected objects. Override with a reference in outer scope, if selection should also operate outside of table

    sortable: boolean = true

    Override to enable tree items to be sortable by the user via drag-and-drop. Default is true.

    Methods

    • Process the list of source objects to be addedAsChildren when dropping or pasting onto the target item/object, return the list of objects that should visibly become the children of the target item/object

      Parameters

      • _sources: T[]
      • _target: T

        The object referenced by the item the drop occurs on

      • Optional_index: number

      Returns T[]

    • Create an HTMLElement for the tree item representing the object. e.g. an HTMLInputElement

      Parameters

      • _object: T

      Returns HTMLElement

    • Refer objects to the clipboard for copy & paste and delete them from this controller

      Parameters

      • _focus: T

        The item that has the focus and that will be cut if the selection is empty, otherwise the whole selection gets referred and deleted

      • _operation: ClipOperation

      Returns Promise<T[]>

    • Remove the objects to be deleted, e.g. the current selection, from the data structure the table refers to and return a list of those objects in order for the according TableItems to be deleted also

      Parameters

      • _expendables: T[]

        The expendable objects

      Returns Promise<T[]>

    • Refer objects to the clipboard for drag & drop

      Parameters

      • _focus: T

        The item that has the focus and that will be dragged if the selection is empty, otherwise the current selection is referred

      Returns void

    • Retrieve objects from the clipboard, process and return them to add to the tree. Standard behaviour: if {@link: dragOver} yields "copy", return an array of clones of the objects in, otherwise the content of the dragDrop-clipboard.

      Parameters

      • _event: DragEvent

      Returns Promise<T[]>

    • Checks if two objects of are equal. Default is _a == _b. Override for more complex comparisons. Useful when the underlying data is volatile and changes identity while staying the same.

      Parameters

      • _a: T
      • _b: T

      Returns boolean

    • Retrieve a space separated string of attributes to add to the list item representing the object for further styling

      Parameters

      • _object: T

      Returns string

    • Retrieve objects from the clipboard, process and return them to add to the table
      Standard behaviour: if the copyPaste clipboard was filled using copy, return an array of clones, otherwise the content of the clipboard

      Returns Promise<T[]>

    • Process the proposed new value. The id of the html element on which the change occured is passed

      Parameters

      • _object: T
      • _element: HTMLInputElement | HTMLSelectElement

      Returns Promise<boolean>