Child pages
  • Specification (.spec file)

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Properties can be configured with special tags that may be interpreted by the deployment and/or development environment.

Supported tags are: scope,   doc, addToElementsScope, logWhenOverMax, allowaccess, directEdit, useAsCaptionInDeveloper + captionPriority, showInOutlineView, main and mode.

...

Design means property can only be assigned from designer (not from scripting). Runtime means the property cannot be assigned from designer (will be hidden in Properties View). Private is an internal property, that should only be used by component itself (so component.js or component_server.js). Will not show in Properties View and cannot be assigned from scripting.


doc: a string (can have some basic html tags in it) that describes what the property does to the developer. See Documenting what properties do for more details.


addToElementsScope : boolean

...

When the find mode changes the boolean value of your property will also change. This way you can react to a form/foundset going into find mode. Like resetting a specific format, allowing any kind of input.

Handlers

The function description in the handlers section can be just "function" or a more complex type describing the arguments and return type

...

Documenting what properties do
Anchor
documentingProperties
documentingProperties

Documentation for properties can be added to each property's definition via the "tags" section using key "doc".

The description that you provide in the .spec file will be used in Servoy Developer as:

  • tooltip in properties view
  • tooltip in solution explorer view
  • tooltip in script editor
  • any other place in developer where it can help the user of your custom component understand what that property does.

For example if you want to document a simple property called "titleText" you can do it like this:

Code Block
languagejs
	(...)
	"model": {
		"titleText": { "type": "string", "tags": { "doc": "The <b>title text</b> is shown in this component's title bar (top side).<br/>Keep it short." } },
	(...)

Basic html tags are supported - similar to the ones supported when documenting methods using JSDoc (in the script editor).

Arrays, custom objects, array elements and subproperties of custom objects can be documented in the same way. For example:

Code Block
	(...)
	"model": {
		"columns": {
						"type": "column[]",
						"tags": { "doc": "Define the table's columns using this property." },
						"elementConfig": {
							"tags": { "doc": "A column definition describes all that is needed to show that column properly in the table." }
						},
						(...)
		           },
		(...)
	},
	"types": {
		"column": {
			"dataprovider": { "type": "dataprovider", "forFoundset": "foundset", (...), "tags": { "doc" : "Choose the data that is to be shown in this column." } ),
			"format": { "type": "format", "for": ["valuelist", "dataprovider"], "tags": { "doc" : "This format will be applied on the dataprovider's data before showing it in the table." } },
			"valuelist": { "type": "valuelist", "for": "dataprovider", "forFoundset": "foundset" },
			(...)
		},
	(...)

Handlers

The function description in the handlers section can be just "function" or a more complex type describing the arguments and return type

Code Block
"functionName": {
        "returns":  "string",
        "parameters": [
            { "name": "start", "type": "int" },
            { "name": "end", "type": "int" } 
        ],
		"private":true // since Servoy 8.3, optional, default is false
}

...

Code Block
languagejs
titleCategory Name
linenumberstrue
{
	"name": "packagename-componentname",
	"displayName": "String more descriptive name that is shown in the designer",
	"categoryName": "Advanced",
...
}



...


Example
Anchor
example
example

...