Skip to main content

IViewDefinitions.RegisterGetTextStyleCallback(string,string,TextTypes,Func<IShape, TextTypes, string, IModel, IStyleProperty, object>) Method

Namespace: NextDesign.Core

Description

Registers a callback function to obtain the style value of the specified text of the editor element generated from the editor element definition that can be identified from the specified class.

  • It is recommended to call it when Activating the extension.
  • The style value is obtained in the following order of priority.
     1. Callback function value for getting style value
     2. Style value set in the view instance
     3. Style value defined in the view definition
  • To change the text color of the title text, redefine the text color in the callback function of RegisterGetStyleCallback.
  • The registered callback function is called in the following cases:
  • An editor element is displayed
  • A field value of the model referenced by the editor element 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
typeTextTypesText type
getterFunc<IShape, TextTypes, string, IModel, IStyleProperty, object>Callback function for getting style value

Callback function specification
object get_TextStyleFunction(IShape shape, TextTypes type, string textPath, IModel model, IStyleProperty target)

- Arguments
- shape : IShape ・・・ The shape that owns the label/text to which the style is applied is passed
- type : TextTypes ・・・ The type of target text (enumeration) is passed
- textPath : string ...The path string (field name) mapped in the text view definition is passed.
- model : IModel ...The model referenced by the editor element to which the tile 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 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 will be caught and the value of IStyleProperty.CurrentValue will be used as the result of calling the callback.

Return value

  • void

Exception

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

Annotation

If 11 or more labels are defined, the callback function for retrieving style values cannot be applied to the 11th and subsequent labels.