Class Index | File Index

Classes


Class Alfresco.util.DragAndDrop

Defined in: alfresco-dnd.js
Constructor Summary
Constructor Attributes Constructor Name and Description
 
Alfresco.util.DragAndDrop constructor.
Field Summary
Field Attributes Field Name and Description
 
To let various methods know what draggable that is currently selected, if any.
 
An object to store info about the draggables that needs to be accessed easily.
 
Cache for YAHOO.util.KeyListener objects for each draggable-li.
 
A reference to the "invisible" object that is used to "make space" for the dragged element.
 
An object to store info about the draggables that needs to be accessed easily.
Method Summary
Method Attributes Method Name and Description
 
copyAndInsertDraggable(srcEl, destUl, insertBeforeNode)
Creates a copy of the dragged draggable 'srcEl' and inserts in column
 
Deletes the draggable from the Dom.
 
Gives or takes the focus from 'li' depending on 'focus'.
 
Helper function to get the container.
 
Helper function to get the index of the draggable's column.
 
Helper function to get the index of the draggable's column.
 
Helper function to get the index of the draggable's column.
 
Returns the anchors that are visible in the ui.
 
invokeCallback(action, li)
Invokes the callback set for the draggables container and returns the result of the callback.
 
Helper function to determine if a column can't fit anymore draggables.
 
isDraggableInGroup(el, group)
Helper function to determine if an element is an add drop target.
 
Helper function to determine if draggable is "protected", in other word that a "original" of the dragable
 
isOfTagType(el, tagType)
Helper function to determine if an element (el) is a certain type (tagType).
 
Helper function to determine if el is a draggable.
 
Helper function to determine if a column can't fit anymore draggables.
 
isTargetInGroup(el, group)
Helper function to determine if an element is an add drop target.
 
onDraggableBlur(event, obj)
Fired when the user tabs from a "draggable" (or selects another draggable or something else).
 
onDraggableFocus(event, obj)
Fired when the user tabs to a draggable (or clicks the draggable).
 
onKeyPressed(event, id)
Listens to key events for the currently selected draggable
Constructor Detail
Alfresco.util.DragAndDrop(config)
Alfresco.util.DragAndDrop constructor.
Parameters:
{object} config
The object describing how the drag n drop shall be setup config.shadow {HTMLElement} config.draggables {array} config.draggables[].container {HTMLElement} config.draggables[].groups {string} Alfresco.util.DragAndDrop.GROUP_XXX config.draggables[].cssClass {string} config.draggables[].protect {boolean} config.draggables[].duplicatesOnEnterKey {boolean} config.draggables[].movesOnEnterKey {boolean} // duplicatesOnEnterKey takes precendence if both are set to true config.draggables[].vertical: {boolean} Default: false config.targets {array} config.targets[].container {HTMLElement} config.targets[].group {string} Alfresco.util.DragAndDrop.GROUP_MOVE config.targets[].maximum {int}
Returns:
{Alfresco.util.DragAndDrop} The new DragAndDrop instance
Field Detail
{HTMLElement of type li} currentEl
To let various methods know what draggable that is currently selected, if any.

{object} draggables
An object to store info about the draggables that needs to be accessed easily.

{object} keyListeners
Cache for YAHOO.util.KeyListener objects for each draggable-li.

{HTMLElement of type li} shadow
A reference to the "invisible" object that is used to "make space" for the dragged element.

{object} targets
An object to store info about the draggables that needs to be accessed easily.
Method Detail
copyAndInsertDraggable(srcEl, destUl, insertBeforeNode)
Creates a copy of the dragged draggable 'srcEl' and inserts in column
'destUl' before 'insertBeforeNode'.
Parameters:
{HTMLElement} srcEl
of type li
{HTMLElement} destUl
of type ul
{HTMLElement} insertBeforeNode
of type li

deleteDraggable(li)
Deletes the draggable from the Dom.
Parameters:
{HTMLElement} li
of type li (the draggable to be deleted)

focusDraggableAfterDomChange(li, focus)
Gives or takes the focus from 'li' depending on 'focus'.
Should be called when a Dom change has occured to "restore" the focus.
Parameters:
{HTMLElement} li
of type li
{boolean} focus
true if li should get focus, false if it should loose focus

