IViewDefinitions.RegisterGetCompartmentItemTextStyleCallback(IElementDef,string,Func<INode, int, string, IModel, IStyleProperty, object>,StyleAttributes) 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 by specifying the style attribute.
- 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
Name | Type | Description |
---|---|---|
elementDef | IElementDef | Editor element definition |
areaPath | string | Path to compartment area |
getter | Func<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 through. - 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 through. - itemModel : IModel ・・・The model referenced by the compartment item to which the style is applied is passed through. - target : IStyleProperty ・・・The target style attribute information is passed through. - 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 raised 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 is caught and the value of IStyleProperty.CurrentValue is used as the result of the callback invocation. |
properties | StyleAttributes | Style attributes (If multiple style attribute names are specified, a callback is registered for each one) |
Return value
- void
Exceptions
Name | Exception class | Description |
---|---|---|
Invalid argument | ExtensionArgumentException | When null is specified for elementDef When null or an empty string is specified for areaPath |
Duplicate key | ExtensionDuplicationException | When the callback registration key is duplicated |