Feature Pack 7 or later

Define the object definition for widget

In this lesson, you add the object definition for your new widget. The object definition adds support for your widget object within the Management Center framework.

Procedure

  1. In the Enterprise Explorer view, copy the generated object definition files for your widget into your default workspace directory structure.
    1. In your new project directory, go to the WebContent\config directory.
      For example, the filepath to the directory, can be NewWidgetProject\LOBTools\WebContent\config.
    2. Copy the mycompany directory.
    3. Go to the LOBTools\WebContent\config directory in your default workspace directory structure.
    4. Paste the mycompany directory within the LOBTools\WebContent\config directory.
  2. In your default workspace directory structure, go to the LOBTools\WebContent\config\mycompany\pagelayout\widgetDefinitions\ShoppingCartDetailPageWidget directory.
  3. Open the WidgetObjectDefinition.def file for editing.
    By default the generated code for your widget object definition can resemble the following code:
    <?xml version="1.0" encoding="UTF-8"?>
    <!-- The following code is created as example. Modify the generated code and add any additional required code.  -->
    <Definitions>
      <WidgetObjectDefinition package="plm"
        definitionName="plmLayoutWidget_ShoppingCartDetailPageWidget" 
        parentDefinitionName="plmBasePageLayoutPrimaryObjectDefinition"
        baseDefinitionName="plmBaseLayoutWidget"
        objectType="ShoppingCartDetailPageWidget"
        gridPropertiesDefinitionName="plmWidgetProperties_ShoppingCartDetailPageWidget"
        iconPath="/images/pagelayouts/widgetIcons/ShoppingCartDetail.png">
        
        <CreateService baseDefinitionName="plmBaseCreateLayoutWidget" />
        <UpdateService baseDefinitionName="plmBaseUpdateLayoutWidget" />
        
        <Xml name="template">
          <sequence>0</sequence>
        </Xml>		
      </WidgetObjectDefinition>	
    </Definitions>
    Where
    iconPath
    The filepath to the icon that displays for your custom widget within the Add Widgets to Slots window in the Commerce Composer tool. For this tutorial, copy an existing widget icon and rename the icon to be ShoppingCartDetail.png.
    objectType
    The widget object type and the name of the properties definition for your custom widget. The generated value for the property is the value that you defined for the WidgetUIObjectName in the JET pattern input XML file.
    parentDefinitionName
    The widget definition name for the parent widget definitions. The definition name must be included so that the object definition can be retrieved for use in Management Center for your custom widget. For more information about this property, see Management Center definitions
    plmLayoutWidget_ShoppingCartDetailPageWidget
    The definition name for the object definition of your custom widget, which must be unique in your workspace. The value, ShoppingCartDetailPageWidget, for this property is also the value for the WidgetUIObjectName property that you defined in the JET pattern input XML file. These values must match and must be the same as the value for the WidgetUIObjectName column within the registerWidgetdef.csv Data Load utility input file that you used to register your widget.
    For more information about the generated object definition file for a widget, including the remaining parameters and values that you can define within such a file, see
  4. Update the object definition file to change any of the default generated values or add more definition properties for your widget. Ensure that you update the file to specify an icon for your widget.
    For more information, see Object definitions.
  5. Save and close the file.