Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3
Warning

This page is NOT documentation of the UI Options API. It is a working document. The UI Options API is currently undergoing revision, and there is no API documentation as yet.

 

This page presents a proposal for a new API for User Interface Options. It lays out what we would like to expect of an integrator.

...

Section
Column

UIO Only

Code Block
javascript
javascript

fluid.uiOptions(container, {
    gradeNames: [<gradenames of desired panels>,
                 <gradenames of schema for settings>],
    pathToTemplates: "my/sites/lib/infusion/templates/",
    pathToTocTemplate: "my/sites/",
    siteThemeClassName: "foofer-doodle-theme"
});
Column

Page Enhancer Only

Code Block
javascript
javascript

fluid.pageEnhancer({
    gradeNames: [<grade names of desired enactors>,
                 <gradenames of schema for settings>],
    pathToTocTemplate: "my/sites/",
    siteThemeClassName: "foofer-doodle-theme"
});
Section
Column
width25%
 
Column

UIO + Page Enhancer

Code Block
javascript
javascript

fluid.uiOptionsPlusPageEnhancer(container, {
    gradeNames: [<gradenames of desired panels>,
                 <grade names of desired enactors>,
                 <gradenames of schema for settings>],
    pathToTemplates: "my/sites/lib/infusion/templates/",
    pathToTocTemplate: "my/sites/",
    siteThemeClassName: "foofer-doodle-theme"
});
Column
width25%
 

If no grade names are specified, the default state of the components would be no panels, no settings. It's unlikely anyone would ever use it without grade names.

...

Section
Column

UIO Only

Code Block
javascript
javascript

fluid.uiOptions(container, {
    gradeNames: ["fluid.uiOptions.starterSettingsPanels",
                 "fluid.uiOptions.starterSettingsSchemastarterSettings"],
    pathToTemplates: "my/sites/lib/infusion/templates/",
    pathToTocTemplate:
"my/sites/",
    siteThemeClassName: "foofer-doodle-theme"
});

NOTE: The starterSettings grade combines the grades for the starter panels and the starter schema.

Column

Page Enhancer Only

Code Block
javascript
javascript

fluid.pageEnhancer({
    gradeNames: ["fluid.uiEnhancer.starterEnactors",
                 "fluid.uiOptions.starterSettingsSchema"starterSettings],
    pathToTocTemplate: "my/sites/",
    siteThemeClassName: "foofer-doodle-theme"
});

NOTE: The starterSettings grade combines the grades for the starter enactors and the starter schema.

Section
Column
width25%
 
Column

UIO + Page Enhancer

Code Block
javascript
javascript

