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
uiViewIUIViewItem.
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
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
uiViewTUIViewItem.
propertyExpressionExpression<Func<TUIView, TProperty>>An expression selecting the property, e.g.
x => x.MyProperty.
Type Parameters
TUIViewType of the UI view.
TPropertyType of the property.
AddValidationMessage(IUIView, UIValidationMessage)
Adds a validation message.
public static void AddValidationMessage(this IUIView uiView, UIValidationMessage validationMessage)
Parameters
uiViewIUIViewItem.
validationMessageUIValidationMessageValidation message.
ClearPropertyValidationMessages(IUIView, string)
Clears the validation messages of a property.
public static void ClearPropertyValidationMessages(this IUIView uiView, string propertyName)
Parameters
ClearValidationMessages(IUIView)
Clears the validation messages.
public static void ClearValidationMessages(this IUIView uiView)
Parameters
uiViewIUIViewItem.
Clone(IUIView)
Clones this instance.
public static IUIView Clone(this IUIView uiView)
Parameters
uiViewIUIViewUI 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
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
uiViewIUIViewItem.
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
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
TDisplayPropertyType 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
Returns
- T
The original value if the property has been changed, the current value otherwise.
Type Parameters
TValue 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
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
uiViewIUIViewItem.
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
uiViewIUIViewItem.
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
uiViewIUIViewItem.
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
Returns
- T
Value of the property.
Type Parameters
TValue type.
HasChanges(IUIView)
Gets the value indicating whether the item has changes.
public static bool HasChanges(this IUIView uiView)
Parameters
uiViewIUIViewItem.
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
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
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
uiViewTUIViewItem.
propertyExpressionExpression<Func<TUIView, TProperty>>An expression selecting the property, e.g.
x => x.MyProperty.
Returns
- bool
True if the property has been changed.
Type Parameters
TUIViewType of the UI view.
TPropertyType of the property.
IsNew(IUIView)
Gets the value indicating whether the item is new.
public static bool IsNew(this IUIView uiView)
Parameters
uiViewIUIViewItem.
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
uiViewIUIViewItem.
Returns
- bool
Value indicating whether the item is virtual.
MarkAsNew(IUIView)
Marks item as new.
public static void MarkAsNew(this IUIView uiView)
Parameters
uiViewIUIViewItems.
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
uiViewIUIViewItem.
RejectChanges(IUIView)
Rejects all changes. Original values are restored.
public static void RejectChanges(this IUIView uiView)
Parameters
uiViewIUIViewItem.
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
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
uiViewTUIViewItem.
propertyExpressionExpression<Func<TUIView, TProperty>>An expression selecting the property, e.g.
x => x.MyProperty.
Type Parameters
TUIViewType of the UI view.
TPropertyType of the property.
RemoveValidationMessage(IUIView, UIValidationMessage)
Removes a validation message.
public static void RemoveValidationMessage(this IUIView uiView, UIValidationMessage validationMessage)
Parameters
uiViewIUIViewItem.
validationMessageUIValidationMessageValidation 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
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
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
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
uiViewIUIViewItem.
ToApiRequestData(IUIView)
Converts the item to a serializable object.
public static IUIView ToApiRequestData(this IUIView uiView)
Parameters
uiViewIUIViewUI 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
uiViewIUIViewUI view.
propertyWithLookupstringProperty with lookup.
valueTValueValue to try to affect to the property.
Returns
Type Parameters
TValueType 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
uiViewIUIViewUI view.
propertyWithLookupstringProperty with lookup.
valueTValueValue to try to affect to the property.
displayValueTDisplayValueDisplay value to pass to the lookup. This prevents the lookup from making an API request to get the display value corresponding to
value.
Returns
Type Parameters
TValueType of the value of the property.
TDisplayValueType 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
uiViewIUIViewUI view.
propertyWithLookupstringProperty with lookup.
displayValueTDisplayValueDisplay value to set in the lookup.
Returns
- Task<bool>
truewhendisplayValueis valid and the value of the property has been changed; otherwisefalse.
Type Parameters
TDisplayValueType 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.