Packagecom.adobe.portfolio.managers
Classpublic class CommandManager
InheritanceCommandManager Inheritance flash.events.EventDispatcher

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

The CommandManager is the central control for navigator commands that directly affect the attachments in the Portfolio, such as previewing, editing, and extracting attachments. It has a cache to keep track of what command need to run and what commands could not be executed because they require a request from the host.



Public Properties
 PropertyDefined By
  instance : CommandManager
[static] [read-only] A CommandManager static instance that can be shared by Flex components.
CommandManager
Protected Properties
 PropertyDefined By
  commandCache : Object = null
An internal cache of host's current commands to be executed.
CommandManager
  pendingCommandMap : Object
An internal map to track commands which could not be executed because they required a request from the host.
CommandManager
Public Methods
 MethodDefined By
  
CommandManager(target:IEventDispatcher = null)
Constructor
CommandManager
  
deleteAttachment(attachment:IAttachment):void
Determines and then executes the appropriate command for deleting the given attachment.
CommandManager
  
Determines and then executes the appropriate command for deleting the set of selected attachments.
CommandManager
  
editAttachment(attachment:IAttachment, previewAppropriateTypes:Boolean = true):void
Determines and then executes the appropriate command for editing the indicated attachment in its native application.
CommandManager
  
Determines and then executes the appropriate command for extracting the given attachment from the Portfolio.
CommandManager
  
Determines and then executes the appropriate command for previewing the indicated attachment.
CommandManager
  
showContextMenu(x:Number, y:Number):void
Executes the appropriate command for popping the context menu.
CommandManager
Protected Methods
 MethodDefined By
  
addPendingCommand(commandType:String, operand:*, arguments:*):void
Adds a command to pendingCommandMap, along with its operand and arguments.
CommandManager
  
getCachedCommand(commandType:String):ICommand
Returns the ICommand of type commandType from the local commandCache, or null if there is no such ICommand in commandCache.
CommandManager
  
invokeCommand(commandType:String, operand:* = null, arguments:Array = null):Boolean
Executes the ICommand of type commandType from the commandCache, or requests the ICommand if it is not current present in commandCache.
CommandManager
  
onCommandsChanged(event:Event):void
Listens for command changes from the host, and executes any pending commands that have become available.
CommandManager
  
Sets up a listener to detect and handle a change of collectionManager's underlying INavigatorHost.
CommandManager
  
setupHost(oldHost:INavigatorHost, newHost:INavigatorHost):void
Performs the shutdown and setup required when the collectionManager's underlying host changes.
CommandManager
Protected Constants
 ConstantDefined By
  collectionManager : CollectionManager
The navigator's CollectionManager instance.
CommandManager
Property Detail
commandCacheproperty
protected var commandCache:Object = null

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

An internal cache of host's current commands to be executed.

instanceproperty 
instance:CommandManager  [read-only]

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

A CommandManager static instance that can be shared by Flex components.


Implementation
    public static function get instance():CommandManager
pendingCommandMapproperty 
protected var pendingCommandMap:Object

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

An internal map to track commands which could not be executed because they required a request from the host.

Constructor Detail
CommandManager()Constructor
public function CommandManager(target:IEventDispatcher = null)

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

Constructor

Parameters
target:IEventDispatcher (default = null)
Method Detail
addPendingCommand()method
protected function addPendingCommand(commandType:String, operand:*, arguments:*):void

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

Adds a command to pendingCommandMap, along with its operand and arguments. The pendingCommandMap tracks commands which could not be executed because they required a request from the host.

Parameters

commandType:String
 
operand:*
 
arguments:*

deleteAttachment()method 
public function deleteAttachment(attachment:IAttachment):void

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

Determines and then executes the appropriate command for deleting the given attachment.

Parameters

attachment:IAttachment

deleteSelection()method 
public function deleteSelection():void

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

Determines and then executes the appropriate command for deleting the set of selected attachments.

editAttachment()method 
public function editAttachment(attachment:IAttachment, previewAppropriateTypes:Boolean = true):void

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

Determines and then executes the appropriate command for editing the indicated attachment in its native application. If previewAppropriateTypes is true then it checks to see if the attachment is an HTML file or SWF file, in which case it will use the preview command instead.

Parameters

attachment:IAttachment
 
previewAppropriateTypes:Boolean (default = true)

See also

CommandType.PREVIEW
CommandType.EDIT_NATIVE
extractAttachment()method 
public function extractAttachment(attachment:IAttachment):void

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

Determines and then executes the appropriate command for extracting the given attachment from the Portfolio.

Parameters

attachment:IAttachment

See also

CommandType.EXTRACT_FILES
getCachedCommand()method 
protected function getCachedCommand(commandType:String):ICommand

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

Returns the ICommand of type commandType from the local commandCache, or null if there is no such ICommand in commandCache.

Parameters

commandType:String

Returns
ICommand
invokeCommand()method 
protected function invokeCommand(commandType:String, operand:* = null, arguments:Array = null):Boolean

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

Executes the ICommand of type commandType from the commandCache, or requests the ICommand if it is not current present in commandCache. Returns true if the command was succesfully executed or requested; returns false if the command is not enabled.

Parameters

commandType:String
 
operand:* (default = null)
 
arguments:Array (default = null)

Returns
Boolean
onCommandsChanged()method 
protected function onCommandsChanged(event:Event):void

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

Listens for command changes from the host, and executes any pending commands that have become available.

Parameters

event:Event

onHostEvent()method 
protected function onHostEvent(event:CollectionManagerEvent):void

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

Sets up a listener to detect and handle a change of collectionManager's underlying INavigatorHost.

Parameters

event:CollectionManagerEvent

previewAttachment()method 
public function previewAttachment(attachment:IAttachment):void

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

Determines and then executes the appropriate command for previewing the indicated attachment.

Parameters

attachment:IAttachment

See also

CommandType.PREVIEW
setupHost()method 
protected function setupHost(oldHost:INavigatorHost, newHost:INavigatorHost):void

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

Performs the shutdown and setup required when the collectionManager's underlying host changes.

Parameters

oldHost:INavigatorHost
 
newHost:INavigatorHost

showContextMenu()method 
public function showContextMenu(x:Number, y:Number):void

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

Executes the appropriate command for popping the context menu.

Parameters

x:Number
 
y:Number

See also

CommandType.CONTEXT_MENU
Constant Detail
collectionManagerConstant
protected const collectionManager:CollectionManager

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

The navigator's CollectionManager instance. All host interaction should go through this instance, rather than the INavigatorHost directly.