3D PLM Enterprise Architecture |
Webtop |
Creating a Command HeaderCreating a new command header and associating it with a command |
Use Case |
AbstractThis article shows how to create a CommandHeader in the Portal |
This use case is intended to show how to create a new Command Header and how to associate it to a Command.
[Top]
The FoodStoreSelectionCmdHeader is a use case of the CAAJApplicationFrame.edu framework that illustrates the creation of a new Command Header and its association with commands in the Portal application. This use case use the Command and CommandHeader classes from the PortalBase framework.
The Command Header of a Command manages the graphical representation of the
command (For example, by default, it creates a button if the command is added to
a toolbar), it manages the command validity, and the life cycle of the Command
(See how to create a Command [2]). A specific header
can be created for a command, if the validity of this one depends of the CATlet
context (In this use case, the context is the selection state).
During the construction of a CATlet, its workshop is created, and so a Command
Header is created for each command (the one specified in the workshop file,
otherwise the default one). The Command Header creates the view of the command
(for example a button), and sets its validity depending on the CATlet context.
When the end user selects the command view, the command header creates the
command, initializes it, and starts it.
[Top]
The FoodStoreSelectionCmdHeader use case creates a new command header which listens to the modification of the selection content (the content of the CSO [2]). This command header disables its associated commands when the selection is empty, and enables them when the selection contains items.
The FoodStoreSelectionCmdHeader is associated with the PublishBill command in the Food Store use case. When the selection is empty the bill creation is useless, so the PublishBill command is disabled. When the selection contains some items, this command is enabled and allows you to ask for the bill for your food items selection.
[Top]
To launch the FoodStoreSelectionCmdHeader, you will need to set up the build time environment, then compile FoodStoreSelectionCmdHeader and FoodStoreCATlet along with their prerequisites, set up the run time environment, and then execute the use case [1].
Specify the FilePrefix CAAGw0 in the Portal launching command, logon to the Portal and do the following steps:
Publish Bill Command Disabled | Publish Bill Command Enabled |
---|---|
![]() |
![]() |
[Top]
The FoodStoreSelectionCmdHeader use case is one part of a Food Store use case. The FoodStoreSelectionCmdHeader class is located in the CAAGw0FoodStore.mj module of the CAAJApplicationFrame.edu framework:
Windows | InstallRootDirectory\CAAJApplicationFrame.edu\CAAGw0FoodStore.mj\ |
Unix | InstallRootDirectory/CAAJApplicationFrame.edu/CAAGw0FoodStore.mj/ |
where InstallRootDirectory
is the directory where the CAA CD-ROM
is installed.
Top]
To create the FoodStoreSelectionCmdHeader and to associate it with an existing command declared in the workshop file of the CATlet, there are 2 steps:
# | Step | Where |
---|---|---|
1 | Create the selection command header class file | FoodStoreSelectionCmdHeader.java |
2 | Associate the CommandHeader with the Command | FoodStoreCATlet.workshop |
[Top]
The FoodStoreSelectionCmdHeader file is as follows:
package com.dassault_systemes.japplicationframe.caa.catlet.command; ... public class FoodStoreSelectionCmdHeader extends CmdHeader implements CSOListener { public void setMasterCATlet(ICATlet catlet) { // --- must call father implementation in order that all father default treatments be done. super.setMasterCATlet(catlet); // --- subscribes to CSO event catlet.getCSO().addCSOListener(this); // --- updates the header validity setValid(isValid()); } public void cleanup() { // --- must call father implementation in order that father cleanup be done. super.cleanup(); // --- unsubscribes to CSO event if(getMasterCATlet() != null) getMasterCATlet().getCSO().removeCSOListener(this); } public boolean isValid() { // --- gets and tests the CSO of the CATlet. if (getMasterCATlet().getCSO().getSize() > 0) return true; else return false; } public void csoChanged(CSOEvent evt) { // --- updates the CmdHeader validity setValid(isValid()); } ... } |
FoodStoreSelectionCmdHeader derives from CmdHeader class (the default Command Header used by Command when no header is specified in the Workshop file). This Command Header overrides the setMasterCATlet method in order to subsribe to the CSOEvent. It unsuscribes itself to the CSOEvent in the cleanup method for the Garbage Collector. When the Command Header receives a CSOEvent, it updates its validity state. If the CSO is empty, the header invalidates the command representation (for example the button becomes unselectable). If the CSO contains elements, the header validates the command representation (for example the button becomes selectable).
[Top]
The association CmdHeader, Command is made in the workshop file. The FoodStore commands declarations are made in the FoodStoreCATlet.workshop, and the Command Header declaration is made as follows:
# --- FoodStoreCATlet workshop description --- ... # --- Header description --- ... Header3.CommandClass=com.dassault_systemes.japplicationframe.caa.catlet.command.PublishBillCommand Header3.Classname=com.dassault_systemes.japplicationframe.caa.catlet.command.FoodStoreSelectionCmdHeader Header3.Icon=Resources/I_Reporter2.gif Header3.IconFocus=Resources/IF_Reporter2.gif # --- Right toolbar description --- ... |
The command PublishBillCommand is declared in the Food Store Workshop file (See how to create and declare a Command [2] ), and is associated to the specific Command Header FoodStoreSelectionCmdHeader
[Top]
The Command Header of a Command manages the graphical representation of the
command (For example, by default, it creates a button if the command is added to
a toolbar), it manages the command validity, and the life cycle of the Command
(See how to create a Command [2]). A specific header
can be created for a command, if the validity of this one depends of the CATlet
context (In this use case, the context is the selection state).
During the construction of a CATlet, its workshop is created, and so a Command
Header is created for each command (the one specified in the workshop file,
otherwise the default one). The Command Header creates the view of the command
(for example a button), and sets its validity depending on the CATlet context.
When the end user selects the command view, the command header creates the
command, initializes it, and starts it.
[Top]
[1] | Building and Launching a CAA Enovia V5 Use Case |
[2] | Creating a Command |
[Top] |
Version: 1 [Sep 2000] | Document created |
[Top] |
Copyright © 2000, Dassault Systèmes. All rights reserved.