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
-
In the Enterprise Explorer view, copy the generated object definition
files for your widget into your default workspace directory structure.
- In your default workspace directory structure, go to the LOBTools\WebContent\WEB-INF\src\xml\mycompany\pagelayout\widgetDefinitions\ShoppingCartDetailPageWidget directory.
-
Open the WidgetObjectDefinition.xml file for editing.
By default the generated code for your widget object definition can resemble the following code:
Where<?xml version="1.0" encoding="UTF-8"?> <Definitions> <WidgetObjectDefinition baseDefinition="cmc/pagelayout/BaseLayoutWidget" definitionName="cmc/pagelayout/LayoutWidget_ShoppingCartDetailPageWidget" gridPropertiesDefinition="cmc/pagelayout/WidgetProperties_ShoppingCartDetailPageWidget" iconPath="/images/pagelayouts/widgetIcons/content_recommend.png" objectType="ShoppingCartDetailPageWidget" package="cmc/pagelayout" parentDefinition="cmc/pagelayout/BasePageLayoutPrimaryObjectDefinition"> <CreateService baseDefinition="cmc/pagelayout/BaseCreateLayoutWidget"/> <UpdateService baseDefinition="cmc/pagelayout/BaseUpdateLayoutWidget"/> <Xml name="template"> <sequence>0</sequence> </Xml> </WidgetObjectDefinition> </Definitions>
- 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.
- 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 theWidgetUIObjectName
property that you defined in the JET pattern input XML file. These values must match and must be the same as the value for theWidgetUIObjectName
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, see Adding Management Center support for a Commerce Composer widget.
-
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.
- Save and close the file.