Top Level Classes – JSON Type Reference


Custom Attributes each have a specific format that they are expected to follow, but all attribute configurations are one of the following forms:

Tag:

Used for binding a single server tag to a single attribute on an element.

Definition:

{
    "tag" : <string>,
    "config" : <Config>
}

tag : string : a string representing the server tag to monitor for this attribute

config : Config : a detailed configuration that describes how to alter the element based on the server tag

Example:

{
    "tag" : "Pump.Value",
    "config" : {
        "color" : "#f00",
        "trigger":"on_true"
    }
}

Tag Group:

An array of Simple Tag configurations used to set up a hierarchy of behaviors. Each configuration is evaluated in order and the first tag to evaluate as boolean true will be used to modify the associated element.

Definition:

{
    "type" : "group",
    "all_f" : <Config>,
    "bad_q" : <Config>,
    "group" : [<Tag>,..]
}

type : string : must be hard-coded as “group”

all_f : Config : optional configuration to use if all Tags in the group evaluate to false

bad_q : Config : optional configuration to use if any Tag produces bad quality data from the server

group : [Tag] : an array of Tags, evaluated in order, establishing a hierarchy of behaviors. The first Tag to evaluate as boolean true will dictate the element behavior, and no subsequent Tags in the group will be evaluated.

Example:

{
    "type" : "group",
    "all_f" : {"color":"#F00"},
    "bad_q" : {"color":"#FC0"},
    "group" : [
        {
            "tag" : "Pump.Value",
            "config" : {"color":"#00F"}
        },
        {
            "tag" : "Pump2.Value",
            "config" : {"color":"#080"}
        }
    ]
}

Config:

Never used on its own, the Config is applied to several other attributes to define specific behaviors. All Config attributes are optional as they may or may not apply to the Custom Attribute in question.

Definition:

{
    "formats" : <Formats>,
    "style" : <string>,
    "cls" : <string>,
    "color" : <string>,
    "img" : <string>,
    "img_pos" : <string>,
    "rate" : <integer>,
    "repeat" : <integer>,
    "bad_q" : <bool>,
    "trigger" : <string>,
    "fn" : <string>,
    "gain" : <decimal>,
    "offset" : <decimal>,
    "set" : <string>,
    "evt" : <string>,
    "set_src" : <string>, 
    "set_value" : <string>,
    "set_confirm_buttons" : <string>,
    "set_confirm" : <bool>,
    "set_confirm_msg" : <string>,
    "set_confirm_title" : <string>,
    "ignore_prefix" : <bool>
}

formats : Formats : used for formatting data values, used with the oas-tag-txt and oas-tag-val attributes

style : string : an inline CSS style string to apply directly to the element when the tag value evaluates to TRUE

cls : string : a CSS class name to apply to the element when the tag value evaluates to TRUE

color : string : a foreground color to apply to an element, either a color name or hex value (e.g. #ffcc00) when the tag value evaluates to TRUE

img : string : an image path to be applied to the element (e.g. when used with the oas-tag-bg)

img-pos : string : a position string to be applied to the background image, in the form “offset-x offset-y”, for example: “20px 5px”

rate : integer : used in conjunction with repeat, the interval in milliseconds between changes, defaults to 200 if omitted

repeat : integer : the number of times to toggle a change, primarily used with flashing attributes

bad_q : bool : indicates that the configuration is to be used when the server tag data quality is bad

trigger : string : when to trigger a change to the element. Valid values are:

on_true : when the server tag evaluates to TRUE

on_false : when the server tag evaluates to FALSE

trans : when the server value changes

trans_true : when the server value changes to TRUE from FALSE

trans_false : when the server value changes from FALSE to TRUE

fn : string : the name of a function to execute when the trigger condition is met

gain : decimal : a multiplier applied to a server tag value before being applied to an element. For example if a server value fluctuates between 0.0 and 1.0, but you wish to transform this to a range between 0.0 and 100.0, set the gain to 100. This may be combined with offset for finer control.

offset : decimal : a value added to a server tag value before being applied to an element. For example if a server value fluctuates between 0.0 and 50.0, but you wish to transform this to a range between 10.0 and 60.0, set the offset to 10. This may be combined with gain for finer control.

set : string : used only with oas-tag-set, the method used to set a tag value on the server. Valid values are:

toggle : negate the current server boolean value so TRUE becomes FALSE, and FALSE becomes TRUE

input : display an input dialog allowing users to manually enter the value sent to the server

value : send either the element’s value to the server (default), a fixed value defined by the set_value configuration, or the value of element with an id defined in theset_src configuration

set_src : string : used only with a set of value, the client id of the element to provide a value, for example a separate text input field on the page.

set_value : string : used only with a set of value, a hard-coded value to always send to the server, for example FALSE when creating an explicit “off” button.

evt : string : used only with set, the client-side event on the element to trigger a server value being set. Valid values are:

click : clicking the element

dbl-click : double-clicking an element

change : when an element’s value changes, for example when a text input box value is changed by a user

set_confirm_buttons : string : used only with a set value if input, this determines the text values on the dialog buttons.

ok : OK/Cancel (default if omitted)

yesno : YES/NO

set_confirm_msg : string : used only with a set value if input, a message displayed in the input dialog.

set_confirm_title : string : used only with a set value if input, a title displayed in the header of the input dialog.

ignore_prefix : bool : used only if a tag_prefix is being used on the main config, and the current tag should not use the prefix.

Formats:

Used for formatting data values for display

Definition:

{
    "bad_q" : <string>,
    "string" : <string>,
    "bool_f" : <string>,
    "bool_t" : <string>,
    "int" : <string>,
    "float" : <string>,
    "date" : <string>,
    "locale" : <string>
}

bad_q : string : the string to display when the server tag yields bad data

str : string : a format string that replaces a “{0}” string with the server tag value. For example if you use the string “The value is {0}”, and the server tag value is 27.3, the resultant string will be “The value is 27.3”

bool_f : string : the string to display when the server tag evaluates to boolean false. For example “No”, or “F”

bool_t : string : the string to display when the server tag evaluates to boolean true. For example “Yes”, or “T”

int : string : a numeric formatting string for integer values, Formatting syntax is identical to float but decimal separator is ignored

float : string : a numeric formatting string for decimal/float values. Formatting syntax can be found here (https://code.google.com/p/jquery-numberformatter/)

locale : string : a localization string which influences how separators and decimals are represented. Default is “us” for United States if no locale is included in the main config.