Skip to content

Config File 4 Controls

herve edited this page Jan 30, 2019 · 1 revision

Tab Controls

Each tab contains at least 1 control that displays and/or updates Archi properties.

Each control must have the following properties (case insensitive):

  • class [string]: class of the graphical object. This property is mandatory, and must be one of the following:
    • label: read-only text string
    • text: updatable text string
    • combo: list of acceptable values
    • check: check button to specify binary values (like true/false, yes/no, y/n, etc...)
    • table: a table with one line per element and relationship in a view (cf. Tables
  • x [integer]: horizontal position (in pixels) of the graphical object (0px is left)
  • y [integer]: vertical position (in pixels) of the graphical (0px is top)
  • width [integer]: width (in pixels) of the form display window (default: calculated from content)
  • height [integer]: height (in pixels) of the form display window (default: calculated from content)
  • background [string]: color of the object background in RGB comma separated format (default: "240, 240, 240")
  • foreground [string]: color of the text color in the object in RGB comma separated format (default: "0, 0, 0")
  • tooltip [string]: the text that appears when you hover over an object with your cursor (default is no tooltip)
  • regexp [string]: (for text controls only) allow to specify a regexp that will change the foreground color of the text: red if the regexp is not matched, green if the regexp is matched. (default to regexp if not specified)
  • text [string]: literal string to print in the control (for label controls only)
  • values [array]: list of valid values for combo and check objects.
  • variable [string]: variable to link to to the object (for text, combo and check controls) (cf. Variables)
  • default [string]: specifies the default value if the variable has got an empty value (in conjunction with "variable" only) (cf. Variables)
  • forceDefault [boolean]: forces the default value even if the variable is not empty (in conjunction with "variable" only) (cf. Variables)
  • whenempty [string]: specifies what to do when saving the variable value back to the Archi component, if the variable is empty. It is usually used when the variable is an Archi property (in conjunction with "variable" only) (cf. Variables). It may be one of:
    • ignore: don't save the Archi property and leave the component untouched. If the Archi property existed, its value is saved. If the Archi property did not exist, no value is saved.
    • create: creates the Archi property with an empty value
    • delete: If the Archi property exists, delete it

Tab Control Example

The following example file creates tabs and fills them with label, text, and combo controls:

{
    "version": 2,
    "org.archicontribs.form":
        {
            "name": "Form test for ${class} \"${name}\"",
            "refers": "view",
            "width": 900,
            "height": 400,
            "spacing": 4,
            "background": "250, 250, 250",
            "whenEmpty": "ignore",
            "tabs": [
                {
                    "name": "View information",
                    "background": "225, 225, 225",
                    "controls": [
                        {
                            "class": "label",
                            "x": 10,
                            "y": 10,
                            "width": 100,
                            "height": 20,
                            "background": "225, 225, 225",
                            "foreground": "0, 0, 0",
                            "tooltip": "Name of the Archi component",
                            "fontName": "Arial",
                            "fontSize": 12,
                            "fontBold": false,
                            "fontItalic": false,
                            "text": "Name"
                        },
                        {
                            "class": "label",
                            "x": 120,
                            "y": 10,
                            "width": 300,
                            "height": 20,
                            "background": "225, 225, 225",
                            "foreground": "250, 56, 56",
                            "tooltip": "Name of the Archi component",
                            "fontName": "Times New Roman",
                            "fontSize": 12,
                            "fontBold": true,
                            "fontItalic": false,
                            "text": "${name}"
                        },
                        {
                            "class": "label",
                            "x": 10,
                            "y": 40,
                            "width": 100,
                            "height": 20,
                            "background": "225, 225, 225",
                            "foreground": "0, 0, 0",
                            "tooltip": "Class of the Archi component",
                            "fontName": "Arial",
                            "fontSize": 12,
                            "fontBold": false,
                            "fontItalic": false,
                            "text": "Class"
                        },
                        {
                            "class": "label",
                            "x": 120,
                            "y": 40,
                            "width": 300,
                            "height": 20,
                            "background": "225, 225, 225",
                            "foreground": "250, 56, 56",
                            "tooltip": "Class of the Archi component",
                            "fontName": "Times New Roman",
                            "fontSize": 12,
                            "fontBold": true,
                            "fontItalic": false,
                            "text": "${class}"
                        },
                        {
                            "class": "label",
                            "x": 10,
                            "y": 70,
                            "width": 100,
                            "height": 20,
                            "background": "225, 225, 225",
                            "foreground": "0, 0, 0",
                            "tooltip": "What the view describes",
                            "fontName": "Arial",
                            "fontSize": 12,
                            "fontBold": false,
                            "fontItalic": false,
                            "text": "Describes"
                        },
                        {
                            "class": "combo",
                            "x": 120,
                            "y": 70,
                            "width": 200,
                            "height": 20,
                            "background": "225, 225, 225",
                            "foreground": "250, 56, 56",
                            "tooltip": "What the view describes",
                            "fontName": "Times New Roman",
                            "fontSize": 12,
                            "fontBold": true,
                            "fontItalic": false,
                            "values": ["the past", "the present", "the future"],
                            "variable": "${property:describes}",
                            "default": "the present",
                            "editable": true,
                            "whenEmpty": "delete"
                        },
                        {
                            "class": "label",
                            "x": 10,
                            "y": 100,
                            "width": 100,
                            "height": 20,
                            "background": "225, 225, 225",
                            "foreground": "0, 0, 0",
                            "tooltip": "Language",
                            "fontName": "Arial",
                            "fontSize": 12,
                            "fontBold": false,
                            "fontItalic": false,
                            "text": "Language"
                        },
                        {
                            "class": "combo",
                            "x": 120,
                            "y": 100,
                            "width": 200,
                            "height": 20,
                            "background": "225, 225, 225",
                            "foreground": "250, 56, 56",
                            "tooltip": "Language",
                            "fontName": "Times New Roman",
                            "fontSize": 12,
                            "fontBold": true,
                            "fontItalic": false,
                            "values": ["_fr", "_en"],
                            "variable": "${property:language}",
                            "default": "fr",
                            "tag": "language",
                            "editable": false,
                            "whenEmpty": "delete"
                        },
                        {
                            "class": "label",
                            "x": 10,
                            "y": 135,
                            "width": 100,
                            "height": 20,
                            "background": "0, 0, 0",
                            "foreground": "255, 255, 255",
                            "tooltip": "Comment",
                            "fontName": "Arial",
                            "fontSize": 12,
                            "fontBold": false,
                            "fontItalic": false,
                            "text": "Comment"
                        },
                        {
                            "class": "text",
                            "x": 120,
                            "y": 130,
                            "width": 750,
                            "height": 100,
                            "background": "225, 225, 225",
                            "foreground": "250, 56, 56",
                            "tooltip": "Please specify a comment",
                            "fontName": "Times New Roman",
                            "fontSize": 12,
                            "fontBold": true,
                            "fontItalic": false,
                            "variable": "${property:comment}",
                            "default": "$property:comment$[language]}",
                            "forceDefault": true,
                            "editable": false,
                            "regexp": ".*",
                            "whenEmpty": "delete"
                        }
                    ]
                },
                {
                    "name": "Elements in the view",
                    "background": "200, 200, 200",
                    "controls": []
                },
                {
                    "name": "Relationships in the view",
                    "background": "200, 200, 200",
                    "controls": []
                }
            ]
        }
}