Class NewItemDescriptor<T>
A default implementation of INewItemHelper<T> designed to help controllers using the NewGridItem<T> command to provide a mechanism for overriding the behaviour of creating new items in the grid
Implements
Inherited Members
Namespace: LemonEdge.Client.Core.Commands.ViewCommands
Assembly: ClientCore.dll
Syntax
public class NewItemDescriptor<T> : INewItemHelper<T> where T : IBaseEntity
Type Parameters
Name | Description |
---|---|
T | The type of new entity type to create |
Constructors
NewItemDescriptor()
Creates a new NewItemDescriptor default implementation
Declaration
public NewItemDescriptor()
Properties
Descriptor
Holds the EntityDescriptor of the entity type T
Declaration
public EntityDescriptor Descriptor { get; }
Property Value
Type | Description |
---|---|
EntityDescriptor |
ItemName
The singlular name of the item to be created.
Default implementation is the ItemName of the entity type T
Declaration
public virtual string ItemName { get; }
Property Value
Type | Description |
---|---|
System.String |
OverlayIconID
The default icon to overlay over the new image for the command to create a new entity of type T
Default implementation is the DefaultIconID of the entity type T
Declaration
public Guid? OverlayIconID { get; }
Property Value
Type | Description |
---|---|
System.Nullable<System.Guid> |
Methods
CanCreate(UserInfo, IReadOnlyCache)
Returns true if the user has permissions to create a new entity of type T
Declaration
public Task<bool> CanCreate(UserInfo userInfo, IReadOnlyCache cache)
Parameters
Type | Name | Description |
---|---|---|
UserInfo | userInfo | The currently logged in user |
IReadOnlyCache | cache | A local cache |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Boolean> | True if the user has permissions to create a new entity of type |
CreateNewItem(UserInfo, IReadOnlyCache, IEntityUpdater)
Creates a single new entity of type T
and inserts it into the entity collection view (typically a grid)
Declaration
public virtual Task<IEnumerable<T>> CreateNewItem(UserInfo userInfo, IReadOnlyCache cache, IEntityUpdater updater)
Parameters
Type | Name | Description |
---|---|---|
UserInfo | userInfo | The current logged in user |
IReadOnlyCache | cache | A local cache |
IEntityUpdater | updater | The context the items are being created in and can be added to |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<T>> | A list of the newly created items. |
GetOpenDescriptor(IEntityUpdaterUI, T)
Returns the descriptor used for displaying the new item in a new tab context in the application
Declaration
public Task<DisplayableItemDescriptor> GetOpenDescriptor(IEntityUpdaterUI updater, T item)
Parameters
Type | Name | Description |
---|---|---|
IEntityUpdaterUI | updater | The current context the new item has been created within |
T | item | The new item itself that should be displayed in its own tab layout |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<DisplayableItemDescriptor> | A descriptor used for displaying the new item in a new tab context in the application |
MarkForInsert(IEntityUpdaterUI, T)
Marks the specified item as a new pending change in the updater
context
Declaration
public void MarkForInsert(IEntityUpdaterUI updater, T item)
Parameters
Type | Name | Description |
---|---|---|
IEntityUpdaterUI | updater | The updater context the new items are being created in |
T | item | The newly created entity |