{int} getContainer(el)
Helper function to get the container.
Parameters:
{HTMLElement} el
of type li (the draggable) or ul (the container)
Returns:
{int} the column index

{int} getDraggableColumnIndex(el)
Helper function to get the index of the draggable's column.
Parameters:
{HTMLElement} el
of type li or ul (the draggable)
Returns:
{int} the column index

{HTMLElement} getTargetByIndex(index)
Helper function to get the index of the draggable's column.
Parameters:
{int} index
of type li or ul (the draggable)
Returns:
{HTMLElement} the target element at position defined by index

{int} getTargetIndex(el)
Helper function to get the index of the draggable's column.
Parameters:
{HTMLElement} el
of type li or ul (the draggable)
Returns:
{int} the column index

getVisibleAnchors(li)
Returns the anchors that are visible in the ui.
Parameters:
li
Returns:
the visible anchor elements in the ui

invokeCallback(action, li)
Invokes the callback set for the draggables container and returns the result of the callback.
Parameters:
action
li
Returns:
True if the default behaviour after this action shall be executed (If the callback didn't return false).

{boolean} isContainerVertical(ul)
Helper function to determine if a column can't fit anymore draggables.
Parameters:
{HTMLElement} ul
of type ul (the draggable column)
Returns:
{boolean} true if column is full

{boolean} isDraggableInGroup(el, group)
Helper function to determine if an element is an add drop target.
Parameters:
{HTMLElement} el
of type li or ul to test
{string} group
The group to match against
Returns:
{boolean} true if el should be considered as a memeber of group

{int} isDraggableProtected(li)
Helper function to determine if draggable is "protected", in other word that a "original" of the dragable
shall be left and that a "copy" of the dragged around instead.
Parameters:
{HTMLElement} li
of type li (the draggable)
Returns:
{int} the column index

{boolean} isOfTagType(el, tagType)
Helper function to determine if an element (el) is a certain type (tagType).
Parameters:
{HTMLElement} el
element to test tag type of
{string} tagType
tag type
Returns:
{boolean} true if el's tag type is same as tagType

{boolean} isRealDraggable(el)
Helper function to determine if el is a draggable.
Checked performed by looking of it hasn't got class "dnd-shadow".
Parameters:
{HTMLElement} el
element to test
Returns:
{boolean} true if el hasn't got class "dnd-shadow"

{boolean} isTargetFull(ul)
Helper function to determine if a column can't fit anymore draggables.
Parameters:
{HTMLElement} ul
of type ul (the draggable column)
Returns:
{boolean} true if column is full

{boolean} isTargetInGroup(el, group)
Helper function to determine if an element is an add drop target.
Parameters:
{HTMLElement} el
of type li or ul to test
{string} group
The group to match against
Returns:
{boolean} true if el should be considered as a memeber of group

onDraggableBlur(event, obj)
Fired when the user tabs from a "draggable" (or selects another draggable or something else).
Since browsers only gives focus on links and form elements its actually a hidden link that loses
the focus and makes this method get called.

Removes the "dnd-focused" css class from the draggable-li so it appears to be de-focused or de-selected.
Removes the keylistener for the draggable.
Parameters:
{object} event
a "blur" event
obj

onDraggableFocus(event, obj)
Fired when the user tabs to a draggable (or clicks the draggable).
Since browsers only gives focus on links and form elements its actually a hidden link that gets the focus
and makes this method get called.

Adds the "dnd-focused" class to the draggable-li so it appears to be focused or selected.
Adds a keylistener for this draggable so we can listen for keystrokes.
Parameters:
{object} event
a "focus" event
obj

onKeyPressed(event, id)
Listens to key events for the currently selected draggable
(or in reality currently focused a href element).

Will do the following for draggable in a column:
- move the draggable between columns when LEFT or RIGHT is clicked.
- mode the draggable in the current column when UP or DOWN is clicked.
- delete the draggable when DELETE is clicked.
- deselect a draggable when ESCAPE is clicked.

Will do the following for draggable available to columns:
- add a draggable to the first target column with free space if ENTER is clicked.
Parameters:
{object} event
a "key" event
id

Documentation generated by JsDoc Toolkit 2.4.0 on Thu Feb 16 2012 12:24:28 GMT-0000 (GMT)