IViewDefinitions.RegisterGetCompartmentItemTextStyleCallback Method
Namespace: NextDesign.Core
Description
Registers a callback function for retrieving style values for a specified compartment item of an editor element generated from an editor element definition that can be identified from a specified class.
- It is recommended to call this when activating an extension.
- Style values are retrieved in the following order of priority.
1. Callback function value for retrieving style values
2. Style value set in the view instance
3. Style value defined in the view definition - The registered callback function is called in the following cases.
・The compartment item is displayed
・The field value of the model referenced by the compartment item is changed
Note that if the editor element definition cannot be identified from the specified class, nothing is done.
Arguments
| Name | Type | Description |
|---|---|---|
| editorModelClassName | string | Model class name of editor |
| elementModelClassName | string | Model class name of editor element |
| areaPath | string | Path of 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. - 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
Exception
| Name | Exception class | Description |
|---|---|---|
| Invalid argument | ExtensionArgumentException | If null or an empty string is specified for editorModelClassName If null or an empty string is specified for elementModelClassName If null or an empty string is specified for areaPath |
| Duplicate key | ExtensionDuplicationException | If the callback registration key is duplicated |