Table of Contents

Class IUIViewExtensions

Namespace
GroupeIsa.Neos.Designer.UIAbstractions
Assembly
GroupeIsa.Neos.Designer.UIAbstractions.dll

Represents an extension of IUIView.

[ExcludeFromCodeCoverage]
[SuppressMessage("StyleCop.CSharp.ReadabilityRules", "S101:Parameter should not span multiple lines", Justification = "Test")]
public static class IUIViewExtensions
Inheritance
IUIViewExtensions
Inherited Members

Methods

AcceptChanges(IUIView)

Accepts all changes. Current changes are accepted. Original values can no longer be restored. A new item is no longer new. A virtual item is no longer virtual.

public static void AcceptChanges(this IUIView uiView)

Parameters

uiView IUIView

Item.

AcceptPropertyChange(IUIView, string)

Accepts the change made to the specified property. The current value is kept, the original value can no longer be restored for this property.

public static void AcceptPropertyChange(this IUIView uiView, string propertyName)

Parameters

uiView IUIView

Item.

propertyName string

The property name.

AcceptPropertyChange<TUIView, TProperty>(TUIView, Expression<Func<TUIView, TProperty>>)

Accepts the change made to the specified property. The current value is kept, the original value can no longer be restored for this property.

public static void AcceptPropertyChange<TUIView, TProperty>(this TUIView uiView, Expression<Func<TUIView, TProperty>> propertyExpression) where TUIView : IUIView

Parameters

uiView TUIView

Item.

propertyExpression Expression<Func<TUIView, TProperty>>

An expression selecting the property, e.g. x => x.MyProperty.

Type Parameters

TUIView

Type of the UI view.

TProperty

Type of the property.

AddValidationMessage(IUIView, UIValidationMessage)

Adds a validation message.

public static void AddValidationMessage(this IUIView uiView, UIValidationMessage validationMessage)

Parameters

uiView IUIView

Item.

validationMessage UIValidationMessage

Validation message.

ClearPropertyValidationMessages(IUIView, string)

Clears the validation messages of a property.

public static void ClearPropertyValidationMessages(this IUIView uiView, string propertyName)

Parameters

uiView IUIView

Item.

propertyName string

Property name.

ClearValidationMessages(IUIView)

Clears the validation messages.

public static void ClearValidationMessages(this IUIView uiView)

Parameters

uiView IUIView

Item.

Clone(IUIView)

Clones this instance.

public static IUIView Clone(this IUIView uiView)

Parameters

uiView IUIView

UI view.

Returns

IUIView

A cloned instance.

GetInvalidValue(IUIView, string)

Get the invalid value of a property.

public static string? GetInvalidValue(this IUIView uiView, string propertyName)

Parameters

uiView IUIView

UI view.

propertyName string

Property name.

Returns

string

Invalid value of the property.

GetKeyValues(IUIView)

Gets the values of the key of the item.

public static object[] GetKeyValues(this IUIView uiView)

Parameters

uiView IUIView

Item.

Returns

object[]

The values of the key of the item.

GetLookupDisplayValueAsync<TDisplayProperty>(IUIView, string)

Gets the value displayed in the lookup of a property.

public static Task<TDisplayProperty?> GetLookupDisplayValueAsync<TDisplayProperty>(this IUIView uiView, string propertyWithLookup)

Parameters

uiView IUIView

UI view.

propertyWithLookup string

Property with lookup.

Returns

Task<TDisplayProperty>

Value displayed in the lookup of the property. This corresponds to the display property when one is configured on the lookup; otherwise the value of the property.

Type Parameters

TDisplayProperty

Type of the display property of the lookup.

Remarks

This is different from getting the value of the property. Throws an exception when the property does not have a lookup.

GetOriginalOrCurrentValue<T>(IUIView, string)

Get the original or current value of property name.

public static T GetOriginalOrCurrentValue<T>(this IUIView uiView, string propertyName)

Parameters

uiView IUIView

Item.

propertyName string

The property name.

Returns

T

The original value if the property has been changed, the current value otherwise.

Type Parameters

T

Value type.

Remarks

If you need to verify beforehand whether an original value exists for the specified property, consider using the HasOriginalValue(IUIView, string) method.

GetOriginalValue(IUIView, string)

Get the original value of property name.

public static object GetOriginalValue(this IUIView uiView, string propertyName)

Parameters

uiView IUIView

Item.

propertyName string

The property name.

Returns

object

The original value if the property has been changed, null otherwise.

Remarks

If you need to verify beforehand whether an original value exists for the specified property, consider using the HasOriginalValue(IUIView, string) method.

GetPersistenceError(IUIView)

Gets the API error if the item persistence item has failed.

public static IApiError? GetPersistenceError(this IUIView uiView)

Parameters

