IViewDefinitions.RegisterGetCompartmentItemTextStyleCallback(string,string,string,Func<INode, int, string, IModel, IStyleProperty, object>,StyleAttributes) Method
Namespace: NextDesign.Core
Description
Registers a callback function to obtain style values for the specified compartment item of the editor element generated from the editor element definition that can be identified from the specified class by specifying the style attribute.
- It is recommended to call this when Activating the extension.
- Style values are obtained 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 when:
- A compartment item is displayed
- A 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 will be 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 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 or an empty string is specified for editorModelClassName When null or an empty string is specified for elementModelClassName When null or an empty string is specified for areaPath |
| Duplicate key | ExtensionDuplicationException | When the callback registration key is duplicated |