fluid.uiOptionsPlusPageEnhancer(container, {
    gradeNames: ["fluid.uiOptions.starterSettingsPanels",
                 "fluid.uiEnhancer.starterEnactors",
                 "fluid.uiOptions.starterSettingsSchema"starterSettings"],
    pathToTemplates: "my/sites/lib/infusion/templates/",
    pathToTocTemplate: "my/sites/",
    siteThemeClassName: "foofer-doodle-theme"
});

NOTE: The starterSettings grade combines the grades for the starter enactors, panels and schema.

QUESTION: What should we name this/these combined grades?

Column
width25%
 

Use Case: 3rd Parties Adding Panels To The Starter Set

...

Note: All further examples will only use the "UIO + Page Enhancer" version: fluid.uiOptionsPlusPageEnhancer(). The pattern holds.

Section
Column
width20%
 
Column
Code Block
javascript
javascript
/**
 * Define a grade for the schema for your settings
 */
fluid.defaults("my.extra.settingsSchema", {
    schema: {...}
});
/**
 * Define a grade for extra panels
 * and their default settings
 */
fluid.defaults("my.extra.panels", {
    
defaultSiteSettings: { foofer: 7, doodle: true },
components: {
        foofer: {
            funcName: "my.integration.fooferPanel",
            options: {
                // if necessary:
                template: "myFooferPanel.html"
                // why can't panels load their own templates?
            }
            // any other configuration as necessary
        },
        doodle: {
            funcName: "my.integration.doodlePanel",
            options: {
                template: "myDoodlePanel.html"
                // if necessary
            }
            // any other configuration as necessary
        }
    }
});
/**
 * Define a grade for extra enactors
 */
fluid.defaults("my.extra.enactors", {
    components: {
        foofer: {
            funcName: "my.integration.fooferEnactor",
            // any other configuration as necessary
        },
        doodle: {
            funcName: "my.integration.doodleEnactor",
            // any other configuration as necessary
        }
    }
});
/**
 *
Add the
 A grade that combines my enactors, panels and schema.
 */
fluid.
uiOptionsPlusPageEnhancer(container
defaults("my.extra.settings", {
    gradeNames: ["
fluid
my.
uiEnhancer
extra.
starterEnactors
enactors",
                 "
fluid
my.
uiOptions
extra.
starterSettingsPanels
panels",
                 "my.extra.settingsSchema"]
});
/**
 * Add the enactors, panels and schema
 */
fluid.uiOptionsPlusPageEnhancer(container, {
    gradeNames: ["fluid.uiOptions.
starterSettingsSchema
starterSettings",
                 "my.extra.
enactors
settings"],
    pathToTemplates: "my/sites/lib/infusion/templates/",
    pathToTocTemplate: "my/sites/",
    
"my.extra.panels",
siteThemeClassName: "foofer-doodle-theme"
});
Column
width20%
 

Alternatively, the extra grades could be added using demands:

Section
Column
width20%
 
Column
Code Block
javascript
javascript
fluid.demands("fluid.uiOptions", ["my.integrations"], {
    gradeNames: ["my.extra.settings"],
});
fluid.uiOptionsPlusPageEnhancer(container, {
    gradeNames: 
["
my
fluid.
extra
uiOptions.
settingsSchema
starterSettings"],
    pathToTemplates: "my/sites/lib/infusion/templates/",
    pathToTocTemplate: "my/sites/",
    siteThemeClassName: "foofer-doodle-theme"
});

...

Column
width20%
 

Use Case: 3rd Parties Wanting A Subset Of The Starter Set

There are three possible ways to do this:

  1. Cut-and-paste: Copy the code that defines the "starter" grades, rename the grades, delete the parts you don't want, and use these new grades instead of the starter grades (not really recommended).
  2. Empty subcomponents: Use the starter grades and override the excluded subcomponents with fluid.emptySubcomponent
  3. Individual grades: Use the individual settings grades desired instead of the starter set.

The last two of these methods will be shown here, excluding the colour-and-contrast setting and the layout setting.

Section
Column
width50%

Empty Subcomponents

Code Block
javascript
javascript
fluid.
demands(
uiOptionsPlusPageEnhancer(container, {
    gradeNames: ["fluid.uiOptions.starterSettings"],
["my.integrations"], {


    components: {
        // Override the settings panels
        contrast: {
            type: "fluid.emptySubcomponent"
        },
        layoutControls: {
         
gradeNames
   type: 
[
"
my.extra.enactors", "my.extra.panels", "my.extra.settingsSchema"], }); fluid.uiOptionsPlusPageEnhancer(container
fluid.emptySubcomponent"
        },

        // Override the enactors
        theme: {
            type: "fluid.emptySubcomponent"
        },
        tableOfContentsEnactor: {
            type: "fluid.emptySubcomponent"
        }
    }

    pathToTemplates: "my/sites/lib/infusion/templates/",
    pathToTocTemplate: "my/sites/",
    siteThemeClassName: "foofer-doodle-theme"
});
Column
width50%

Individual Grades

Code Block
javascript
javascript
fluid.defaults("my.panelSet", {
    gradeNames: [
        // Specify each of the four desired panels directly
        "fluid.
uiEnhancer.starterEnactors
uiOptions.textSizer",
        "fluid.uiOptions.lineSpacer",
        "fluid.uiOptions.textFont",
        "fluid.uiOptions.linksControls",
        
        // Specify each of the four desired enactors directly
        "fluid.uiEnhancer.textSizer",
        "fluid.uiEnhancer.lineSpacer",
        "fluid.uiEnhancer.textFont",
        "fluid.
uiOptions
uiEnhancer.
starterSettingsPanels
linksControls",
        
        // Use the full schema
        "fluid.uiOptions.starterSettingsSchema"
    ]
});
fluid.uiOptionsPlusPageEnhancer(container, {
    gradeNames: ["my.panelSet"],
    pathToTemplates: "my/sites/lib/infusion/templates/",
    pathToTocTemplate: "my/sites/",
    siteThemeClassName: "foofer-doodle-theme"
});

...

Use Case: 4th Parties (users of customized UIOs)