Search Results for

    Show / Hide Table of Contents

    Class BaseTreeViewAnyController<T>

    The controller for handling the IBaseTreeView<T> view

    This controller/view allows the selection of entities of type T that can be used for sub-views accessing the SelectedItemForSubViews.

    Thus all areas grids can be used (such as the default lookup views for selecting items for single lookup controls) this view can also be used instead
    Inheritance
    object
    ModelViewController
    BaseTreeViewAnyController<T>
    RelationshipsController
    BaseTreeViewController<T>
    Implements
    ICollectionExportable
    ISearchController
    IModelViewController
    Inherited Members
    ModelViewController.InitAsync()
    ModelViewController.DisplayItem(object)
    ModelViewController.GetCurrentDisplayedItem(object)
    ModelViewController.Redisplay()
    ModelViewController.OnTrackedItemChanged(object, string)
    ModelViewController.GetCanWrite(object)
    ModelViewController.ShouldDisplayItem(object)
    ModelViewController.RemoveHandlers(object)
    ModelViewController.AddHandlers(object)
    ModelViewController.RemoveCommand(ViewCommand)
    ModelViewController.RemoveCommands<TOfType>()
    ModelViewController.InsertCommand(ViewCommand, int)
    ModelViewController.InsertCommand(ViewCommand, ViewCommand, ViewCommand)
    ModelViewController.UpdateAllCommands()
    ModelViewController.GetNestedViews()
    ModelViewController.RootController
    ModelViewController.ServiceContext
    ModelViewController.UIContext
    ModelViewController.CanWrite
    ModelViewController.ListenToChanges
    ModelViewController.TrackChanges
    ModelViewController.CheckIsLockedForCanWrite
    ModelViewController.DisplayIfNull
    ModelViewController.CurrentDisplayedItem
    ModelViewController.View
    ModelViewController.Commands
    ModelViewController.ContextHelpURL
    object.GetType()
    object.MemberwiseClone()
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    Namespace: LemonEdge.Client.Core.Views.Core
    Assembly: LemonEdge.ClientCore.dll
    Syntax
    public abstract class BaseTreeViewAnyController<T> : ModelViewController, ICollectionExportable, ISearchController, IModelViewController
    Type Parameters
    Name Description
    T

    The treeview works with any entity type T that has a parent relationship to itself

    Constructors

    BaseTreeViewAnyController(IBaseTreeView<T>)

    Creates a new tree view controller for the specified instance of a tree view

    Declaration
    public BaseTreeViewAnyController(IBaseTreeView<T> view)
    Parameters
    Type Name Description
    IBaseTreeView<T> view

    The instance of the tree view in the client application

    Fields

    _descriptor

    Declaration
    protected EntityDescriptor _descriptor
    Field Value
    Type Description
    EntityDescriptor

    _items

    Declaration
    protected List<T> _items
    Field Value
    Type Description
    List<T>

    _rootNodes

    Declaration
    protected List<TreeNode<T>> _rootNodes
    Field Value
    Type Description
    List<TreeNode<T>>

    Properties

    AllowXMLImportExport

    Declaration
    public virtual bool AllowXMLImportExport { get; }
    Property Value
    Type Description
    bool

    AutoExpandAll

    Indicates when loaded the system should automatically expand the entire tree view in the ui. Automated if the ui view implements IBaseTreeViewWithExpansion<T>

    Default is false

    Declaration
    protected virtual bool AutoExpandAll { get; }
    Property Value
    Type Description
    bool

    AutoPromptForLabelOnNew

    Declaration
    protected virtual bool AutoPromptForLabelOnNew { get; }
    Property Value
    Type Description
    bool

    CollectionType

    Indicates we export a collection of entities of type T

    Declaration
    public Type CollectionType { get; }
    Property Value
    Type Description
    Type

    CommandAllowSearch

    Declaration
    protected virtual bool CommandAllowSearch { get; }
    Property Value
    Type Description
    bool

    CommandCopy

    Provides the ability for an inheriting class to override the Copy command

    Declaration
    protected virtual ViewCommand CommandCopy { get; }
    Property Value
    Type Description
    ViewCommand

    CommandCopyAllow

    Indicates if copying should be allowed in this view

    Declaration
    protected virtual bool CommandCopyAllow { get; }
    Property Value
    Type Description
    bool

    CommandDelete

    Provides the ability for an inheriting class to override the Delete command

    Declaration
    protected virtual ViewCommand CommandDelete { get; }
    Property Value
    Type Description
    ViewCommand

    CommandDeleteAllow

    Indicates if the view should show the Delete command - default is true

    Declaration
    protected virtual bool CommandDeleteAllow { get; }
    Property Value
    Type Description
    bool

    CommandDeleteCanDelete

    Indicates if the view should allow items to be deleted - Default is true

    Declaration
    protected virtual bool CommandDeleteCanDelete { get; }
    Property Value
    Type Description
    bool

    CommandNew

    Provides the ability for an inheriting class to override the New command

    Declaration
    protected virtual ViewCommand CommandNew { get; }
    Property Value
    Type Description
    ViewCommand

    CommandNewAllow

    Indicates if the view should show the New command - Default is true

    Declaration
    protected virtual bool CommandNewAllow { get; }
    Property Value
    Type Description
    bool

    CommandNewAllowMultipleRoots

    If true indicates the user can create multiple top level (root) nodes in the tree view. False otherwise

    Default is true

    Declaration
    protected virtual bool CommandNewAllowMultipleRoots { get; }
    Property Value
    Type Description
    bool

    CommandNewCanCreate

    Indicates if the view should allow New items to be created - Default is true

    Declaration
    protected virtual bool CommandNewCanCreate { get; }
    Property Value
    Type Description
    bool

    CommandNewType

    Declaration
    protected virtual Type CommandNewType { get; }
    Property Value
    Type Description
    Type

    CommandOpen

    Provides the ability for an inheriting class to override the Open command

    Declaration
    protected virtual ViewCommand CommandOpen { get; }
    Property Value
    Type Description
    ViewCommand

    CommandOpenAllow

    Indicates if the view should show the Open command - default is false

    Declaration
    public virtual bool CommandOpenAllow { get; }
    Property Value
    Type Description
    bool

    CommandRenameAllow

    Declaration
    protected virtual bool CommandRenameAllow { get; }
    Property Value
    Type Description
    bool

    CurrentGridItems

    Holds the current complete collection of loaded tree nodes in the TreeView

    Declaration
    public IEnumerable CurrentGridItems { get; }
    Property Value
    Type Description
    IEnumerable

    Descriptor

    The entity descriptor for the entity type T that this tree view displays

    Declaration
    public EntityDescriptor Descriptor { get; }
    Property Value
    Type Description
    EntityDescriptor

    ForceSubViewUpdateOnChangeEvenIfSame

    Declaration
    protected virtual bool ForceSubViewUpdateOnChangeEvenIfSame { get; }
    Property Value
    Type Description
    bool

    GetDefaultOrder

    Declaration
    protected virtual Order? GetDefaultOrder { get; }
    Property Value
    Type Description
    Order?

    GetDefaultOrderPropertyName

    Declaration
    protected virtual string GetDefaultOrderPropertyName { get; }
    Property Value
    Type Description
    string

    GetParentIDPropertyName

    Returns the property on the entity type T that holds the relationship to the parent instance of type T too

    Declaration
    protected abstract string GetParentIDPropertyName { get; }
    Property Value
    Type Description
    string

    GetTreeNodeColorPropertyName

    Returns the property on the entity type T that holds the color that should be shown as the color on the tree node for every item in the tree view control itself

    Declaration
    public virtual string GetTreeNodeColorPropertyName { get; }
    Property Value
    Type Description
    string

    GetTreeNodeIconPropertyName

    Declaration
    public virtual string GetTreeNodeIconPropertyName { get; }
    Property Value
    Type Description
    string

    GetTreeNodeLabelPropertyName

    Returns the property on the entity type T that holds the string that should be shown as the label on the tree node for every item in the tree view control itself

    Declaration
    public abstract string GetTreeNodeLabelPropertyName { get; }
    Property Value
    Type Description
    string

    GetTreeNodeTooltipPropertyName

    Declaration
    public virtual string GetTreeNodeTooltipPropertyName { get; }
    Property Value
    Type Description
    string

    IgnoreEvents

    Declaration
    protected bool IgnoreEvents { get; set; }
    Property Value
    Type Description
    bool

    LoadedItems

    Declaration
    protected IEnumerable<T> LoadedItems { get; }
    Property Value
    Type Description
    IEnumerable<T>

    OnlyExportFromQuery

    Indicates we should not only export data from the query

    Declaration
    public bool OnlyExportFromQuery { get; }
    Property Value
    Type Description
    bool

    OnlyExportGrid

    Indicates we should not only export data from the view

    Declaration
    public bool OnlyExportGrid { get; }
    Property Value
    Type Description
    bool

    OpenFromRelatedColumnName

    Indicates that when opening an item, instead of opening the actual entity T, it should load the item linked to by this property value on the entity T

    Declaration
    public virtual string OpenFromRelatedColumnName { get; }
    Property Value
    Type Description
    string

    PagerRequired

    Indicates no pager is required, the tree view always loads all data

    Declaration
    public bool PagerRequired { get; }
    Property Value
    Type Description
    bool

    RenameHasOtherProperties

    Declaration
    protected virtual bool RenameHasOtherProperties { get; }
    Property Value
    Type Description
    bool

    Roots

    List of root nodes displayed in tree

    Declaration
    public IReadOnlyList<TreeNode<T>> Roots { get; }
    Property Value
    Type Description
    IReadOnlyList<TreeNode<T>>

    SearchColumns

    Declaration
    public IEnumerable<string> SearchColumns { get; }
    Property Value
    Type Description
    IEnumerable<string>

    SearchElements

    Declaration
    public IEnumerable<(string Name, string GroupKey, string FilterName, bool Visible)> SearchElements { get; }
    Property Value
    Type Description
    IEnumerable<(string Name, string GroupKey, string FilterName, bool Visible)>

    SearchGroups

    Declaration
    public IEnumerable<GridColumnGroup> SearchGroups { get; }
    Property Value
    Type Description
    IEnumerable<GridColumnGroup>

    SelectedItemForSubViews

    Returns the actual entity T of the currently selected tree node

    Declaration
    public override object SelectedItemForSubViews { get; }
    Property Value
    Type Description
    object
    Overrides
    ModelViewController.SelectedItemForSubViews

    TreeView

    The instance of the tree view in the client application

    Declaration
    public IBaseTreeView<T> TreeView { get; }
    Property Value
    Type Description
    IBaseTreeView<T>

    Methods

    CanMoveAsChildOfItem(T, T)

    Indicates this item is allowed to be moved to be a child of the specified parent item

    Declaration
    public virtual bool CanMoveAsChildOfItem(T moveItem, T newParentItem)
    Parameters
    Type Name Description
    T moveItem

    The item to be moved to be a child of the specified item

    T newParentItem

    The item to become a parent of the item being moved

    Returns
    Type Description
    bool

    True if the moveItem can become a chile of the specified newParentItem

    CanMoveToRoot(T)

    Indicates this item is allowed to be moved to the root of the tree

    Declaration
    public virtual bool CanMoveToRoot(T item)
    Parameters
    Type Name Description
    T item

    The item to check if it can be moved to the root

    Returns
    Type Description
    bool

    True if the item can be moved to the root of the tree and is not already there

    Clear()

    Clears the tree view

    Declaration
    public override Task Clear()
    Returns
    Type Description
    Task

    A task indicating the completion of the operation

    Overrides
    ModelViewController.Clear()

    CloseController()

    Called when a view is being closed, and before the controller is disposed.

    Used to dispose of associated commands and clear the view

    Declaration
    public override Task CloseController()
    Returns
    Type Description
    Task

    A task indicating the completion of the operation

    Overrides
    ModelViewController.CloseController()

    ColumnGroups()

    Tree views have no arbitary grouping of the data

    Declaration
    public IEnumerable<GridColumnGroup> ColumnGroups()
    Returns
    Type Description
    IEnumerable<GridColumnGroup>

    No column grouping in a tree view

    CreateCopiedNode(TreeNode<T>, TreeNode<T>)

    Declaration
    protected virtual Task<TreeNode<T>> CreateCopiedNode(TreeNode<T> original, TreeNode<T> copiedParent)
    Parameters
    Type Name Description
    TreeNode<T> original
    TreeNode<T> copiedParent
    Returns
    Type Description
    Task<TreeNode<T>>

    CreateWrapper(T, TreeNode<T>)

    Creates a TreeNode<T> for the specified item

    Declaration
    protected virtual TreeNode<T> CreateWrapper(T item, TreeNode<T> parent)
    Parameters
    Type Name Description
    T item

    The item to be wrapped in a TreeNode<T>

    TreeNode<T> parent

    An optional parent tree node this item is a child of

    Returns
    Type Description
    TreeNode<T>

    A TreeNode<T> for the specified item

    DisplayUI()

    Loads all the entities of type T for this tree view, wraps them in a TreeNode<T> and displays them in the TreeView

    Declaration
    public override Task DisplayUI()
    Returns
    Type Description
    Task

    A task indicating the completion of the operation

    Overrides
    ModelViewController.DisplayUI()

    GetExportableColumnInfo(IEnumerable<ColumnDescriptor>)

    Returns all properties of the entity type T as being exportable

    Declaration
    public Task<IEnumerable<ControlDisplayVisibilityInfo>> GetExportableColumnInfo(IEnumerable<ColumnDescriptor> visibleColumns)
    Parameters
    Type Name Description
    IEnumerable<ColumnDescriptor> visibleColumns

    A list of current visible properties for the tree nodes

    Returns
    Type Description
    Task<IEnumerable<ControlDisplayVisibilityInfo>>

    All properties and their visibility status for exporting the entities in the tree view

    GetIDValue(T)

    Declaration
    public abstract Guid GetIDValue(T item)
    Parameters
    Type Name Description
    T item
    Returns
    Type Description
    Guid

    GetQueryForExcelResults()

    Returns the query used to load all the entities in the tree view display

    Declaration
    public virtual QueryableExecuter GetQueryForExcelResults()
    Returns
    Type Description
    QueryableExecuter

    GetTreeController(IBaseTreeView<T>)

    Creates a new tree view controller with the specified instance of a tree view

    Declaration
    public static BaseTreeViewAnyController<T> GetTreeController(IBaseTreeView<T> view)
    Parameters
    Type Name Description
    IBaseTreeView<T> view

    The instance of the tree view in the client application

    Returns
    Type Description
    BaseTreeViewAnyController<T>

    A tree view controller that has the same name as the specified ViewControllerName of the Descriptor on the provided view

    GetVisibleColumnNames()

    Returns all properties of the entity type T as being exportable

    Declaration
    public Task<IEnumerable<ControlDisplayInfo>> GetVisibleColumnNames()
    Returns
    Type Description
    Task<IEnumerable<ControlDisplayInfo>>

    All properties of the entity type T as being exportable

    HasLazyChildrenToLoad(TreeNode<T>)

    Declaration
    public virtual bool HasLazyChildrenToLoad(TreeNode<T> item)
    Parameters
    Type Name Description
    TreeNode<T> item
    Returns
    Type Description
    bool

    InitCommands(IList<ViewCommand>)

    Adds the following commands: Open, New, Delete, MoveUp, MoveDown, and Export Data

    Declaration
    protected override void InitCommands(IList<ViewCommand> commands)
    Parameters
    Type Name Description
    IList<ViewCommand> commands

    The initial set of commands

    Overrides
    ModelViewController.InitCommands(IList<ViewCommand>)

    LazyLoadChildren(TreeNode<T>)

    Declaration
    public virtual Task<IEnumerable<TreeNode<T>>> LazyLoadChildren(TreeNode<T> node)
    Parameters
    Type Name Description
    TreeNode<T> node
    Returns
    Type Description
    Task<IEnumerable<TreeNode<T>>>

    LoadDataForCopyingNode(TreeNode<T>)

    Declaration
    protected virtual Task LoadDataForCopyingNode(TreeNode<T> node)
    Parameters
    Type Name Description
    TreeNode<T> node
    Returns
    Type Description
    Task

    LoadItems()

    The method used by DisplayUI() to load all the entities for this tree view

    Declaration
    protected virtual Task<IEnumerable<T>> LoadItems()
    Returns
    Type Description
    Task<IEnumerable<T>>

    The list of loaded entities to be displayed in the tree view

    OnDeleteItem(T)

    Removes the specified item from the internal tree node collection.

    You still have to call RedisplayNode(TreeNode<T>)

    Declaration
    protected virtual void OnDeleteItem(T newItem)
    Parameters
    Type Name Description
    T newItem

    The item being deleted from this treenode collection

    OnNodeMoved(TreeNode<T>, TreeNode<T>, TreeNode<T>)

    Called when a tree node has been moved to allow any modifications to the old/new parent and sub items of the moved tree node

    Declaration
    public virtual void OnNodeMoved(TreeNode<T> oldParent, TreeNode<T> newParent, TreeNode<T> movedItem)
    Parameters
    Type Name Description
    TreeNode<T> oldParent

    The old parent of this tree node

    TreeNode<T> newParent

    The new parent for this tree node

    TreeNode<T> movedItem

    The tree node that was mvoed

    OnSelectionChanged(object, EventArgs)

    Occurs when the TreeView fires its SelectionChanged event

    Declaration
    protected void OnSelectionChanged(object sender, EventArgs e)
    Parameters
    Type Name Description
    object sender

    The TreeView

    EventArgs e

    The event arguments for the selection changed event

    OpenItem(T)

    Opens the specified entity in a new IModelLayoutDisplayer

    Declaration
    public virtual Task OpenItem(T item)
    Parameters
    Type Name Description
    T item

    The item in the tree view to open

    Returns
    Type Description
    Task

    A task indicating the completion of the operation

    PromptForItemLabel(T)

    Declaration
    public virtual Task PromptForItemLabel(T item)
    Parameters
    Type Name Description
    T item
    Returns
    Type Description
    Task

    SetSearch(string, IEnumerable<string>)

    Declaration
    public void SetSearch(string search, IEnumerable<string> columns)
    Parameters
    Type Name Description
    string search
    IEnumerable<string> columns

    ToggleSearch(bool)

    Declaration
    public void ToggleSearch(bool visible)
    Parameters
    Type Name Description
    bool visible

    UpdateNewItem(T)

    Updates the newly created item to be a child of the currently selected tree node in the TreeView if there is a current treenode selected

    Declaration
    protected virtual Task UpdateNewItem(T newItem)
    Parameters
    Type Name Description
    T newItem

    The new item to be updated as being a child of the currently selected tree node in the tree view

    Returns
    Type Description
    Task

    UpdateRootCopiedNode(TreeNode<T>, TreeNode<T>)

    Declaration
    protected virtual Task UpdateRootCopiedNode(TreeNode<T> original, TreeNode<T> item)
    Parameters
    Type Name Description
    TreeNode<T> original
    TreeNode<T> item
    Returns
    Type Description
    Task

    WrapAsTreeNodes(TreeNode<T>, IEnumerable<T>)

    Declaration
    public IEnumerable<TreeNode<T>> WrapAsTreeNodes(TreeNode<T> parent, IEnumerable<T> allItems)
    Parameters
    Type Name Description
    TreeNode<T> parent
    IEnumerable<T> allItems
    Returns
    Type Description
    IEnumerable<TreeNode<T>>

    WrapAsTreeNodes(IEnumerable<T>)

    The method used by DisplayUI() to enumerate all the items to be displayed in the tree view and wrap them in a TreeNode<T>

    Determines the root tree node entities while doing so

    Declaration
    protected virtual IEnumerable<TreeNode<T>> WrapAsTreeNodes(IEnumerable<T> items)
    Parameters
    Type Name Description
    IEnumerable<T> items

    All the entities to be displayed in a tree view

    Returns
    Type Description
    IEnumerable<TreeNode<T>>

    The collection of root (top level) tree nodes with no parent, that in turn contain all the other items in the tree view as their children

    Implements

    ICollectionExportable
    ISearchController
    IModelViewController

    Extension Methods

    LinqExtensions.AsArray<T>(T)
    LinqExtensions.ToArrayOfOne<T>(T)
    LinqExtensions.ToListOfOne<T>(T)
    MiscExtensions.SetIfNotEqual<T, TP>(T, Expression<Func<T, TP>>, TP)
    WeakReferenceExtensions.WeakReference(object)
    SQLExtensions.ToSQLValue(object, bool)
    ReflectionExtensions.ClearEventInvocations(object, string)
    StringExtensions.ToCSVFormatString(object, Type)
    In this article
    Back to top © LemonEdge Technologies. All rights reserved.