Class BaseDefaultSingleViewController<T>
The core controller for handling the IBaseDefaultSingleView<T> view
This is the main controller for creating a view with custom controls for editing any specified entity of type T
Inheritance
Implements
Inherited Members
Namespace: LemonEdge.Client.Core.Views.Core
Assembly: ClientCore.dll
Syntax
public abstract class BaseDefaultSingleViewController<T> : ModelViewController, IModelViewController where T : IBaseEntity
Type Parameters
Name | Description |
---|---|
T | The entity type to be displayed and edited by this controller |
Constructors
BaseDefaultSingleViewController(IBaseDefaultSingleView<T>)
Creates a new default single view controller with the specified instance of a default single view
Declaration
public BaseDefaultSingleViewController(IBaseDefaultSingleView<T> view)
Parameters
Type | Name | Description |
---|---|---|
IBaseDefaultSingleView<T> | view | The instance of the default single view in the client application |
Properties
Descriptor
The entity descriptor for the entity type T
that this view is displaying/editing
Declaration
public EntityDescriptor Descriptor { get; }
Property Value
Type | Description |
---|---|
EntityDescriptor |
HasParentToAnyRelationship
Returns true if this entiy type T
has a property that can point to any entity in the system
Declaration
protected bool HasParentToAnyRelationship { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
SingleItem
The instance of the entity of type T
that this controller is displaying/editing
Declaration
public T SingleItem { get; }
Property Value
Type | Description |
---|---|
T |
SingleView
The instance of the default single view in the client application
Declaration
public IBaseDefaultSingleView<T> SingleView { get; }
Property Value
Type | Description |
---|---|
IBaseDefaultSingleView<T> |
TrackItemChanges
We check changes if HasParentToAnyRelationship is true
Declaration
public override bool TrackItemChanges { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Overrides
ViewColumnCount
Indicates the maximum number of columns that controls should be laid out with in the client application ui as a grid
The default is null, indicating the controls are not to be laid out in a grid style
Declaration
public virtual int? ViewColumnCount { get; }
Property Value
Type | Description |
---|---|
System.Nullable<System.Int32> |
ViewDisplayType
Indicates how the controls should be laid out in the client application ui for the view (in compatabile UIs)
The default is HorizontalWrapPanel
Declaration
public virtual CustomViewDisplayType ViewDisplayType { get; }
Property Value
Type | Description |
---|---|
CustomViewDisplayType |
ViewMaxHeight
Indicates the max height this view should take up in its provided area within the LayoutDescriptorGroup in the client application UI
The default is null, indicating it should take up all allocated space
Declaration
public virtual int? ViewMaxHeight { get; }
Property Value
Type | Description |
---|---|
System.Nullable<System.Int32> |
ViewMaxWidth
Indicates the max width this view should take up in its provided area within the LayoutDescriptorGroup in the client application UI
The default is null, indicating it should take up all allocated space
Declaration
public virtual int? ViewMaxWidth { get; }
Property Value
Type | Description |
---|---|
System.Nullable<System.Int32> |
ViewRowCount
Indicates the maximum number of rows that controls should be laid out with in the client application ui as a grid
The default is null, indicating the controls are not to be laid out in a grid style
Declaration
public virtual int? ViewRowCount { get; }
Property Value
Type | Description |
---|---|
System.Nullable<System.Int32> |
Methods
AlterControlInfo(ControlDisplayInfo)
Automatically assigns relationship control info and other work for controls from the entity definition itself
Provides inheriting classes the option to tailor any control as much as they like before it is created in the SingleView
Declaration
protected virtual void AlterControlInfo(ControlDisplayInfo info)
Parameters
Type | Name | Description |
---|---|---|
ControlDisplayInfo | info | The control definition to be altered |
ControlNames()
A list of all the controls to be dynamically created in the SingleView
This is used by the system to create the actual ControlDisplayInfo classes required from the Controls() property
You can override this to provide a simple definition of each control (combined with AlterControlInfo(ControlDisplayInfo) for more detail), or you can just override Controls() and ignore thisDeclaration
protected virtual IEnumerable<ControlDisplayInfoLight> ControlNames()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<ControlDisplayInfoLight> | A list of all the controls to be dynamically created in the SingleView |
Controls()
A list of all the controls to be dynamically created in the SingleView
Can be overridden by the inheriting class to indicate the controls required. Typically you can override ControlNames() for a lighter approach and AlterControlInfo(ControlDisplayInfo) for any specific detail
Declaration
protected virtual IEnumerable<ControlDisplayInfo> Controls()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<ControlDisplayInfo> | A list of all the controls to be dynamically created in the SingleView |
DisplayUI()
Loads all the controls dynamically into the SingleView if they haven't been already, loads the item to be displayed and then displays it against the view itself
Declaration
public override Task DisplayUI()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
Overrides
GetControlDescriptor(String)
Returns the property definiton of the specified propName
against the entity T
type
Declaration
protected virtual ColumnDescriptor GetControlDescriptor(string propName)
Parameters
Type | Name | Description |
---|---|---|
System.String | propName | The name of the property on the |
Returns
Type | Description |
---|---|
ColumnDescriptor | The property definiton of the specified |
GetSingleViewController(IBaseDefaultSingleView<T>, String)
Creates the new default single view controller with the specified instance of a default single view
If the view has a SingleViewControllerCustomViewParams parameter then this will return the BaseDefaultSingleViewCustomController<T> for loading custom views from a ICustomView definition
Declaration
public static BaseDefaultSingleViewController<T> GetSingleViewController(IBaseDefaultSingleView<T> view, string controllerName = null)
Parameters
Type | Name | Description |
---|---|---|
IBaseDefaultSingleView<T> | view | The instance of the default single view in the client application |
System.String | controllerName | The specific name of the controller to look for when creating it |
Returns
Type | Description |
---|---|
BaseDefaultSingleViewController<T> | A new default single view controller with the specified instance of a default single view that matches the specified |
InitAsync()
Declaration
public override Task InitAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
Overrides
LoadControls()
Provides an inheriting class an opportunity to load the controls this view should display dynamically
Declaration
public virtual Task LoadControls()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A task indicating the completion of the operation |
LoadSingleItem()
Provides an inheriting class the opportunity to load the single entity item this view should display
Declaration
public virtual Task<T> LoadSingleItem()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<T> | The instance of the entity of type |
OnTrackedItemChanged(Object, String)
If HasParentToAnyRelationship is true then it will update the control holding that relationship value to keep changes in sync in the views to the user
Declaration
protected override void OnTrackedItemChanged(object item, string propName)
Parameters
Type | Name | Description |
---|---|---|
System.Object | item | The item that had a property changed |
System.String | propName | The name of the changed property |
Overrides
SetAndLoadSingleItem()
Loads the item to be displayed by this view (via LoadSingleItem()) and sets it as the SingleItem value for this view
Declaration
public Task SetAndLoadSingleItem()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A task indicating the completion of the operation |