IViewDefinitions.RegisterCompartmentItemTextValueCallback(IElementDef,string,Func<INode, int, string, IModel, string>,Action<INode, int, string, IModel, string>) Method
Namespace: NextDesign.Core
Description
Registers a callback function to get/set the value of 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.
- The registered callback function for getting the value is 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, string> | Callback function for getting text value Callback function specification string get_TextValueFunction(IShape shape, TextTypes type, string textPath, IModel model) - 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. - Return value - string ... Returns the string to be treated as the result of Get. - Exception handling - If an exception is thrown in the implementation of the callback function, the exception is caught and the field value of textPath is used. |
| setter | Action<INode, int, string, IModel, string> | Callback function for setting text value Callback function specification void set_TextValueFunction(IShape shape, TextTypes type, string textPath, IModel model, string value) - Arguments - node : INode・・・The shape that owns the compartment item to which the style is applied is passed. - areaIndex : int ・・・The compartment index to which the compartment item to which the style is applied belongs is passed. - areaPath : string ・・・The path string (field name) set in the compartment 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. - value : string ・・・The text requested to be set as the text value of the label is passed. - Exception handling - If an exception is thrown in the implementation of the callback function, the text setting is canceled. |
Return value
- void
Exception
| Name | Exception class | Description |
|---|---|---|
| Invalid argument | ExtensionArgumentException | null in elementDef If you specify areaPath is null or an empty string |
| Duplicate key | ExtensionDuplicationException | If the callback registration key is duplicated |