Adding a keyboard shortcut for a new custom service

If you have created a custom service for a Management Center business object, you can also associate a keyboard shortcut for the service.

Before you begin

Before you add a keyboard shortcut to the Management Center user interface, ensure you have completed the following steps:
  1. Defined the custom action.
  2. You can use any combination of keys on the keyboard, to create your keyboard shortcut; however, keep the following logistics in mind when creating your keyboard shortcut:
    • Ensure the keyboard shortcut you want to use for the custom action is not one that is already used for the Management Center. If you define a keyboard shortcut that is already used, when the business user uses the keyboard shortcut, two actions will take place.
    • Ensure the keyboard shortcut you want to use for the custom action is not one that is already used for the browser that the business user will use with the Management Center (that is, Internet Explorer or FireFox).
    • The order of the combination of keys is the order that the business user will need to press when using the keyboard shortcut. For example, if you define a keyboard shortcut as shortcutKeys="['Control', '1'], then a business user must hold down the Ctrl key, and then the 1 key on the keyboard.
    • Keyboard shortcuts are not case sensitive. For example, shortcutKeys="['Control', 'p'] and shortcutKeys="['Control', 'P' both mean that a user can press the Ctrl key plus the P key (that is, there is no need for the user to press Ctrl+Shift+P).
    • Keyboard shortcuts can be any number of keys (including a single key), but consider the usability of complicated or lengthy keyboard combinations. Typically, you do not want to create a keyboard shortcut that involves more than three keys.

Procedure

  1. Open WebSphere Commerce Developer and switch to the Enterprise Explorer view.
  2. Complete one of the following steps:
    • WebSphere Commerce Version 7.0.0.0Feature Pack 1In the Enterprise Explorer view, expand LOBTools > WebContent > WEB-INF > src > lzx > commerce > Management_Center_component > objectDefinitions, where Management_Center_component is the name of the tool you want to customize.
    • Introduced in Feature Pack 2In the Enterprise Explorer view, expand LOBTools > WebContent > config > commerce > Management_Center_component > objectDefinitions, where Management_Center_component is the name of the tool you want to customize.
  3. Open the file that contains the custom service declaration that you want to modify.
  4. Complete one of the following steps:
    OptionDescription
    WebSphere Commerce Version 7.0.0.0Feature Pack 1Include the shortcutKeys attribute within the wcfCustomService tag WebSphere Commerce Version 7.0.0.0Feature Pack 1Within your instance of the wcfCustomService class, include the shortcutKeys attribute within the wcfCustomService tag.
    The following example shows how to set up the Ctrl+1 keyboard shortcut to activate a promotion:
    <wcfCustomService url="/jsp/commerce/test/ActivateTestObject.jsp" displayName="Activate" 
    		shortcutKeys="['Control', '1']" toolbarIcon="active">
    			<wcfEnablementCondition propertyName="active" enablementValue="false"/>
    			<wcfServiceParam name="storeId"/>
    			<wcfServiceParam name="testObjectId" propertyName="testObjectId"/>
    	</wcfCustomService>
    Introduced in Feature Pack 2Add the shortcutKeys attribute to the CustomService tag Introduced in Feature Pack 2The following example shows how to set up the Ctrl+1 keyboard shortcut to activate a promotion:
    <CustomService url="/cmc/ActivatePromotion" toolbarIcon="activateToolbarIcon" 
       displayName="${promotionResources.promotionList_activate_displayName}"
       shortcutKeys="['Control', '1']">
       <EnablementCondition conditionId="activate" propertyName="status"
    	enablementValue="Inactive" />
       <ServiceParam name="promotionId" propertyName="promotionId"/>
    </CustomService>

What to do next

After you complete your customization:
Version Steps
  1. Right-click LOBTools Project; then click Build OpenLaszlo Project to produce an updated ManagementCenter.swf file under the workspace_dir\LOBTools\WebContent directory. This setting is the default environment setting.
  2. Test your changes by viewing them in the Management Center, using this URL: https://hostname:8000/lobtools.
  3. Deploy your changes to your production environment.
Introduced in Feature Pack 2
  1. Test your changes by viewing them in the Management Center, using this URL: https://hostname:8000/lobtools.
  2. Deploy your changes to your production environment.