The goog.fx.DragDropGroup Class

goog.fx.DragDropGroup
> goog.fx.AbstractDragDrop
> goog.events.EventTarget
> goog.Disposable

goog.fx.DragDropGroup()

Drag/drop implementation for creating drag sources/drop targets consisting of multiple HTML Elements (items). All items share the same drop target(s) but can be dragged individually.

.addDragDropItem(item)

Add DragDropItem to drag object.

item {goog.fx.DragDropItem}
DragDropItem being added to the drag object.
@throws
Error If no element argument is provided or if the type is invalid

.addEventListener(type, handler, opt_capture, opt_handlerScope)

Inherited from goog.events.EventTarget .

Adds an event listener to the event target. The same handler can only be added once per the type. Even if you add the same handler multiple times using the same type then it will only be called once when the event is dispatched. Supported for legacy but use goog.events.listen(src, type, handler) instead.

type {string}
The type of the event to listen for.
handler {Function|Object}
The function to handle the event. The handler can also be an object that implements the handleEvent method which takes the event object as argument.
opt_capture {boolean=}
In DOM-compliant browsers, this determines whether the listener is fired during the capture or bubble phase of the event.
opt_handlerScope {Object=}
Object in whose scope to call the listener.

.addItem(element, opt_data)

Add item to drag object.

element {Element|string}
Dom Node, or string representation of node id, to be used as drag source/drop target.
opt_data {Object=}
Data associated with the source/target.
@throws
Error If no element argument is provided or if the type is invalid

.addOnDisposeCallback(callback, opt_scope)

Inherited from goog.Disposable .

Invokes a callback function when this object is disposed. Callbacks are invoked in the order in which they were added.

callback {!Function}
The callback function.
opt_scope {Object=}
An optional scope to call the callback in.

.addScrollableContainer(element)

Inherited from goog.fx.AbstractDragDrop .

Makes drag and drop aware of a target container that could scroll mid drag.

element {Element}
The scroll container.

.addTarget(target)

Inherited from goog.fx.AbstractDragDrop .

Associate drop target with drag element.

target {goog.fx.AbstractDragDrop}
Target to add.

.createDragElement(sourceEl)

Inherited from goog.fx.AbstractDragDrop .

Creates an element for the item being dragged.

sourceEl {Element}
Drag source element.
returns {Element}
The new drag element.

.creationStack {string}

Inherited from goog.Disposable .

If monitoring the goog.Disposable instances is enabled, stores the creation stack trace of the Disposable instance.

.dispatchEvent(e)

Inherited from goog.events.EventTarget .

Dispatches an event (or event like object) and calls all listeners listening for events of this type. The type of the event is decided by the type property on the event object. If any of the listeners returns false OR calls preventDefault then this function will return false. If one of the capture listeners calls stopPropagation, then the bubble listeners won't fire.

