goog.fx.DragListGroup
Provided By | |
---|---|
Extends | |
All Implemented Interfaces |
A class representing a group of one or more "drag lists" with items that can be dragged within them and between them.
Example usage: var dragListGroup = new goog.fx.DragListGroup(); dragListGroup.setDragItemHandleHoverClass(className1, className2); dragListGroup.setDraggerElClass(className3); dragListGroup.addDragList(vertList, goog.fx.DragListDirection.DOWN); dragListGroup.addDragList(horizList, goog.fx.DragListDirection.RIGHT); dragListGroup.init();
new DragListGroup()
Parameters | None. |
---|
Instance Methods
this.addDragList( dragListElement, growthDirection, opt_unused, opt_dragHoverClass, opt_dragListPermission ) → void
void
Adds a drag list to this DragListGroup. All calls to this method must happen before the call to init(). Remember that all child nodes (except text nodes) will be made draggable to any other drag list in this group.
Parameters |
|
---|
this.addEventListener( type, handler, opt_capture, opt_handlerScope ) → void
void
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.
warning Deprecated | Use |
---|
Defined by | |||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Parameters |
|
this.addItemToDragList( list, item, opt_index ) → void
void
Adds a single item to the given drag list and sets up the drag listeners for it. If opt_index is specified the item is inserted at this index, otherwise the item is added as the last child of the list.
Parameters |
|
---|
this.addOnDisposeCallback<T>( callback, opt_scope ) → void
void
Invokes a callback function when this object is disposed. Callbacks are invoked in the order in which they were added. If a callback is added to an already disposed Disposable, it will be called immediately.
Defined by | |||||||||
---|---|---|---|---|---|---|---|---|---|
Parameters |
|
this.createDragElementInternal( sourceEl ) → Element
Element
Generates an element to follow the cursor during dragging, given a drag
source element. The default behavior is simply to clone the source element,
but this may be overridden in subclasses. This method is called by
createDragElement()
before the drag class is added.
Parameters |
| ||||
---|---|---|---|---|---|
Returns |
|
this.dispatchEvent( e ) → boolean
boolean
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.
Overrides | |||||
---|---|---|---|---|---|
Specified by | |||||
Parameters |
| ||||
Returns |
|
this.dispose() → ?
?
Disposes of the object and its resources.
Overrides | ||
---|---|---|
Specified by | ||
Parameters | None. | |
Returns |
|
this.disposeInternal() → void
void
Removes listeners from this object. Classes that extend EventTarget may need to override this method in order to remove references to DOM Elements and additional listeners.
Overrides | |
---|---|
Parameters | None. |
this.fireListeners<EVENTOBJ>( type, capture, eventObject ) → boolean
boolean
Fires all registered listeners in this listenable for the given type and capture mode, passing them the given eventObject. This does not perform actual capture/bubble. Only implementors of the interface should be using this.
Overrides | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Specified by | |||||||||||||
Parameters |
| ||||||||||||
Returns |
|
this.getDisposed() → boolean
boolean
warning Deprecated | Use |
---|
Defined by | |||
---|---|---|---|
Parameters | None. | ||
Returns |
|
this.getHysteresis() → number
number
Parameters | None. | ||
---|---|---|---|
Returns |
|
this.getListener<SCOPE, EVENTOBJ>( type, listener, capture, opt_listenerScope ) → (goog.events.ListenableKey|null)
(goog.events.ListenableKey|null)
Gets the goog.events.ListenableKey for the event or null if no such listener is in use.
Overrides | |||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Specified by | |||||||||||||||||
Parameters |
| ||||||||||||||||
Returns |
|
this.getListeners<EVENTOBJ>( type, capture ) → Array<goog.events.ListenableKey>
Array<goog.events.ListenableKey>
Gets all listeners in this listenable for the given type and capture mode.
Overrides | |||||||||
---|---|---|---|---|---|---|---|---|---|
Specified by | |||||||||
Parameters |
| ||||||||
Returns |
|
this.getParentEventTarget() → (goog.events.Listenable|null)
(goog.events.Listenable|null)
Returns the parent of this event target to use for capture/bubble mechanism.
NOTE(chrishenry): The name reflects the original implementation of
custom event target (goog.events.EventTarget
). We decided
that changing the name is not worth it.
Overrides | |||
---|---|---|---|
Specified by | |||
Parameters | None. | ||
Returns |
|
this.hasListener<EVENTOBJ>( opt_type, opt_capture ) → boolean
boolean
Whether there is any active listeners matching the specified signature. If either the type or capture parameters are unspecified, the function will match on the remaining criteria.
Overrides | |||||||||
---|---|---|---|---|---|---|---|---|---|
Specified by | |||||||||
Parameters |
| ||||||||
Returns |
|
this.init() → void
void
Performs the initial setup to make all items in all lists draggable.
this.insertCurrHoverItem() → void
void
Inserts the currently dragged item in its new place.
This method is used for insertion only when updateWhileDragging_ is false (otherwise there is no need for that). In the basic implementation the element is inserted before the currently hovered over item (this can be changed by overriding the method in subclasses).
this.isDisposed() → boolean
boolean
Overrides | |||
---|---|---|---|
Specified by | |||
Parameters | None. | ||
Returns |
|
this.isDragging() → boolean
boolean
Parameters | None. | ||
---|---|---|---|
Returns |
|
this.listen<SCOPE, EVENTOBJ>( type, listener, opt_useCapture, opt_listenerScope ) → goog.events.ListenableKey
goog.events.ListenableKey
Adds an event listener. A listener can only be added once to an object and if it is added again the key for the listener is returned. Note that if the existing listener is a one-off listener (registered via listenOnce), it will no longer be a one-off listener after a call to listen().
Overrides | |||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Specified by | |||||||||||||||||
Parameters |
| ||||||||||||||||
Returns |
|
this.listenForDragEvents( dragItem ) → void
void
Listens for drag events on the given drag item. This method is currently used to initialize drag items.
Parameters |
|
---|
this.listenOnce<SCOPE, EVENTOBJ>( type, listener, opt_useCapture, opt_listenerScope ) → goog.events.ListenableKey
goog.events.ListenableKey
Adds an event listener that is removed automatically after the listener fired once.
If an existing listener already exists, listenOnce will do nothing. In particular, if the listener was previously registered via listen(), listenOnce() will not turn the listener into a one-off listener. Similarly, if there is already an existing one-off listener, listenOnce does not modify the listeners (it is still a once listener).
Overrides | |||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Specified by | |||||||||||||||||
Parameters |
| ||||||||||||||||
Returns |
|
this.overrideCorrectDraggedElementInitialPos( updateInitialPosition ) → void
void
Sets the correctDraggedElementInitialPos_ private property. This override the DRAGLISTGROUP_CORRECT_POSITION_DRAG_START compile flag, to allow for a per component control within a project.
Parameters |
|
---|
this.recacheListAndItemBounds() → void
void
Caches the heights of each drag list and drag item, except for the current drag item.
this.registerDisposable( disposable ) → void
void
Associates a disposable object with this object so that they will be disposed together.
Defined by | |||||
---|---|---|---|---|---|
Parameters |
|
this.removeAllListeners( opt_type ) → number
number
Removes all listeners from this listenable. If type is specified, it will only remove listeners of the particular type. otherwise all registered listeners will be removed.
Overrides | |||||
---|---|---|---|---|---|
Specified by | |||||
Parameters |
| ||||
Returns |
|
this.removeEventListener( type, handler, opt_capture, opt_handlerScope ) → void
void
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.
warning Deprecated | Use |
---|
Defined by | |||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Parameters |
|
this.setCurrDragItemClass( ...var_args ) → void
void
Sets a user-supplied CSS class to add to the current drag item (during a drag action).
If not set, the default behavior adds visibility:hidden to the current drag item so that it is a block of empty space in the hover drag list (if any). If this class is set by the user, then the default behavior does not happen (unless, of course, the class also contains visibility:hidden).
Parameters |
|
---|
this.setDragItemHandleHoverClass( ...var_args ) → void
void
Sets a user-supplied CSS class to add to a drag item handle on hover (not during a drag action).
Parameters |
|
---|
this.setDragItemHoverClass( ...var_args ) → void
void
Sets a user-supplied CSS class to add to a drag item on hover (not during a drag action).
Parameters |
|
---|
this.setDraggerElClass( draggerElClass ) → void
void
Sets a user-supplied CSS class to add to the clone of the current drag item that's actually being dragged around (during a drag action).
Parameters |
|
---|
this.setFunctionToGetHandleForDragItem( getHandleForDragItemFn ) → void
void
Sets a user-supplied function used to get the "handle" element for a drag item. The function must accept exactly one argument. The argument may be any drag item element.
If not set, the default implementation uses the whole drag item as the handle.
Parameters |
|
---|
this.setHysteresis( distance ) → void
void
Sets the distance the user has to drag the element before a drag operation is started.
Parameters |
|
---|
this.setIsCurrDragItemAlwaysDisplayed() → void
void
Sets the property of the currDragItem that it is always displayed in the list.
this.setNoUpdateWhileDragging() → void
void
Sets the private property updateWhileDragging_ to false. This disables the update of the position of the currDragItem while dragging. It will only be placed to its new location once the drag ends.
this.setParentEventTarget( parent ) → void
void
Sets the parent of this event target to use for capture/bubble mechanism.
Defined by | |||||
---|---|---|---|---|---|
Parameters |
|
this.setTargetForTesting( target ) → void
void
Sets the target to be used for event.target
when firing
event. Mainly used for testing. For example, see
goog.testing.events.mixinListenable
.
Defined by | |||||
---|---|---|---|---|---|
Parameters |
|
this.unlisten<SCOPE, EVENTOBJ>( type, listener, opt_useCapture, opt_listenerScope ) → boolean
boolean
Removes an event listener which was added with listen() or listenOnce().
Overrides | |||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Specified by | |||||||||||||||||
Parameters |
| ||||||||||||||||
Returns |
|
this.unlistenByKey( key ) → boolean
boolean
Removes an event listener which was added with listen() by the key returned by listen().
Overrides | |||||
---|---|---|---|---|---|
Specified by | |||||
Parameters |
| ||||
Returns |
|
this.updateCurrHoverItem( hoverNextItem, opt_draggerElCenter ) → void
void
Updates the value of currHoverItem_.
This method is used for insertion only when updateWhileDragging_ is false. The below implementation is the basic one. This method can be extended by a subclass to support changes to hovered item (eg: highlighting). Parametr opt_draggerElCenter can be used for more sophisticated effects.
Parameters |
|
---|
Instance Properties
this.creationStack → (string|undefined)
(string|undefined)
If monitoring the goog.Disposable instances is enabled, stores the creation stack trace of the Disposable instance.
Compiler Constants
goog.fx.DragListGroup.CORRECT_POSITION_DRAG_START → boolean
boolean
Whether to attempt correcting the initial position of the currDragItem to ensures that the mouse cursor is always over the dragged element. This is needed in cases where the dragged element dimensions are smaller than its source element dimensions.