In this lesson, you need to define the main definition
for the Recipes tool. The tool definition must extend the wcfBusinessObjectEditor
class, which is the base class for all Management Center tools. The
business object editor includes support for the menu, toolbar, search
widget, explorer view and utilities view. It is responsible for managing
all user interactions that allow the user to edit the business objects
declared with this business object editor.
About this task
- A single instance of wcfTopObjectDefinition must be declared as
a child of every business object editor. When the business object
editor is initialized, an instance of this top object is instantiated.
- At least one instance of wcfFilter must be declared as a child
of every business object editor. This filter is used to filter the
objects displayed in the explorer view and utilities view browse tab.
- Multiple instances of wcfOrganizationalObjectDefinition can be
declared as children of a business object editor. Organization objects
are instantiated only by declaring them in the template of the top
object definition or of another organizational object definition.
- At least one instance of wcfPrimaryObjectDefinition must be declared
as a child of every business object editor. There must be a primary
object definition for every type of business object that can be returned
through a search request or can be located by browsing for objects
through the explorer view or utilities view.
- Multiple instances of wcfSearchDefinition can be declared as children
of a business object editor. The search definitions are used to populate
the list of search types available from the search area and utilities
view search tab.
To create the main tool definition class file:
Procedure
- Open WebSphere Commerce Developer and switch to the Enterprise Explorer view.
- Complete one of the following steps:
- In the Enterprise Explorer view,
expand .
- In the Enterprise Explorer view,
expand .
- Right-click the recipe folder and
complete one of the following steps:
- Select to create an OpenLaszlo
class file named RecipeManagementToolDefinition.lzx.
- Select to create a definition file
named RecipeManagementToolDefinition.def.
- Copy and paste the following sample code into one of the
following files and save your changes.
Option | Description |
---|
RecipeManagementToolDefinition.lzx |
<library>
<class name="recRecipeManagement" extends="wcfBusinessObjectEditor"
helpLink="" displayName="${extRecipeResources.recipe_DisplayName.string}"
browseUtilityFilterTypes="MasterCategories,SalesCategories,Recipes"
explorerFilterTypes="Recipes">
<!-- Context value for the master catalog id -->
<wcfContextValue parameterName="masterCatalogId"/>
<catCatalogInitService/>
<!-- Filter definitions -->
<wcfObjectTypeFilter filterType="Recipes" displayName="Recipes" isDefault="true"
objectTypes="RecipeCollectionNode,UnassignedRecipeNode,RecipeCollection" />
<catMasterCatalogGroupsFilter />
<catSalesCatalogGroupsFilter />
<!-- Recipe Top Objects -->
<recRecipeTopObjectDefinition/>
<!-- Recipe Organizational Objects -->
<recUnassignedRecipeOrganizationalObjectDefinition/>
<recRecipeCollectionOrganizationalObjectDefinition/>
<!-- Recipe Primary Objects -->
<recRecipeCollectionPrimaryObjectDefinition/>
<recRecipePrimaryObjectDefinition/>
<!-- search definitions -->
<recFindRecipesSearchDefinition/>
<recFindRecipeCollectionsSearchDefinition/>
</class>
</library>
|
RecipeManagementToolDefinition.def |
<Definitions>
<BusinessObjectEditor browseUtilityFilterTypes="MasterCategories,SalesCategories,Recipes" definitionName="recRecipeManagement" displayName="${extRecipeResources.recipe_DisplayName}" explorerFilterTypes="Recipes" helpLink="">
<!-- Context value for the master catalog id -->
<ContextValue parameterName="masterCatalogId"/>
<InitService baseDefinitionName="catCatalogInitService"/>
<!-- Filter definitions -->
<ObjectTypeFilter displayName="Recipes" filterType="Recipes" isDefault="true" objectTypes="RecipeCollectionNode,UnassignedRecipeNode,RecipeCollection"/>
<ObjectTypeFilter baseDefinitionName="catMasterCatalogGroupsFilter"/>
<ObjectTypeFilter baseDefinitionName="catSalesCatalogGroupsFilter"/>
<!-- Recipe Top Objects -->
<TopObjectDefinition baseDefinitionName="recRecipeTopObjectDefinition"/>
<!-- Recipe Organizational Objects -->
<OrganizationalObjectDefinition baseDefinitionName="UnassignedRecipeNode"/>
<OrganizationalObjectDefinition baseDefinitionName="RecipeCollectionNode"/>
<!-- Recipe Primary Objects -->
<PrimaryObjectDefinition baseDefinitionName="RecipeCollection"/>
<PrimaryObjectDefinition baseDefinitionName="Recipe"/>
<!-- search definitions -->
<SearchDefinition baseDefinitionName="FindRecipes"/>
<SearchDefinition baseDefinitionName="FindRecipeCollections"/>
</BusinessObjectEditor>
</Definitions>
|
- Add the new Recipes tool to the application menu:
- Complete one of the following steps:
- In the Enterprise Explorer view,
expand .
- In the Enterprise Explorer view,
expand .
- Double-click one of the following files to edit the
file:
- ApplicationMenuItems.lzx
- ApplicationMenuItems.def
- Add your new menu definition to the file. Find the line
containing the text
Application menu item for launching WebSphere
Commerce Accelerator
and copy the following code sample before
this line.
<!---
Application menu item for opening the Recipe Management tool.
Customization Part.
-->
<wcfApplicationMenuItem
id="recipeManagement"
width="${parent.width}"
height="25"
activeIconSrc="recipeActiveTabIcon"
inactiveIconSrc="recipeInactiveTabIcon"
displayName="${extRecipeResources.recipe_DisplayName.string}"
usage="MyCompany_RecipeTool"
objectClass="recRecipeManagement"
actionName="openBusinessObjectEditor" />
<!---
Application menu item for opening the Recipe Management tool.
Customization Part.
-->
<ApplicationMenuItem
id="recipeManagement"
activeIconSrc="recipeActiveTabIcon"
inactiveIconSrc="recipeInactiveTabIcon"
displayName="${extRecipeResources.recipe_DisplayName}"
usage="MyCompany_RecipeTool"
toolDefinitionName="recRecipeManagement"
actionName="openBusinessObjectEditor" />
- Right-click the LOBTools project
and select Build OpenLaszlo Project.