e {string|Object|goog.events.Event}
Event object.
returns {boolean}
If anyone called preventDefault on the event object (or if any of the handlers returns false this will also return false.

.dispose()

Inherited from goog.Disposable .

Disposes of the object. If the object hasn't already been disposed of, calls {@link #disposeInternal}. Classes that extend {@code goog.Disposable} should override {@link #disposeInternal} in order to delete references to COM objects, DOM nodes, and other disposable objects. Reentrant.

returns {void}
Nothing.

.endDrag(event)

Inherited from goog.fx.AbstractDragDrop .

Event handler that's used to stop drag. Fires a drop event if over a valid target.

event {goog.fx.DragEvent}
Drag event.

.getDragElementPosition(el, dragEl, event)

Inherited from goog.fx.AbstractDragDrop .

Returns the position for the drag element.

el {Element}
Drag source element.
dragEl {Element}
The dragged element created by createDragElement().
event {goog.events.BrowserEvent}
Mouse down event for start of drag.
returns {goog.math.Coordinate}
The position for the drag element.

.getDragger()

Inherited from goog.fx.AbstractDragDrop .

Returns the dragger object.

returns {goog.fx.Dragger}
The dragger object used by this drag and drop instance.

.getParentEventTarget()

Inherited from goog.events.EventTarget .

Returns the parent of this event target to use for bubbling.

returns {goog.events.EventTarget}
The parent EventTarget or null if there is no parent.

.init()

Inherited from goog.fx.AbstractDragDrop .

Initialize drag and drop functionality for sources/targets already added. Sources/targets added after init has been called will initialize themselves one by one.

.isDisposed()

Inherited from goog.Disposable .

returns {boolean}
Whether the object has been disposed of.

.isInitialized()

Inherited from goog.fx.AbstractDragDrop .

Whether the control has been initialized.

returns {boolean}
True if it's been initialized.

.maybeStartDrag(event, item)

Inherited from goog.fx.AbstractDragDrop .

Starts a drag event for an item if the mouse button stays pressed and the cursor moves a few pixels. Allows dragging of items without first having to register them with addItem.

event {goog.events.BrowserEvent}
Mouse down event.
item {goog.fx.DragDropItem}
Item that's being dragged.

.recalculateDragTargets()

Inherited from goog.fx.AbstractDragDrop .

Recalculates the geometry of this source's drag targets. Call this if the position or visibility of a drag target has changed during a drag, or if targets are added or removed. TODO(user): this is an expensive operation; more efficient APIs may be necessary.

.recalculateScrollableContainers()

Inherited from goog.fx.AbstractDragDrop .

Recalculates the current scroll positions of scrollable containers and allocates targets. Call this if the position of a container changed or if targets are added or removed.

.registerDisposable(disposable)

Inherited from goog.Disposable .

Associates a disposable object with this object so that they will be disposed together.

disposable {goog.disposable.IDisposable}
that will be disposed when this object is disposed.

.removeAllScrollableContainers()

Inherited from goog.fx.AbstractDragDrop .

Removes all scrollable containers.

.removeEventListener(type, handler, opt_capture, opt_handlerScope)

Inherited from goog.events.EventTarget .

Removes an event listener from the event target. The handler must be the same object as the one added. If the handler has not been added then nothing is done.

type {string}
The type of the event to listen for.
handler {Function|Object}
The function to handle the event. The handler can also be an object that implements the handleEvent method which takes the event object as argument.
opt_capture {boolean=}
In DOM-compliant browsers, this determines whether the listener is fired during the capture or bubble phase of the event.
opt_handlerScope {Object=}
Object in whose scope to call the listener.

.removeItem(element)

Remove item from drag object.

element {Element|string}
Dom Node, or string representation of node id, that was previously added with addItem().

.removeItems()

Inherited from goog.fx.AbstractDragDrop .

Removes all items.

.setDragClass(className)

Inherited from goog.fx.AbstractDragDrop .

Set class to add to source elements being dragged.

className {string}
Class to be added.

.setParentEventTarget(parent)

Inherited from goog.events.EventTarget .

Sets the parent of this event target to use for bubbling.

parent {goog.events.EventTarget?}
Parent EventTarget (null if none).

.setScrollTarget(scrollTarget)

Inherited from goog.fx.AbstractDragDrop .

Sets the SCROLL event target to make drag element follow scrolling.

scrollTarget {EventTarget}
The element that dispatches SCROLL events.

.setSelection(list)

Marks the supplied list of items as selected. A drag operation for any of the selected items will affect all of them.

list {Array.<goog.fx.DragDropItem>}
List of items to select or null to clear selection. TODO(eae): Not yet implemented.

.setSourceClass(className)

Inherited from goog.fx.AbstractDragDrop .

Set class to add to source elements.

className {string}
Class to be added.

.setSubtargetFunction(f)

Inherited from goog.fx.AbstractDragDrop .

Set a function that provides subtargets. A subtargeting function returns an arbitrary identifier for each subtarget of an element. DnD code will generate additional drag over / out events when switching from subtarget to subtarget. This is useful for instance if you are interested if you are on the top half or the bottom half of the element. The provided function will be given the DragDropItem, box, x, y box is the current window coordinates occupied by element x, y is the mouse position in window coordinates

f {Function}
The new subtarget function.

.setTargetClass(className)

Inherited from goog.fx.AbstractDragDrop .

Set class to add to target elements.

className {string}
Class to be added.

.startDrag(event, item)

Inherited from goog.fx.AbstractDragDrop .

Event handler that's used to start drag.

event {goog.events.BrowserEvent}
Mouse move event.
item {goog.fx.DragDropItem}
Item that's being dragged.