Zimlet JavaScript API Reference - ZmOperation

Class ZmOperation


This class provides the idea of an "operation", which is a user-initiated action exposed through a button or menu item. Many operations (such as Delete) are shared across applications/controllers. An operation gets defined by specifying its name, tool tip, and image. Then controllers can simply select which operations they'd like to support.

The two primary clients of this class are ZmButtonToolBar and ZmActionMenu. Clients should support #createOp and #getOp methods. See the two aforementioned clients for examples.

Defined in: ZmOperation.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
Creates the operation object.
Method Summary
Method Attributes Method Name and Description
<static>  
ZmOperation.addColorMenu(parent, hideNoFill)
Adds a color submenu for choosing tag color.
<static>  
ZmOperation.addContactGroupMenu(parent)
Adds a contact group menu for creating a contacts from the contact list
<static>  
ZmOperation.addDeferredMenu(addMenuFunc, parent)
Adds a deferred menu.
<static>  
ZmOperation.addMoveMenu(parent)
Adds a "Move" submenu for tagging items.
<static>  
ZmOperation.addNewMenu(parent)
Adds a "New" submenu.
<static>  
ZmOperation.addOperation(parent, id, opHash, index, htmlElId)
Adds the operation.
<static>  
ZmOperation.addSearchMenu(parent)
Adds a "Search" submenu for searching from/to sender/recipient.
<static>  
ZmOperation.addTagMenu(parent)
Adds a "Tag" submenu for tagging items.
<static>  
ZmOperation.createOperations(parent, operations, overrides)
Creates operation descriptors for the given operation IDs, then creates the appropriate widget for each operation based on the type of the parent.
<static>  
ZmOperation.defineOperation(baseId, overrides)
Creates an operation descriptor.
<static>  
ZmOperation.filterOperations(list)
Takes a list of operations and removes any who have a corresponding setting that's not set.
<static>  
ZmOperation.getProp(id, prop)
Gets the value of a given property for a given operation.
<static>  
ZmOperation.getToolTip(id, keyMap, tooltip)
Gets the tooltip for the operation with the given ID.
<static>  
ZmOperation.initialize()
Initializes and creates standard operations.
<static>  
ZmOperation.isSep(id)
Checks if the operation is a separator or spacer.
<static>  
ZmOperation.registerOp(op, params:, text, tooltip, image, disImage, precondition, precondition, callback)
Defines the aspects of an operation, and the ID that refers to it.
<static>  
ZmOperation.removeOperation(parent, id, opHash)
Removes the operation.
<static>  
ZmOperation.setOperation(parent, oldOp, newOp, text, image, disImage)
Replaces the attributes of one operation with those of another, wholly or in part.
Class Detail
ZmOperation()
Creates the operation object.
Author: Conrad Damon.
Method Detail
<static> {ZmPopupMenu} ZmOperation.addColorMenu(parent, hideNoFill)
Adds a color submenu for choosing tag color.
Parameters:
{DwtComposite} parent
parent widget (a toolbar or action menu)
{boolean} hideNoFill
True to hide the no-fill/use-default option.
Returns:
{ZmPopupMenu} the menu

<static> ZmOperation.addContactGroupMenu(parent)
Adds a contact group menu for creating a contacts from the contact list
Parameters:
{DwtComposite} parent
parent widget (a toolbar or action menu)
Returns:
{ZmActionMenu) the menu

<static> ZmOperation.addDeferredMenu(addMenuFunc, parent)
Adds a deferred menu.
Parameters:
{function} addMenuFunc
the add menu function
{DwtComposite} parent
the containing widget (toolbar or menu)

<static> {ZmTagMenu} ZmOperation.addMoveMenu(parent)
Adds a "Move" submenu for tagging items.
Parameters:
{DwtComposite} parent
parent widget (a toolbar or action menu)
Returns:
{ZmTagMenu} the menu

<static> {ZmActionMenu} ZmOperation.addNewMenu(parent)
Adds a "New" submenu. Overrides are used because we don't want "New" at the beginning of each label.
Parameters:
{DwtComposite} parent
the parent widget
Returns:
{ZmActionMenu} the menu

