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: LemonEdge.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
protected 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 virtual EntityDescriptor Descriptor { get; }
Property Value
| Type | Description |
|---|---|
| EntityDescriptor |
HasParentToAnyRelationship
Returns true if this entity type T has a property that can point to any entity in the system
Declaration
protected bool HasParentToAnyRelationship { get; }
Property Value
| Type | Description |
|---|---|
| bool |
ListenToChanges
We check changes if HasParentToAnyRelationship is true
Declaration
public override bool ListenToChanges { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Overrides
SelectedItemForSubViews
Returns the item this view holds that can be passed to sub views
This controller can change the item is passes to sub views (such as when this represents the selected item in a grid) by calling UpdateSubViews(IModelView, bool)
Declaration
public override object SelectedItemForSubViews { get; }
Property Value
| Type | Description |
|---|---|
| object |
Overrides
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> |
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 |
|---|---|
| int? |
ViewDisplayType
Indicates how the controls should be laid out in the client application ui for the view (in compatible 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 |
|---|---|
| int? |
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 |
|---|---|
| int? |
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 |
|---|---|
| int? |
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 |
|---|---|
| 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 |
|---|---|
| IEnumerable<ControlDisplayInfo> | A list of all the controls to be dynamically created in the SingleView |
DecrementControlCheck()
Declaration
public void DecrementControlCheck()
DisplayControlItem(ControlDisplayInfo, T)
Declaration
public virtual Task DisplayControlItem(ControlDisplayInfo control, T item)
Parameters
| Type | Name | Description |
|---|---|---|
| ControlDisplayInfo | control | |
| T | item |
Returns
| Type | Description |
|---|---|
| Task |
DisplayFormulaItem(ControlDisplayInfo, T)
Declaration
protected virtual Task DisplayFormulaItem(ControlDisplayInfo control, T item)
Parameters
| Type | Name | Description |
|---|---|---|
| ControlDisplayInfo | control | |
| T | item |
Returns
| Type | Description |
|---|---|
| Task |
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 |
|---|---|
| Task |
Overrides
GetControlDescriptor(EntityDescriptor, string)
Returns the property definition of the specified propName against the entity
T type
Declaration
protected virtual ColumnDescriptor GetControlDescriptor(EntityDescriptor desc, string propName)
Parameters
| Type | Name | Description |
|---|---|---|
| EntityDescriptor | desc | |
| string | propName | The name of the property on the |
Returns
| Type | Description |
|---|---|
| ColumnDescriptor | The property definition of the specified |
GetControlEntityDescriptor(string)
Declaration
protected virtual EntityDescriptor GetControlEntityDescriptor(string propName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | propName |
Returns
| Type | Description |
|---|---|
| EntityDescriptor |
GetControls()
Declaration
public IEnumerable<ControlDisplayInfo> GetControls()
Returns
| Type | Description |
|---|---|
| IEnumerable<ControlDisplayInfo> |
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 |
| 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 |
IncrementControlCheck(int)
Declaration
public bool IncrementControlCheck(int checkVal)
Parameters
| Type | Name | Description |
|---|---|---|
| int | checkVal |
Returns
| Type | Description |
|---|---|
| bool |
InitAsync()
Provides the controller a chance to initialize any dependant data. Called once by the system after controller creation.
Declaration
public override Task InitAsync()
Returns
| Type | Description |
|---|---|
| Task | A task indicating the completion of the operation |
Overrides
InitCommands(IList<ViewCommand>)
Provides the inheriting class an opportunity to add custom commands to this controller
Declaration
protected override void InitCommands(IList<ViewCommand> commands)
Parameters
| Type | Name | Description |
|---|---|---|
| IList<ViewCommand> | commands | The current set of commands for this controller |
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 |
|---|---|
| Task | A task indicating the completion of the operation |
LoadExtendedItem(Type)
Declaration
public Task<IBaseEntity> LoadExtendedItem(Type t)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | t |
Returns
| Type | Description |
|---|---|
| Task<IBaseEntity> |
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 |
|---|---|
| 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 |
|---|---|---|
| object | item | The item that had a property changed |
| string | propName | The name of the changed property |
Overrides
ProcessCustomCommandResult(object)
Declaration
protected virtual Task ProcessCustomCommandResult(object result)
Parameters
| Type | Name | Description |
|---|---|---|
| object | result |
Returns
| Type | Description |
|---|---|
| Task |
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 |
|---|---|
| Task | A task indicating the completion of the operation |