uiView IUIView

Item.

Returns

IApiError

API Error.

GetRowVersion(IUIView)

Gets the current row version of the item, used for optimistic concurrency (e.g. when passing it to a ServerMethod).

public static string GetRowVersion(this IUIView uiView)

Parameters

uiView IUIView

Item.

Returns

string

The row version, as a hexadecimal string.

Remarks

The row version is an opaque concurrency token, never meant to be inspected byte by byte: it is exposed as a hexadecimal string (the same representation already used on the wire), so it can be passed straight through as a ServerMethod string parameter with no conversion. A ServerMethod that needs the actual byte[] (e.g. to call SetOriginalValue) converts it explicitly, typically via ByteArrayHexJsonConverter.FromHexString.

GetValidationMessages(IUIView)

Gets the validation messages (Errors, Warnings, Informations).

public static UIValidationMessage[] GetValidationMessages(this IUIView uiView)

Parameters

uiView IUIView

Item.

Returns

UIValidationMessage[]

Validation messages (Errors, Warnings, Informations).

GetValue<T>(IUIView, string)

Get the value of a property.

public static T GetValue<T>(this IUIView uiView, string propertyName)

Parameters

uiView IUIView

UI view.

propertyName string

Property name.

Returns

T

Value of the property.

Type Parameters

T

Value type.

HasChanges(IUIView)

Gets the value indicating whether the item has changes.

public static bool HasChanges(this IUIView uiView)

Parameters

uiView IUIView

Item.

Returns

bool

Value indicating whether the item has changes.

Remarks

The update of this indicator takes into account the modification (addition/deletion) of the embedded collections in the case of a master/detail model.

HasOriginalValue(IUIView, string)

Gets the value indicating whether the item has an original value.

public static bool HasOriginalValue(this IUIView uiView, string propertyName)

Parameters

uiView IUIView

Item.

propertyName string

The property name.

Returns

bool

True if the original value has a value.

Remarks

To retrieve the original value of the specified property, use the GetOriginalValue(IUIView, string) method.

HasPropertyChange(IUIView, string)

Gets a value indicating whether the specified property of the item has been changed.

public static bool HasPropertyChange(this IUIView uiView, string propertyName)

Parameters

uiView IUIView

Item.

propertyName string

The property name.

Returns

bool

True if the property has been changed.

HasPropertyChange<TUIView, TProperty>(TUIView, Expression<Func<TUIView, TProperty>>)

Gets a value indicating whether the specified property of the item has been changed.

public static bool HasPropertyChange<TUIView, TProperty>(this TUIView uiView, Expression<Func<TUIView, TProperty>> propertyExpression) where TUIView : IUIView

Parameters

uiView TUIView

Item.

propertyExpression Expression<Func<TUIView, TProperty>>

An expression selecting the property, e.g. x => x.MyProperty.

Returns

bool

True if the property has been changed.

Type Parameters

TUIView

Type of the UI view.

TProperty

Type of the property.

IsNew(IUIView)

Gets the value indicating whether the item is new.

public static bool IsNew(this IUIView uiView)

Parameters

uiView IUIView

Item.

Returns

bool

Value indicating whether the item is new.

IsVirtual(IUIView)

Gets the value indicating whether the item is virtual.

public static bool IsVirtual(this IUIView uiView)

Parameters

uiView IUIView

Item.

Returns

bool

Value indicating whether the item is virtual.

MarkAsNew(IUIView)

Marks item as new.

public static void MarkAsNew(this IUIView uiView)

Parameters

uiView IUIView

Items.

MarkAsVirtual(IUIView)

Marks an item as virtual.

Clears all original values and sets the item as unchanged.
If no changes are made to the item after marking it as virtual, it is ignored when validating data and saving.

public static void MarkAsVirtual(this IUIView uiView)

Parameters

uiView IUIView

Item.

RejectChanges(IUIView)

Rejects all changes. Original values are restored.

public static void RejectChanges(this IUIView uiView)

Parameters

uiView IUIView

Item.

RejectPropertyChange(IUIView, string)

Rejects the change made to the specified property. The original value is restored for this property only, other properties are left untouched.

public static void RejectPropertyChange(this IUIView uiView, string propertyName)

Parameters

uiView IUIView

Item.

propertyName string

The property name.

RejectPropertyChange<TUIView, TProperty>(TUIView, Expression<Func<TUIView, TProperty>>)

Rejects the change made to the specified property. The original value is restored for this property only, other properties are left untouched.

public static void RejectPropertyChange<TUIView, TProperty>(this TUIView uiView, Expression<Func<TUIView, TProperty>> propertyExpression) where TUIView : IUIView

Parameters

uiView TUIView

Item.

propertyExpression Expression<Func<TUIView, TProperty>>

