PackageTop Level
Classpublic class DockItem

The dock item is the main Appetizer object. It can represent a shortcut or a group. If it is a shortcut, it is normally linked to a file, which can be launched when the user click on the associated icon. If it is a group, it can contain other groups or shortcuts and it is possible to add or remove dock items to/from it. Use the isGroup() function to differentiate between a shortcut and a group.

See also

Icon


Public Methods
 MethodDefined by
  
DockItem(isGroup:Boolean = false)
Constructor.
DockItem
  
addChild(The:DockItem):void
Only applies to groups. Adds a child dock item to this group.
DockItem
  
Adds the shortcut to the multi-launch group.
DockItem
  
autoSetName(name:String):void
Auto-sets the name of the shortcut, based on the shortcut target or any other information that Appetizer can retrieves about the target (such as the file description).
DockItem
  
Tells whether the shortcut belongs to the multi-launch group or not.
DockItem
  
childrenCount():Number
Only applies to groups. Gets the number of children within this group.
DockItem
  
getAllGroups(recursively:Boolean = false):Array
Only applies to groups. Gets all the groups within this group.
DockItem
  
getChildAt(index:Number):void
Only applies to groups. Gets the sub-dock item at the given index.
DockItem
  
getId():Number
Gets the unique id of the dock item.
DockItem
  
getName():String
Gets the name of the dock item.
DockItem
  
getParameters():String
Gets the shortcut parameters (i.e.
DockItem
  
Gets the dock item's parent or nil if it does not have one.
DockItem
  
getPath():String
Gets the shortcut file path, which may include special variables.
DockItem
  
getResolvedPath():String
Gets the resolved / normalized shortcut file path.
DockItem
  
insertChildAt(dockItem:DockItem, index:Number):void
Only applies to groups. Inserts the given dock item at the given index.
DockItem
  
isGroup():Boolean
Tells whether the dock item is a group or not.
DockItem
  
launch(arguments:String = ""):void
Launches the shortcut.
DockItem
  
Removes the shortcut from the multi-launch group.
DockItem
  
Removes the dock item from its parent.
DockItem
  
setName(name:String):void
Sets the dock item name.
DockItem
  
setParameters(parameters:String):void
Sets the shortcut parameters (i.e.
DockItem
  
setPath(path:String):void
Sets the shortcut path.
DockItem
Constructor detail
DockItem()constructor
public function DockItem(isGroup:Boolean = false)

Constructor. When creating a new dock item, you must specify whether it is a group or a shortcut by passing a boolean to the constructor.

Parameters
isGroup:Boolean (default = false) — Set this to true if the new dock item is a group; false if it is a shortcut.
Method detail
addChild()method
public function addChild(The:DockItem):void

Only applies to groups. Adds a child dock item to this group.

Parameters
The:DockItem — dock item to add to the group.

See also


Example
This script create a new shortcut and add it to a group.
  
 -- Create the shortcut  
 shortcut = DockItem:new()  
 shortcut:setPath("c:\\window\\system32\\calc.exe")  
  
 -- Add it to a group  
 someGroup:addChild(shortcut)  
 

addToMultiLaunchGroup()method 
public function addToMultiLaunchGroup():void

Adds the shortcut to the multi-launch group.

autoSetName()method 
public function autoSetName(name:String):void

Auto-sets the name of the shortcut, based on the shortcut target or any other information that Appetizer can retrieves about the target (such as the file description). This is usually the best way to assign a name to a shortcut.

Parameters
name:String — The name.

Example
This script create a new shortcut and auto-assign a name to it.
  
 -- Create the shortcut  
 shortcut = DockItem:new()  
 shortcut:setPath("c:\\window\\system32\\calc.exe")  
 shortcut:autoSetName()  
  
 trace(shortcut:getName()) -- should be "Windows Calculator application file"  
 

belongsToMultiLaunchGroup()method 
public function belongsToMultiLaunchGroup():Boolean

Tells whether the shortcut belongs to the multi-launch group or not.

Returns
Booleantrue if the shortcut belongs to the multi-launch group.
childrenCount()method 
public function childrenCount():Number

Only applies to groups. Gets the number of children within this group.

Returns
Number — The number of children.
getAllGroups()method 
public function getAllGroups(recursively:Boolean = false):Array

Only applies to groups. Gets all the groups within this group.

Parameters
recursively:Boolean (default = false) — Sets this to true to also look for the groups in the sub-groups.

Returns
Array — The groups contained within this group.
getChildAt()method 
public function getChildAt(index:Number):void

Only applies to groups. Gets the sub-dock item at the given index.

Parameters
index:Number — Index of the child to retrieve.
getId()method 
public function getId():Number

Gets the unique id of the dock item. You cannot set the id of a dock item as it is automatically assigned on creation. However you can use this id to refer to or look for a particular dock item.

Returns
Number — ID of the dock item.
getName()method 
public function getName():String

Gets the name of the dock item.

Returns
String — Name of the dock item.
getParameters()method 
public function getParameters():String

Gets the shortcut parameters (i.e. command line arguments).

Returns
String — The parameters.
getParent()method 
public function getParent():DockItem

Gets the dock item's parent or nil if it does not have one.

Returns
DockItem — The parent.
getPath()method 
public function getPath():String

Gets the shortcut file path, which may include special variables.

Returns
String — The file path.

See also

getResolvedPath()method 
public function getResolvedPath():String

Gets the resolved / normalized shortcut file path. It means that every variables is translated and every relative paths are converted to absolute paths. This is useful if you need to pass the shortcut path to an external tool for example. If the file path is not a relative path and does not contain any variables, it will be equal to the resolved path.

Returns
String — The resolved file path.
insertChildAt()method 
public function insertChildAt(dockItem:DockItem, index:Number):void

Only applies to groups. Inserts the given dock item at the given index. If necessary, the dock item is removed from its current parent before being inserted.

Parameters
dockItem:DockItem — The dock item to insert.
 
index:Number — The insertion index.
isGroup()method 
public function isGroup():Boolean

Tells whether the dock item is a group or not.

Returns
Booleantrue if it is a group; false if it is a shortcut.
launch()method 
public function launch(arguments:String = ""):void

Launches the shortcut. You may also specify additional command line arguments.

Parameters
arguments:String (default = "") — Additional arguments.

Example
This script create a new shortcut and launches it with parameters.
  
 shortcut = DockItem:new()  
 shortcut:setPath("explorer.exe")  
 shortcut:launch(" /select,c:\\windows")  
 

removeFromMultiLaunchGroup()method 
public function removeFromMultiLaunchGroup():void

Removes the shortcut from the multi-launch group.

removeFromParent()method 
public function removeFromParent():void

Removes the dock item from its parent.

setName()method 
public function setName(name:String):void

Sets the dock item name.

Parameters
name:String — The name.

See also

setParameters()method 
public function setParameters(parameters:String):void

Sets the shortcut parameters (i.e. command line arguments).

Parameters
parameters:String — The parameters.
setPath()method 
public function setPath(path:String):void

Sets the shortcut path. You may use the special variable $(Drive) to refer to the drive the application is on. For example, $(Drive)\Total Commander\Total Commander Portable.exe would be internally translated to f:\Total Commander\Total Commander Portable.exe if the application is on the f: drive.

Parameters
path:String — The file path.