Article Factory Default Widget Providers

Factory default widget providers allow for a logical and physical separation of widgets.

Why use Factory Default Providers?

  • Source Control. Each factory provider has a separate folder where its widgets are stored (in the filestorage folder under defaultwidgets/{factory default provider identifier}).  Additionally each widget is saved as a single xml file, along with a folder that contains any supplementary files for that widget.  That separation and organization aids in the use source control to maintain widget updates.  The Manage Widget Source article provides additional detail on Factory Default Providers, Developer Mode and using source control when working with widgets. 
  • Ensuring Widgets are Available. When shipping custom functionality (content, widget extensions, and pages), it is beneficial to know that the widgets that define the UI for that functionality is available. Widgets defined by a factory default widget provider can be edited in the widget editor, but they cannot be removed. This ensures that the widgets are safe to reference within factory default definitions of pages.
  • Enabling/Disabling Widgets. When developing widgets that rely on other plugins to be enabled, for instance a 3rd party application, having your widgets grouped together in a Factory Default Provider allows the provider and its widgets to be enabled/disabled along side required functionality.

Widget File Storage

Each factory default provider stores its default widgets in the Verint Community filestorage under the default widgets folder using its identifier as the folder name. Widgets are stored as a single xml file under that folder.  Widget that have supplementary files store those files in a single folder named for that widget's identifier.

For example, assuming we have a file storage provider with identifier 'e47bcf91df6144db81edc7dc6bca264e'.  That provider has two widgets Widget1 and Widget2.  If Widget 1 has no supplementary files and Widget 2 has 3 supplementary files and an identifier of '5be59b2914fe46f8b09f61c51b4db256'.  The filestorage for this provider would be:

  • filestorage
    • defaultwidgets
      • e47bcf91df6144db81edc7dc6bca264e
        • Widget1.xml
        • Widget2.xml
        • 5be59b2914fe46f8b09f61c51b4db256
          • ui.js
          • image.jpg
          • save.vm

Creating a Widget Factory Default Provider

The IScriptedContentFragmentFactoryDefaultProvider interface has a single property:

interface IScriptedContentFragmentFactoryDefaultProvider : IPlugin
{
	Guid ScriptedContentFragmentFactoryDefaultIdentifier { get;  }
}

This property should return a unique identifier for the provider.

Example

using System;
using Telligent.Evolution.Extensibility.UI.Version1;

namespace Samples
{
    public class SampleWidgetProvider : IScriptedContentFragmentFactoryDefaultProvider
    {
        #region IScriptedContentFragmentFactoryDefaultProvider Members
        private readonly Guid _identifier = new Guid("b740a034-c218-458d-b094-13e1f913cff0");

        public Guid ScriptedContentFragmentFactoryDefaultIdentifier
        {
            get { return _identifier; }
        }
        #endregion

        #region IPlugin Members
        public string Description
        {
            get { return "Factory provider for sample widgets"; }
        }

        public void Initialize()
        {

        }

        public string Name
        {
            get { return "Sample Widget Provider"; }
        }
        #endregion
    }
}

The example creates a provider with the name "Sample Widget Provider". Any widget source files in the filestorage/defaultwidgets/b740a034c218458db09413e1f913cff0 folder (using the format identified above) would be available in the widget editor when this plugin is enabled.