An expression selecting the property, e.g. x => x.MyProperty.

Type Parameters

TUIView

Type of the UI view.

TProperty

Type of the property.

RemoveValidationMessage(IUIView, UIValidationMessage)

Removes a validation message.

public static void RemoveValidationMessage(this IUIView uiView, UIValidationMessage validationMessage)

Parameters

uiView IUIView

Item.

validationMessage UIValidationMessage

Validation message.

ResumeChangeTracking(IUIView, bool)

Resume the change tracking. In order to manage call stack when nested calls are made, you need to call ResumeChangeTracking(IUIView, bool) method exactly the same number of times as the SuspendChangeTracking(IUIView) method. To force the resume of the change tracking, you can call the ResumeChangeTracking(IUIView, bool) method with the forceResume parameter set to true.

public static bool ResumeChangeTracking(this IUIView uiView, bool forceResume = false)

Parameters

uiView IUIView

Item.

forceResume bool

Force the resume of the change tracking.

Returns

bool

True if the change tracking has been resumed.

SetRowVersion(IUIView, string)

Sets the row version of the item, typically after a ServerMethod call returns an updated value.

public static void SetRowVersion(this IUIView uiView, string rowVersion)

Parameters

uiView IUIView

Item.

rowVersion string

The new row version, as a hexadecimal string.

Remarks

See GetRowVersion(IUIView): the row version is an opaque hexadecimal string, not a byte[].

SetValue(IUIView, string, object)

Set the value of a property.

public static void SetValue(this IUIView uiView, string propertyName, object value)

Parameters

uiView IUIView

UI view.

propertyName string

Property name.

value object

Value.

SuspendChangeTracking(IUIView)

Suspends the change tracking. In order to manage call stack when nested calls are made, you need to call ResumeChangeTracking(IUIView, bool) method exactly the same number of times as the SuspendChangeTracking(IUIView) method.

public static void SuspendChangeTracking(this IUIView uiView)

Parameters

uiView IUIView

Item.

ToApiRequestData(IUIView)

Converts the item to a serializable object.

public static IUIView ToApiRequestData(this IUIView uiView)

Parameters

uiView IUIView

UI view.

Returns

IUIView

A json string.

TrySetLookupValueAsync<TValue>(IUIView, string, TValue?)

Tries to set the value of a property with lookup. If value is not part of the valid values of the lookup, the value of propertyWithLookup is not changed and the method returns false.

public static Task<bool> TrySetLookupValueAsync<TValue>(this IUIView uiView, string propertyWithLookup, TValue? value)

Parameters

uiView IUIView

UI view.

propertyWithLookup string

Property with lookup.

value TValue

Value to try to affect to the property.

Returns

Task<bool>

true when value is valid and has been changed; otherwise false.

Type Parameters

TValue

Type of the value of the property.

Remarks

Throws an exception when the property does not have a lookup.

TrySetLookupValueAsync<TValue, TDisplayValue>(IUIView, string, TValue?, TDisplayValue?)

Tries to set the value of a property with lookup. If value is not part of the valid values of the lookup, the value of propertyWithLookup is not changed and the method returns false.

public static Task<bool> TrySetLookupValueAsync<TValue, TDisplayValue>(this IUIView uiView, string propertyWithLookup, TValue? value, TDisplayValue? displayValue)

Parameters

uiView IUIView

UI view.

propertyWithLookup string

Property with lookup.

value TValue

Value to try to affect to the property.

displayValue TDisplayValue

Display value to pass to the lookup. This prevents the lookup from making an API request to get the display value corresponding to value.

Returns

Task<bool>

true when value is valid and has been changed; otherwise false.

Type Parameters

TValue

Type of the value of the property.

TDisplayValue

Type of the display property of the lookup.

Remarks

Throws an exception when the property does not have a lookup. displayValue is ignored when propertyWithLookup is an embedded reference.

TrySetLookupValueFromDisplayValueAsync<TDisplayValue>(IUIView, string, TDisplayValue?)

Tries to set the value of a property with lookup by setting its display value. If displayValue is not part of the valid values of the lookup, the value of propertyWithLookup is not changed and the method returns false; however, displayValue is still displayed.

public static Task<bool> TrySetLookupValueFromDisplayValueAsync<TDisplayValue>(this IUIView uiView, string propertyWithLookup, TDisplayValue? displayValue)

Parameters

uiView IUIView

UI view.

propertyWithLookup string

Property with lookup.

displayValue TDisplayValue

Display value to set in the lookup.

Returns

Task<bool>

true when displayValue is valid and the value of the property has been changed; otherwise false.

Type Parameters

TDisplayValue

Type of the display property of the lookup.

Remarks

This is the same behavior as a user typing an invalid value in the lookup. Throws an exception when the property does not have a lookup.