Site Manager Developer Manual / Version 2304
Table Of ContentsAfter you have written your command, you need to register it at the CommandManager, at the ListenerManager and at the manager of the chosen GUI element. This will make the command usable and visible. Optionally, you may associate your command with an activation model. These models activate or deactivate the command depending on a specific condition. See the field summary in the Javadoc of the DocumentView for the available activation models. To register your command proceed as follows:
Step | Description |
---|---|
1. |
Extend the view class. |
class MyView extends hox.corem.editor.generic.GenericDocumentView | |
2. |
Get a CommandManager. |
CommandManager commandMgr = getCommandManager();
| |
3. |
Register your command at the CommandManager. |
commandMgr.registerCommand("my-first-command", new
com.coremedia.extensions.MyFirstCommand());
| |
4. | If you want to associate your command with an activation model you have to
call the associateActivationModel() method. See the field summary of
the DocumentView class for the available activation models.
|
commandMgr.associateActivationModel("my-first-command", approveModel);
| |
5. |
Get a manager for the GUI component in which you want to insert your command. Possible are: |
| |
6. |
Get a ListenerManager in order to make your command live. |
ListenerManager listenerMgr = getListenerManager();
| |
7. |
If you want to insert your command in the tool bar or in a pop-up menu you need to get one. |
JToolBar toolBar = toolBarMgr.getToolBar(); or JPopupMenu popUpMenu =
popupMenuMgr.getPopupMenu();
| |
8. | Add your command to the ListenerManager and to the GUI component at once. |
|
Table 4.7. Register a new command