This documentation is currently being moved to our new documentation site.

Please view or edit the documentation there, instead.

If you're looking for Fluid Project coordination, design, communication, etc, try the Fluid Project Wiki.

Creating a Primary Schema

This article describes how to use the Infusion Preferences Framework to create a Primary Schema, a JSON document that defines preferences. This is part of the Tutorial - Creating a Preferences Editor Using the Preferences Framework.


 

On This Page

The Primary Schema defines the settings themselves: their type (e.g. boolean, string, number), their default values and any other information necessary to define them, depending on their type: ranges, enumerations, etc.

See also Primary Schema for Preferences Framework.

The Primary Schema is defined as a single JSON document or JavaScript Object listing all settings, and is passed to the builder. The key in the schema definitions is a string that will be used throughout the Preferences Framework to associated all the components related to the setting: panels, enactors, etc. The string can be anything, so long as it is used consistently, but keep in mind that it will be used in the persistent storage for the user's preference, and will be shared with other technologies that may wish to define enactors to respond to it. We recommend that it be thoughtfully namespaced and human-understandable.

Example: Selected UI Options preferences

fluid.prefs.primarySchema = {
    "fluid.prefs.lineSpace": {
        "type": "number",
        "default": 1,
        "minimum": 1,
        "maximum": 2,
        "divisibleBy": 0.1
    },
    "fluid.prefs.textFont": {
        "type": "string",
        "default": "",
        "enum": ["", "Times New Roman", "Comic Sans", "Arial", "Verdana"]
    },
    "fluid.prefs.tableOfContents": {
        "type": "boolean",
        "default": false
    }
};

 

Example: Video Player extra preferences

fluid.videoPlayer.primarySchema = {
    "fluid.videoPlayer.captions": {
        type: "boolean",
        "default": false
    },
    "fluid.videoPlayer.captionLanguage": {
        type: "string",
        "default": "en",
        "enum": ["en", "fr"]
    },
    "fluid.videoPlayer.transcripts": {
        type: "boolean",
        "default": false
    },
    "fluid.videoPlayer.transcriptLanguage": {
        type: "string",
        "default": "en",
        "enum": ["en", "fr"]
    }
};

Back to Tutorial - Creating a Preferences Editor Using the Preferences Framework