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.

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 12 Next »


The Model Builder subcomponent is used by Table of Contents API to convert a flat list of headings into a hierarchical list suitable for the Table of Contents.

Do not use this component directly. The information on this page should be use when customizing Table of Contents.

See Also
Table of Contents API

Supported Events

none

#Methods

#modelLevelFn
Used to determine how to nest heading.

#toModel
Use to actually build the nested model.

Options

none

Subcomponents

headingCalculator
Calculates the heading level.

Methods

back to top

This component has public methods that can be invoked by integrators as necessary. These methods are typcially implemented as Invokers, which resolve their arguments from the environment at invocation time. These methods can be configured by the integrator if necessary: arguments can be changed, and in fact the entire implementation function can be replaced by a custom function (though it is likely rare that this would be necessary or desirable).

Configuration of invokers should be carried by creating a grade, using the following pattern:

fluid.defaults("<new name of overriding grade>", {
    gradeNames: ["<name of grade being overridden", "autoInit"],
    invokers: {
        <invokerName>: {
            funcName: <implementation function name>,
            args: [<array of argument specifications>]
        }
    }
});

Example of overriding an invoker

The Infusion Pager component has a method called {{acquireDefaultRange}} which, by default, simply returns the total range. An integrator may wish to override this using their own custom function:

fluid.defaults("my.pager", {
    gradeNames: ["fluid.pager", "autoInit"],
    invokers: {
        acquireDefaultRange: {
            funcName: "my.pager.acquireDefaultRange
        }
    }
});

modelLevelFn

Description

Used by the #toModel method to decide how deeply to nest a heading in the Table of Contents. The default implementation creates a nested hierarchy that uses incremental depths, independent of the actual heading levels.

Parameters

modelLevel
An array used to keep track of actual hierarchy levels, when those are being preserved.

subHeadings
An array used to keep track of adjusted, gradual headings, when gradual nesting is used.

Configurable

yes
Default implementation: fluid.tableOfContents.modelBuilder.gradualModelLevelFn

Notes

The Model Builder also defines an alternative implementation: fluid.tableOfContents.modelBuilder.skippedModelLevelFn, which produces a hierarchy that exactly reflects heading levels.

toModel

Description

Used by the Model Builder to convert a flat list of headings into a hierarchical list using modelLevelFn.

Parameters

headingInfo
A flat array of objects describing all headings to be included in the table of contents

modelLevelFn
The function to use to determine the nesting of the table of contents.

Configurable

yes
Default implementation: "fluid.tableOfContents.modelBuilder.toModel".

See also

#modelLevelFn

Subcomponents

Subcomponents can be configured though the parent component's components option using the following pattern:

parent.component.name(".myContainer", {
    components: {
        <subcomponentName>: {
            options: {
                <subcomponent options>
            }
        }
    }
});

headingCalculator

Description

The headingCalculator subcomponent calculates and returns the heading level.

Default implementation

fluid.tableOfContents.modelBuilder.headingCalculator

  • No labels