<static> ZmOperation.addOperation(parent, id, opHash, index, htmlElId)
Adds the operation.
Parameters:
{DwtComposite} parent
the containing widget (toolbar or menu)
{String} id
the id
{Hash} opHash
a hash
{String} index Optional
the index
htmlElId

<static> {ZmActionMenu} ZmOperation.addSearchMenu(parent)
Adds a "Search" submenu for searching from/to sender/recipient.
Parameters:
{DwtComposite} parent
parent widget (a toolbar or action menu)
Returns:
{ZmActionMenu} the menu

<static> {ZmTagMenu} ZmOperation.addTagMenu(parent)
Adds a "Tag" submenu for tagging items.
Parameters:
{DwtComposite} parent
parent widget (a toolbar or action menu)
Returns:
{ZmTagMenu} the menu

<static> {Hash} ZmOperation.createOperations(parent, operations, overrides)
Creates operation descriptors for the given operation IDs, then creates the appropriate widget for each operation based on the type of the parent. If it's a toolbar, then buttons are created. If it's a menu, menu items are created.

To override or add properties to a particular operation, pass in a hash of properties and values as a value in overrides, with the operation ID as the key.

Parameters:
{DwtComposite} parent
the containing widget (toolbar or menu)
{Array} operations
a list of operation IDs
{Hash} overrides
a hash of overrides by op ID
Returns:
{Hash} a hash of operations by ID

<static> ZmOperation.defineOperation(baseId, overrides)
Creates an operation descriptor. The ID of an existing operation can be passed in to use as a base, with overridden properties passed in a hash. A new operation can be defined by passing its properties in a hash.
Parameters:
{String} baseId
the ID of an existing operation
{Hash} overrides
the property overrides for the operation

<static> {Array} ZmOperation.filterOperations(list)
Takes a list of operations and removes any who have a corresponding setting that's not set. Also deals with the fact that you don't want a separator or a spacer unless there's stuff on either side of it.
Parameters:
{Array} list
a list of {ZmOperation} objects
Returns:
{Array} a list of {ZmOperation} objects

<static> {Object} ZmOperation.getProp(id, prop)
Gets the value of a given property for a given operation.
Parameters:
{String} id
the operation ID
{String} prop
the name of an operation property
Returns:
{Object} the value

<static> {String} ZmOperation.getToolTip(id, keyMap, tooltip)
Gets the tooltip for the operation with the given ID. If the operation has a shortcut associated with it, a shortcut hint is appended to the end of the tooltip.
Parameters:
{String} id
the operation ID
{String} keyMap
the key map (for resolving shortcut)
{String} tooltip
the tooltip override
Returns:
{String} the tool tip

<static> ZmOperation.initialize()
Initializes and creates standard operations.

<static> {Boolean} ZmOperation.isSep(id)
Checks if the operation is a separator or spacer.
Parameters:
{String} id
the id
Returns:
{Boolean} true if the operation is a spacer

<static> ZmOperation.registerOp(op, params:, text, tooltip, image, disImage, precondition, precondition, callback)
Defines the aspects of an operation, and the ID that refers to it.
Parameters:
{String} op
the name of the operation
{hash} params:
{String} text
the msg key for button or menu item text
{String} tooltip
the msg key for tooltip text
{String} image
the icon class for the button or menu item
{String} disImage
the disabled version of image; defaults to image + "Dis"
{Boolean|String|Function} precondition
(overrides setting if present)
{constant} precondition
must evaluate to true for this operation not to be filtered out
{AjxCallback} callback
the callback to run after this operation has been created

<static> ZmOperation.removeOperation(parent, id, opHash)
Removes the operation.
Parameters:
{DwtComposite} parent
the containing widget (toolbar or menu)
{String} id
the id
{Hash} opHash
a hash

<static> ZmOperation.setOperation(parent, oldOp, newOp, text, image, disImage)
Replaces the attributes of one operation with those of another, wholly or in part.
Parameters:
{DwtComposite} parent
the parent widget
{String} oldOp
the ID of operation to replace
{String} newOp
the ID of new operation to get replacement attributes from
{String} text
the new text (overrides text of newOp)
{String} image
the new image (overrides image of newOp)
{String} disImage
the new disabled image (overrides that of newOp)

Documentation generated by JsDoc Toolkit 2.3.0 on Tue Jun 28 2016 21:01:35 GMT-0400 (EDT)