Skip to main content

IViewDefinitions.RegisterCompartmentItemTextValueCallback(string,string,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 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.
  • The registered callback function for getting the value 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

NameTypeDescription
editorModelClassNamestringModel class name of editor
elementModelClassNamestringModel class name of editor element
areaPathstringPath of compartment area
getterFunc<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 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 partition 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 textPath field value is used.
setterAction<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 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.
- 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

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