Skip to main content

IViewDefinitions.RegisterGetCompartmentItemTextStyleCallback(IElementDef,string,Func<INode, int, string, IModel, IStyleProperty, object>) Method

Namespace: NextDesign.Core

Description

Registers a callback function for retrieving style values for the specified compartment item of the editor element generated from the specified editor element definition.

  • It is recommended to call this when activating the extension.
  • Style values are retrieved in the following order of priority.
     1. Callback function value for retrieving style value
     2. Style value set in the view instance
     3. Style value defined in the view definition
  • The registered callback function will be called in the following cases:
     ・A compartment item is displayed
     ・A field value of the model referenced by the compartment item has been changed

Arguments

NameTypeDescription
elementDefIElementDefEditor element definition
areaPathstringPath to compartment area
getterFunc<INode, int, string, IModel, IStyleProperty, object>Callback function for getting style value

Callback function specification
object object get_ItemTextStyleFunction(INode node, int areaIndex, string areaPath, IModel itemModel, IStyleProperty target)

- Arguments
- node : INode ・・・The shape that owns the compartment item to which the style is applied is passed
- areaIndex : int・・・The area index of the compartment item to which the style is applied belongs is passed.
- areaPath : string ・・・The path string (field name) set in the area definition to which the compartment item to which the style is applied belongs is passed.
- itemModel : IModel ・・・The model referenced by the compartment item to which the style is applied is passed.
- target : IStyleProperty ・・・The target style attribute information is passed.
- Return value
- object ・・・Returns the object to be treated as the result of Get.
- The callback function must be an object that matches the type of the specified target style attribute.
- If an object that does not match the type is returned, no exception will be thrown and it will be automatically converted to the value of IStyleProperty.CurrentValue.
- Exception handling
- If an exception is thrown in the implementation of the callback function, the exception will be caught and the value of IStyleProperty.CurrentValue will be used as the result of calling the callback.

Return value

  • void

Exceptions

NameException classDescription
Invalid argumentExtensionArgumentExceptionIf null is specified for elementDef
If null or an empty string is specified for areaPath
Duplicate keyExtensionDuplicationExceptionIf the callback registration key is duplicated