Creating smart tags with the web UI framework

Smart tags are used to recognize certain types of data. For example, when you hover your cursor over a component which has a smart tag, a list of actions that can be performed are displayed.

About this task

The following graphic shows an example of a smart tag:

An email window where a tag automatically recognizes an email address

To use a smart tag with a component, do the following:

Procedure

  1. Register the smart tag actions for a component. Use the class sc.plat.SmartTagActionRegistry to add action providers to the registry, using the following methods:
    • registerActionProvider(obj, boolOverride)

      A valid action provider object must contain a getActions method that accepts a reference of the type Ext.Component. It must also contain an “id” property that is the unique ID of this action provider object. The getActions method must return an array of objects that can have the following properties:

    • categoryid: The unique ID of the category object.
    • sequenceid: Sequence number which helps in sorting.
    • item: Config of Ext.menu.Item

      The following is an example of an object that can be returned by the getActions method. This example uses the default ID category (DEFAULT).

      {
         categoryid: 'DEFAULT',
         	    sequenceid: 1
         	    item: {
              text: 'Show a Ext.Window',
                  handler: function(){
      	           new Ext.Window({
                     width: 600,
      	              height: 500
      	             }).show();
                     	}
      	             }
      }
    • registerActionType(name, id)

      Registers the type with the action provider object corresponding to the ID passed. Before doing this, you must first register an action provider object with that ID using the registerActionProvider method.

      The default UI displays the actions returned. You can use the default UI or override it by registering your own UI provider.

  2. Set the scSmartTag property for that component to one of the following values:
    • true

      The default implementation of the application gets the attribute in the source binding data. Objects that are registered with a key equal to the attribute in the source binding data are fetched.

    • A value such as the attribute in sourceBinding or targetBinding.

      Objects that are registered with a key equal to the scSmartTag property are fetched.