Search Results for

    Show / Hide Table of Contents

    Class BaseTreeViewController<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
    System.Object
    ModelViewController
    BaseTreeViewController<T>
    BaseTreeViewRelatedController<SI, T>
    Implements
    IModelViewController
    ICollectionExportable
    Inherited Members
    ModelViewController.CurrentDisplayedItem
    ModelViewController.CanWrite
    ModelViewController.TrackItemChanges
    ModelViewController.CheckIsLockedForCanWrite
    ModelViewController.View
    ModelViewController.InitAsync()
    ModelViewController.OnTrackedItemChanged(Object, String)
    ModelViewController.DisplayItem(Object)
    ModelViewController.ShouldDisplayItem(Object)
    ModelViewController.DisplayIfNull
    ModelViewController.Redisplay()
    ModelViewController.RemoveHandlers(Object)
    ModelViewController.AddHandlers(Object)
    ModelViewController.CloseController()
    ModelViewController.RemoveCommand(ViewCommand)
    ModelViewController.RemoveCommands<OFType>()
    ModelViewController.InsertCommand(ViewCommand, Int32)
    ModelViewController.InsertCommand(ViewCommand, ViewCommand, ViewCommand)
    ModelViewController.Commands
    ModelViewController.UpdateAllCommands()
    ModelViewController.ContextHelpURL
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: LemonEdge.Client.Core.Views.Core
    Assembly: ClientCore.dll
    Syntax
    public abstract class BaseTreeViewController<T> : ModelViewController, IModelViewController, ICollectionExportable where T : IBaseEntity
    Type Parameters
    Name Description
    T

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

    Constructors

    BaseTreeViewController(IBaseTreeView<T>)

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

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

    The instance of the tree view in the client application

    Properties

    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
    System.Boolean

    CollectionType

    Indicates we export a collection of entities of type T

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

    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
    System.Boolean

    CommandDeleteCanDelete

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

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

    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
    System.Boolean

    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
    System.Boolean

    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
    System.Boolean

    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
    System.Boolean

    CurrentGridItems

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

    Declaration
    public IEnumerable CurrentGridItems { get; }
    Property Value
    Type Description
    System.Collections.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

    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
    System.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
    System.String

    OnlyExportFromQuery

    Indicates we should not only export data from the query

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

    OnlyExportGrid

    Indicates we should not only export data from the view

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

    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
    System.String

    PagerRequired

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

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

    Roots

    List of root nodes displayed in tree

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

    SelectedItemForSubViews

    Returns the actual entity T of the currently selected tree node

    Declaration
    public override object SelectedItemForSubViews { get; }
    Property Value
    Type Description
    System.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

    AlterQuery(QueryableExecuter<T>)

    Provides an inheriting class the oportunity to alter the default query with custom options

    Declaration
    protected virtual QueryableExecuter<T> AlterQuery(QueryableExecuter<T> query)
    Parameters
    Type Name Description
    QueryableExecuter<T> query

    The default query to load all the entities for

    Returns
    Type Description
    QueryableExecuter<T>

    The query to load all the relevant tree view entities with

    Clear()

    Clears the tree view

    Declaration
    public override Task Clear()
    Returns
    Type Description
    System.Threading.Tasks.Task

    A task indicating the completion of the operation

    Overrides
    ModelViewController.Clear()

    ColumnGroups()

    Tree views have no arbitary grouping of the data

    Declaration
    public IEnumerable<GridColumnGroup> ColumnGroups()
    Returns
    Type Description
    System.Collections.Generic.IEnumerable<GridColumnGroup>

    No column grouping in a tree view

    CreateNewItem()

    Creates a new entity of type T

    Declaration
    protected virtual Task<T> CreateNewItem()
    Returns
    Type Description
    System.Threading.Tasks.Task<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
    System.Threading.Tasks.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
    System.Collections.Generic.IEnumerable<ColumnDescriptor> visibleColumns

    A list of current visible properties for the tree nodes

    Returns
    Type Description
    System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<ControlDisplayVisibilityInfo>>

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

    GetQuery()

    Returns the query to load all the entities of type T in to the tree view with

    If the ItemParams has a DisplayableItemDescriptorForCollectionParams to filter the result set by then this is also included in the returned query

    Declaration
    protected virtual QueryableExecuter<T> GetQuery()
    Returns
    Type Description
    QueryableExecuter<T>

    The query to load all the relevant tree view entities with

    GetQueryForExcelResults()

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

    Declaration
    public 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 BaseTreeViewController<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
    BaseTreeViewController<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
    System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<ControlDisplayInfo>>

    All properties of the entity type T as being exportable

    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
    System.Collections.Generic.IList<ViewCommand> commands

    The initial set of commands

    Overrides
    ModelViewController.InitCommands(IList<ViewCommand>)

    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
    System.Threading.Tasks.Task<System.Collections.Generic.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

    OnSelectionChanged(Object, EventArgs)

    Occurs when the TreeView fires its SelectionChanged event

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

    The TreeView

    System.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
    System.Threading.Tasks.Task

    A task indicating the completion of the operation

    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 void 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

    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
    System.Collections.Generic.IEnumerable<T> items

    All the entities to be displayed in a tree view

    Returns
    Type Description
    System.Collections.Generic.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

    IModelViewController
    ICollectionExportable

    Extension Methods

    MiscExtensions.SetIfNotEqual<T, P>(T, Expression<Func<T, P>>, P)
    ReflectionExtensions.ClearEventInvocations(Object, String)
    StringExtensions.ToCSVFormatString(Object, Type)
    SQLExtensions.ToSQLValue(Object, Boolean)
    In This Article
    Back to top © LemonTree Software Ltd. All rights reserved.