Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 1273 lines (887 sloc) 56.156 kb
fcc4fff @phiggins42 monster commit from moinconverter, which is always done prior to the svn...
phiggins42 authored
1 .. _dojo/dnd:
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
2
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
3 ========
4 dojo/dnd
5 ========
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
6
8e25854 @wkeese :Available: --> :since:
wkeese authored
7 :since: 0.9
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
8 :Author: Eugene Lazutkin
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
9
c15cbf2 @wkeese standardize spacing on directives like .. js
wkeese authored
10 .. contents ::
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
11 :depth: 2
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
12
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
13 The drag and drop (DnD) package/system of Dojo.
14
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
15 Introduction
16 ============
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
17
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
18 **dojo/dnd** provides the basic user interface concepts of "drag and drop" where a user interface element it clicked,
19 dragged and then dropped in another location. ``dojo/dnd`` uses an "avatar" to represent objects that are being dragged
20 from one location to another. As the avatar is shifted, it is designed to not obscure objects under the mouse giving
21 better visibility. Additionally, it is possible to represent objects in the Avatar_ differently, which is described in
36d5421 @wkeese fix broken links
wkeese authored
22 detail below. A special sub-package ``dojo/dnd/Moveable`` accommodates direct movement of elements in the *old style* of
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
23 Dojo Drag and Drop (version 0.4).
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
24
36d5421 @wkeese fix broken links
wkeese authored
25 DnD (both :ref:`dojo.dnd <dojo/dnd>` and :ref:`dojo.dnd.Moveable <dojo/dnd/Moveable>` packages) is implemented as a state
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
26 machine, which reflects its state by adding and removing CSS classes to relevant objects, which gives the ultimate
27 flexibility over customizing the look-and-feel.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
28
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
29 Every DnD container and DnD item has the concept of a type. The type is represented by a unique text string. Every
30 container and item has an array of types assigned to them. In order to transfer (drop) items on a container they should
31 have at least one type in common. When transferring a group of items to a container all items should have at least one
32 type in common with the container. Otherwise the transfer is denied. If the list of types is not specified ``["text"]``
33 is assumed.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
34
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
35 ``dojo/dnd`` supports copy and move styles with DnD out of the box.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
36
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
37 User interface
38 --------------
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
39
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
40 The existing implementation supports a *linear* container paradigm:
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
41
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
42 * Selection of an item on a mouse *click*.
43
44 * Adding an item to the existing selection by *ctrl+click*.
45
46 * Selecting a range of items by *shift+click*.
47
48 * Adding a range of items by *ctrl+shift+click*.
49
50 *Note* On a Macintosh the Meta key is used instead of the Ctrl key.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
51
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
52 *Note* In order to show an insertion point correctly, it is possible to specify if we are dealing with a vertical or
53 horizontal container.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
54
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
55 See Selector_ for more details.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
56
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
57 dojo/dnd Principals
58 ===================
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
59
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
60 The ``dojo/dnd`` consists of 5 classes: Container_, Selector_, Source_, Manager_, and Avatar_. The first three classes
61 are responsible for DnD sources and targets. The last two classes are singletons responsible for orchestration of DnD on
62 the web page.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
63
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
64 Container
65 ---------
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
66
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
67 The default implementation of ``dojo/dnd/Container`` represents a uniform linear collection of items. It knows when the mouse hovers over it, and when the mouse hovers over a particular item.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
68
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
69 The draggable item is represented by an abstract data object, which can be anything. There is a function ``creator``, which is called when we need to visualize a data item for the container_, or for the avatar_. It allows us to have different representations of the same data item in different containers and in the avatar_. More on that later.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
70
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
71 Constructor
72 ~~~~~~~~~~~
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
73
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
74 Constructor take two parameters:
75
76 ``node``
77 A DOM node or the String ID of a node. This node represents a container. All draggable items will be direct
78 descendants of this node (the important exception: a ``<table>`` node, in this case items will be direct descendants
79 of the embedded ``<tbody>`` node). If you want to override this default behavior, use ``dropParent`` attribute of
80 ``params`` (see below).
81
82 ``params``
83 a dictionary object, which defines optional parameters. Following optional parameters are recognized:
84
85 ``creator(item, hint)``
86 A creator function, which is used to build a representation of the data item.
87
88 ``item``
89 a data item (an abstract object), which defines a draggable object. The creator function is solely responsible for
90 the interpretation of this item.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
91
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
92 ``hint``
93 An optional string, which hints at the purpose of the call. The creator function can use it to produce different
94 visual representations. At the moment only one value is defined: ``"avatar"``. When ``hint == "avatar"`` the creator
95 can produce a special version for the avatar.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
96
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
97 ``type``
98 An array of strings, which identify the type of this item. It is used during the DnD operation to select compatible
99 targets.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
100
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
101 ``skipForm``
102 If it is ``true``, the container passes selection and dragging operations to the browser, otherwise it suppresses
103 them. It is useful when draggable items include text form elements that can be edited. By default it is ``false``.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
104
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
105 ``dropParent``
106 a DOM node below the main node, which serves as a physical container for data item nodes. It can be used to
107 structure the visual design of your container. This value will be assigned to ``parent`` attribute of the container
108 (see below).
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
109
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
110 During the construction the constructor checks immediate children of ``parent`` attribute (see below) for the presence
111 of ``dojoDndItem`` class. All such items are added as container's children automatically. It is assumed that you already
112 built the visual representation of the data item, so the creator function is not involved. Instead the necessary triplet
113 is formed like this:
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
114
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
115 ``node``
116 the node itself. If it doesn't have an id, a unique id is generated for it.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
117
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
118 ``data``
119 the content of ``dndData`` member of the node. If it is missing, ``node.innerHTML`` is used instead.
120
121 ``type``
122 the content of ``dndType`` member of the node split on "," character. If it is missing, ``["text"]`` is used as the
123 default type.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
124
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
125 Default creator
126 ~~~~~~~~~~~~~~~
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
127
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
128 If the creator function was not specified, a default creator is used. The default creator does following things:
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
129
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
130 * It creates a context-appropriate node:
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
131
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
132 * If the container is ``<div>`` or ``<p>``-based, it will create a ``<div>`` node.
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
133
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
134 * If the container is ``<ul>`` or ``<ol>``-based, it will create a ``<li>`` node.
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
135
136 * If the container is ``<table>``-based, it will create a ``<tr><td>`` group of nodes, and it will be inserted in
137 ``<tbody>``.
138
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
139 * In all other contexts it will create a ``<span>`` node.
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
140
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
141 * If the ``hint`` is ``"avatar"`` it will create a ``<span>`` node.
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
142
143 * If the data item is an object, it will test for the presence of ``data`` member. If it is present, it will be used as
144 a data object. Otherwise the item itself will be used as a data object.
145
146 * If the data item is an object, it will test for the presence of ``type`` member. If it is present, it will be used as
147 a type object. Otherwise ``["text"]`` will be used as a type object.
148
149 * It will set a content of the node to ``String(data)``. You can override the ``toString()`` member function of your
150 object to change how it is converted to the string. Or specify the ``creator`` function.
151
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
152 * As any creator it returns a triplet object with newly created/identified ``node``, ``data``, and ``type``.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
153
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
154 After the creator function was called the result is post-processed:
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
155
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
156 * If the returned node doesn't have an ``id``, the default unique id will be generated.
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
157
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
158 * The returned node will be assigned a ``dojoDndItem`` class.
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
159
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
160 * If the returned ``type`` is not an array or missing, it will be replaced with ``["text"]``.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
161
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
162 Public methods and attributes
163 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
164
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
165 The following public methods are defined:
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
166
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
167 ``getAllNodes()``
168 returns a ``NodeList`` of all controlled DOM nodes in the order they are listed in the container.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
169
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
170 ``insertNodes(data, before, anchor)``
171 inserts data items before/after the anchor node. It returns the container object itself for easy chaining of calls.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
172
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
173 ``data``
174 an array of data items to be inserted. Each data item will be passed to the creator function, the result will
175 be registered with the container, the node will be inserted according to ``before`` and ``anchor`` parameters.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
176
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
177 ``before``
178 a boolean flag. If it is ``true``, nodes will be added before the ``anchor``, and after otherwise.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
179
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
180 ``anchor``
181 a node to be used as a reference for the insertion. It should be an immediate child of the container node (or a
182 child of ``<tbody>`` for the ``<table>``-based node). If it is not specified, all items will be appended to the
183 container node (or ``<tbody>`` for tables).
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
184
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
185 ``destroy()``
186 prepares the container object to be garbage-collected. You cannot use the container object after it was destroyed.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
187
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
188 ``sync()``
189 inspects all controlled DOM nodes updating internal structures by removing information of removed nodes, and adding
190 newly added DOM nodes marked with ``dojoDndItem`` class.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
191
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
192 The following public attributes are defined:
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
193
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
194 ``current``
195 a DOM node, which corresponds to a child with a mouse hovering over it. If there is no such item, this variable is
196 null.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
197
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
198 ``node``
199 the DOM node of the container. This node is used to set up mouse event handlers for the container.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
200
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
201 ``parent``
202 the DOM node, which is an immediate parent of DnD item nodes. In most cases it is the same as node, but in some cases
203 it can be node's descendant. Example: for tables ``node`` can point to ``<table>``, while ``parent`` points to
204 ``<tbody>`` (DnD item nodes will be ``<tr>`` nodes). You can freely change parent to achieve the desired behavior of
205 your container by specifying ``dropParent`` parameter.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
206
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
207 ``creator``
208 the creator function or ``null``, if the default creator is used.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
209
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
210 ``skipForm``
211 the flag propagated from the initial parameters.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
212
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
213 ``map``
214 a dictionary, which is keyed by node ids. Each registered child has an entry in the ``map`` by its node id (this is
215 why all nodes should have unique ids). ``map[id]`` returns an object with two attributes:
216
217 ``data``
218 an associated data item.
219
220 ``type``
221 an associated array of types.
222
223 *Note* that ``map`` does not contain a reference to any DOM nodes; its purpose is to store metadata, ``data`` and
224 ``type``, associated with the DOM node. For example, if you wish to programmatically move a DnD item from one
225 ``Source`` to another, you must perform DOM manipulations in addition to moving the item from one ``Source``'s ``map``
226 to the other ``Source``'s ``map``.
227
228 However, it is not recommended to access ``map`` directly. There are several utility functions to access it. They can
229 be used to virtualize the map, and you can use them with ``dojo.connect()`` so you know when DnD items are
230 added/removed/accessed and use it to customize the behavior:
231
232 The following accessor and utility functions are defined:
233
234 ``getItem(id)``
235 returns an object with ``data`` and ``type`` described above, which are associated with the node corresponding to that
236 ``id``.
237
238 ``setItem(id, obj)``
239 associates an object ``obj`` with this ``id``. ``obj`` should define ``data`` and ``type`` attributes.
240
241 ``delItem(id)``
242 deletes a record of the node with this ``id``. **Warning:** it does not delete the node from the container.
243
244 ``clearItems()``
245 delete all records. **Warning:** it does not delete nodes from the container.
246
247 ``forInItems(f, o)``
248 similar to ``dojo.forEach()`` but goes over all items in the map in an unspecified order. The function ``f`` will be
249 called in the context ``o`` for every item in the ``map`` with following parameters:
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
250
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
251 ``obj``
252 the corresponding object with ``data`` and ``type`` defined.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
253
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
254 ``id``
255 the node id.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
256
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
257 ``map``
258 the map object itself.
259
260 *Note:* ``forInItems()`` iterates over all DnD items in unspecified order. If you want to iterate over items in the
261 order they are listed in the container you can use the code similar to this:
262
263 .. js ::
264
265 function OrderedIter(container, f, o){
266 // similar to:
267 // container.forInItems(f, o);
268 // but iterates in the listed order
269
270 o = o || dojo.global;
271 container.getAllNodes().forEach(function(node){
272 var id = node.id;
273 f.call(o, container.getItem(id), id, container);
274 });
275 }
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
276
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
277 Event processors
278 ~~~~~~~~~~~~~~~~
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
279
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
280 Following event processors are defined: ``onMouseOver``, ``onMouseOut``. Two pseudo-events are defined: ``onOverEvent``,
281 ``onOutEvent``, which are cleaned up argument-less ``onMouseOver`` and ``onMouseOut`` events (otherwise they can be
282 fired several times without actually leaving the container).
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
283
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
284 CSS classes
285 ~~~~~~~~~~~
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
286
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
287 Following CSS classes are used by the container object:
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
288
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
289 ``dojoDndContainer``
290 assigned to each container node during the construction.
291
292 ``dojoDndContainerOver``
293 assigned when the mouse hovers over the container.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
294
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
295 ``dojoDndItem``
296 assigned to every new data item node. It should be assigned to every item before the container construction, if you
297 want it to be added automatically by the constructor.
298
299 ``dojoDndItemOver``
300 assigned to a data item node when the mouse hovers over the this item. This class is assigned in addition to
301 ``dojoDndItem`` class.
302
303 Partial reason to add "over" states when the mouse hovers over instead of using CSS was to support it in Internet
304 Explorer too.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
305
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
306 Selector
307 --------
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
308
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
309 The default implementation of ``Selector`` is built on top of Container_ and adds the ability to select children items.
310 Selector inherits all Container_'s methods and objects. Additionally it adds a notion of an anchor. The anchor is used
311 to specify a point of insertion of other items. The selector assumes that the container is organized in a linear fashion
312 either vertically (e.g., embedded ``<div>``\s, lists, tables) or horizontally (e.g., ``<span>``\s). This assumption
313 allows implementation of familiar user interface paradigms: selection of one element with a mouse *click*, selection of
314 an additional element with *ctrl+click*, linear group selection from the anchor to the clicked element with
315 *shift+click*, selecting an additional linear group from the anchor to the clicked element with *shift+ctrl+click*.
316 Obviously if you have more complex containers, you could implement different user interface actions.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
317
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
318 Constructor
319 ~~~~~~~~~~~
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
320
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
321 Constructor takes the same two parameters as the Container_'s constructor. It understands more optional parameters and
322 passes the rest to the underlying container. Following optional parameters are understood by the selector object:
323
324 ``singular``
325 a Boolean flag. If it is ``true``, the user is allowed to select just one item, otherwise any number of items can be
326 selected. It is ``false`` by default.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
327
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
328 ``autoSync``
329 a Boolean flag. If it is ``true``, Selector calls Container_'s ``sync()`` method for every ``onMouseDown``. It helps
330 when you add/remove DnD items using HTML DOM API, but can be taxing for containers with large number of DnD items. In
331 order to be more efficient consider calling ``sync()`` method after the manipulations were done, or (even more
332 efficient) adding new DnD items using ``insertNodes()`` method. The default value of this parameter is ``false``.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
333
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
334 Public methods and attributes
335 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
336
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
337 Following public methods are defined in addition to the container public methods:
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
338
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
339 ``getSelectedNodes()``
340 returns a :ref:`NodeList <dojo/NodeList>` of selected DOM nodes.
341
342 ``selectNone()``
343 remove the selection from all items. It returns the selector object itself for easy chaining of calls.
344
345 ``selectAll()``
346 selects all items. It returns the selector object itself for easy chaining of calls.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
347
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
348 ``deleteSelectedNodes()``
349 deletes all selected nodes. It returns the selector object itself for easy chaining of calls.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
350
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
351 Following public method is redefined with a new signature:
352
353 ``insertNodes(addSelected, data, before, anchor)``
354 the last three parameters are the same as in Container_. The first parameter is a flag, if it is ``true`` all newly
355 added items will be added as selected, otherwise they will be added unselected.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
356
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
357 The container object defines following public attributes:
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
358
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
359 ``selection``
360 a dictionary object keyed by ids of selected nodes. No useful payload is attached to objects in the dictionary.
361
362 ``anchor``
363 the current anchor node or ``null``.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
364
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
365 Event processors
366 ~~~~~~~~~~~~~~~~
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
367
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
368 Following event processors are defined: ``onMouseDown``, ``onMouseUp``. ``onMouseMove`` is attached by ``onOverEvent`` and detached by ``onOutEvent`` dynamically.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
369
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
370 CSS classes
371 ~~~~~~~~~~~
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
372
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
373 Following CSS classes are used by the selector object in addition to classes assigned the container object:
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
374
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
375 ``dojoDndItemSelected``
376 assigned if a data item is selected but it is not an anchor (the last selected element). This class is assigned in
377 addition to ``dojoDndItem`` class.
378
379 ``dojoDndItemAnchor``
380 assigned to an anchor data item. At any given time the selector can have zero or one anchor. This class is assigned in
381 addition to ``dojoDndItem`` class. Being an anchor means that this item is selected.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
382
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
383 Source
384 ------
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
385
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
386 The source object represents a source of items for DnD operations. It is used to represent DnD targets as well. In order
387 to be compatible your custom sources should emulate the common source API. Instances of this class can be created from
388 the HTML markup automatically by :ref:`dojo/parser <dojo/parser>` using ``data-dojo-type="dojo/dnd/Source"``.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
389
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
390 The default implementation of the source is built on top of Selector_, and adds the ability to start a DnD operation,
391 and participate in the orchestration of the DnD. Source_ inherits all Selector_'s (and Container_'s) methods and
392 attributes. User can initiate the DnD operation by dragging items (click and move without releasing the mouse). The DnD
393 operation can be used to rearrange items within a single source, or items can be moved or copied between two sources.
394 The user can select whether they want to copy or move items by pressing the `Ctrl` button during the operation. If
395 `Ctrl` is pressed, items will be copied, otherwise they will be moved. This behavior can be overwritten
396 programmatically.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
397
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
398 Constructor
399 ~~~~~~~~~~~
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
400
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
401 Constructor takes the same two parameters as the container's Selector_. It understands more optional parameters and
402 passes the rest to the underlying Selector_. Following optional parameters are understood by the source object:
403
404 ``isSource``
405 a Boolean flag. If it is ``true``, this object can be used to start the DnD operation, otherwise it can serve only as
406 a target. It is ``true`` by default.
407
408 ``accept``
409 an array of strings. It defines what types can be accepted by this object, when it is used as a target. The default is
410 ``["text"]``. If the array is empty it means that this source cannot be a target.
411
412 ``horizontal``
413 a Boolean flag. If ``true``, the source is based on the horizontally organized list container, otherwise it is based
414 on the vertical one. The default is ``false``.
415
416 ``withHandles``
417 a Boolean flag. If ``true``, an item can be dragged only by a predefined node inside the item, otherwise the whole
418 item can be used for dragging. By default it is ``false``. The handle should be a descendant of the item node and
419 should be marked with class ``dojoDndHandle``.
420
421 ``copyOnly``
422 a Boolean flag. If ``true``, the source doesn't allow to move items out of it, any DnD operation will copy items from
423 such sources. By default it is ``false``.
424
425 ``selfCopy``
426 a Boolean flag. If ``true``, the source copies items by default when dropping on itself. It is ``false`` by default.
427 This flag has meaning only if ``copyOnly`` is ``true``.
428
429 ``selfAccept``
430 a Boolean flag. If ``true``, the source accepts its own items. It is ``true`` by default. This flag has meaning only
431 if ``copyOnly`` is ``true``.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
432
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
433 ``delay``
434 a number, which defines the move delay in pixels before detecting a drag; 0 (no delay) by default.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
435
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
436 Public methods and attributes
437 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
438
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
439 The following public methods are defined (they can be replaced to change the DnD behavior):
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
440
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
441 ``checkAcceptance(source, nodes)``
442 returns ``true``, if this object can accept ``nodes`` from ``source``. The default implementation checks item's types
443 with accepted types of the object, and rejects the operation if there is no full match. Such objects are marked as
444 disabled targets and they do not participate in the current DnD operation. The source of items can always accept its
445 items regardless of the match (for exceptions see the definition of ``selfAccept`` above) preventing the situation
446 when user started to drag items and cannot find a suitable target, and cannot return them back. Take this into
447 consideration when replacing the method. The Target_'s ``checkAcceptance()`` is called during the DnD in progress when
448 user hovers above it. Following parameters are passed to the method:
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
449
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
450 ``source``
451 the source object for the dragged items.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
452
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
453 ``nodes``
454 a list of DOM nodes.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
455
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
456 ``copyState(keyPressed)``
457 returns ``true`` if the copy operation should be performed, the move will be performed otherwise. The default
458 implementation checks the ``copyOnly`` and ``selfCopy`` parameters described above. This method can be replaced if you
459 want to implement a more complex logic. Following parameters are passed in:
460
461 ``keyPressed``
462 a Boolean flag. If ``true``, user pressed the ``copy`` key.
463
464 ``self``
465 a Boolean flag. If it is ``true``, we are about to drop items on itself.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
466
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
467 Event processors
468 ~~~~~~~~~~~~~~~~
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
469
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
470 Following event handlers are overloaded: ``onMouseDown``, ``onMouseUp``, and ``onMouseMove``. They are used to perform
471 additional actions required by Source_.
472
5ec71e0 @wkeese fixing a bunch (but not nearly all) of the broken links
wkeese authored
473 Following local events are defined by Source_, which are meant to be overridden or connected with
36d5421 @wkeese fix broken links
wkeese authored
474 :ref:`dojo/on <dojo/on>` or `dojo.connect()`:
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
475
476 ``onDrop(source, nodes, copy)``
477 this method is called when DnD items is dropped in this target. The default implementation calls ``onDropExternal()``
478 or ``onDropInternal()`` based on the value of ``source`` (see below). Following parameters are passed in:
479
480 ``source``
481 the source of dragged items, can be the same object as the target.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
482
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
483 ``nodes``
484 the array of DOM nodes to be dropped. Their IDs can be used to access associated types and data.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
485
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
486 ``copy``
487 the Boolean flag. If ``true``, the target is requested to copy items, otherwise the target should move items.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
488
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
489 ``onDropExternal(source, nodes, copy)``
490 this method is called by the default implementation of ``onDrop()`` only if we have an external drop meaning that the
491 source is different from the target. All parameters are the same as in ``onDrop()``. The default implementation
492 performs the drop as instructed.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
493
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
494 ``onDropInternal(nodes, copy)``
495 this method is called by the default implementation of ``onDrop()`` only if we have an internal drop. This means that
496 the source is the same as the target. All parameters are the same as in ``onDrop()``, but ``source`` parameter is
497 skipped as redundant (it is the same as ``this``). The default implementation performs the drop as instructed.
498
499 ``onDraggingOver()``
500 this method is called during the DnD operation in progress when the mouse is over this target, and it is not disabled
501 for any reasons. The default implementation does nothing.
502
503 ``onDraggingOut()``
504 this method is called during the DnD operation in progress when the mouse went out of this target, and it is not
505 disabled for any reasons. The default implementation does nothing.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
506
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
507 Topic processors
508 ~~~~~~~~~~~~~~~~
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
509
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
510 Following topic listeners are defined: ``onDndSourceOver``, ``onDndStart``, ``onDndDrop``, ``onDndCancel``. These topics
511 are published by the Manager_. If you want to override topic listeners, please read `Summary of topics`_.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
512
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
513 **Warning:** in most cases you want to use events. Topics are low-level constructs, which are used internally and
514 generally should not be used for customization.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
515
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
516 CSS classes
517 ~~~~~~~~~~~
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
518
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
519 Following CSS classes are used by the source object in addition to classes assigned by Selector_ and Container_ objects:
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
520
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
521 ``dojoDndHorizontal``
522 assigned to the container node during the construction, if this object represents a horizontal list of ``dndItems``,
523 its ``horizontal`` property set to ``true``.
524
525 ``dojoDndSource``
526 assigned to the container node during the construction, if this object can be used as a source of DnD items, its
527 ``isSource`` property set to true.
528
529 ``dojoDndSourceCopied``
530 assigned to the container node during the active DnD operation when user copies items from it (e.g. pressed the
531 *Ctrl* key while dragging). When this class is assigned to the node, ``dojoDndSource`` class is removed.
532
533 ``dojoDndSourceMoved``
534 assigned to the container node during the active DnD operation when user moves items from it (e.g. the *Ctrl* key is
535 not pressed while dragging). When this class is assigned to the node, ``dojoDndSource`` class is removed.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
536
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
537 ``dojoDndTarget``
538 assigned to the container node during the construction, if this object can potentially accept DnD items, its
539 ``accept`` list is not empty.
540
541 ``dojoDndTargetDisabled``
542 assigned to the container node during the active DnD operation when this node cannot accept currently dragged items
543 (e.g. because it doesn't accept items of these types). When this class is assigned to the node, ``dojoDndTarget``
544 class is removed.
545
546 ``dojoDndItemBefore``
547 assigned to the data item node during the active DnD operation if transferred items will be inserted before this item.
548 This class is assigned in addition to all other classes.
549
550 ``dojoDndItemAfter``
551 assigned to the data item node during the active DnD operation if transferred items will be inserted after this item.
552 This class is assigned in addition to all other classes.
553
554 ``dojoDndHandle``
555 assigned to handles of item nodes. See ``withHandles`` parameter of Source_ above.
556
557 ``dojoDndSource``, ``dojoDndSourceCopied``, and ``dojoDndSourceMoved`` are mutually exclusive. ``dojoDndTarget``, and
558 ``dojoDndTargetDisabled`` are mutually exclusive. ``dojoDndSourceCopied``, ``dojoDndSourceMoved``,
559 ``dojoDndTargetDisabled``, ``dojoDndItemBefore``, and ``dojoDndItemAfter`` can be assigned only during the active DnD
560 operation. See the Manager_'s classes below to see what additional classes can be used for custom styling. Use
561 ``dojoDndHorizontal`` with ``dojoDndItemBefore`` and ``dojoDndItemAfter`` to create visually appropriate insertion
562 markers for horizontal (before, after) and vertical (above, below) containers.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
563
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
564 Target
565 ------
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
566
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
567 Essentially it is Source_ wrapped in with ``isSource`` set to ``false``. Instances of this class can be created from the
568 HTML markup automatically by :ref:`dojo/parser <dojo/parser>` using ``data-dojo-type="dojo/dnd/Target"``.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
569
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
570 AutoSource
571 ----------
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
572
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
573 Essentially it is Source_ wrapped in with ``autoSync`` set to ``true``. Instances of this class can be created from the
574 HTML markup automatically by :ref:`dojo/parser <dojo/parser>` using ``data-dojo-type="dojo/dnd/AutoSource"``.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
575
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
576 Avatar
577 ------
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
578
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
579 Avatar is a class for the object (the singleton pattern) that represents dragged items during DnD operations. You can
580 replace it or style it if you need to customize the look of DnD.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
581
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
582 Following methods should be implemented:
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
583
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
584 ``constructor(manager)``
585 the constructor of the class takes a single parameter --- the instance of Manager_, which is used to reflect the state
586 of the DnD operation in progress visually. The constructor is called (and the avatar object is created) only when the
587 manager decided to start a DnD operation. In this case Manager_ calls its method ``makeAvatar()``. By default Avatar
588 constructs a ``<table>`` node.
589
590 ``destroy()``
591 this method is called when the DnD operation is finished, the Avatar is unneeded, and is about to be recycled.
592
593 ``update()``
594 this method is called, when the state of the manager changes. It is used to reflect Manager_'s changes visually.
595 Usually this method is called by Manager_ automatically.
596
597 ``generateText()``
598 semi-public method, which is called by ``update()`` to render the header text. The default implementation returns a
599 number of dragged items as a string. You can override this method for localization purposes, or to change the text
600 however you like.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
601
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
602 The default implementation of the Avatar class does the following:
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
603
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
604 * It creates an absolutely positioned table of up to 6 rows.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
605
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
606 * The first row (the header) is populated with a text generated by ``generateText()`` method.
607
608 * Next rows are populated with DOM nodes generated by the creator function of the current source with hint "avatar" (see
609 above the description of the creator function) for data items. Up to 5 rows are populated with decreasing opacity.
610
611 If you want to override the avatar with something totally custom, the best way to do it is to override Manager_'s
612 ``makeAvatar()`` to return your own instance.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
613
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
614 CSS classes
615 ~~~~~~~~~~~
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
616
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
617 Following CSS classes are used to style the avatar:
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
618
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
619 ``dojoDndAvatar``
620 assigned to the avatar (the table).
621
622 ``dojoDndAvatarHeader``
623 assigned to the first row (the header).
624
625 ``dojoDndAvatarItem``
626 assigned to the avatar item rows.
627
628 ``dojoDndAvatarCanDrop``
629 added to the avatar (the table) when the mouse is over a target, which can accept transferred items. Otherwise it is
630 removed.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
631
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
632 Manager
633 -------
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
634
b8617ae @wsargent Add more text indicating how to use Manager.manager()
wsargent authored
635 ``Manager`` is a class which implements a business logic of DnD and orchestrates the visualization of this process. (It is the replacement for the deprecated ``dojo.dnd.manager`` singleton in 1.6.) It
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
636 accepts events from sources/targets, creates the Avatar_, and checks the validity of the drop. At any given moment there
b8617ae @wsargent Add more text indicating how to use Manager.manager()
wsargent authored
637 is only one instance of this class (the singleton pattern), which can be accessed by ``Manager.manager()`` function.
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
638 You do not need to instantiate this object explicitly. It is done automatically when DnD modules are required.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
639
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
640 This class or its instance can be monkey patched or replaced completely, if you want to change its functionality.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
641
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
642 Public methods and attributes
643 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
644
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
645 Following public methods are defined to be called by sources:
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
646
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
647 ``startDrag(source, nodes, copy)``
648 starts the DnD operations. The parameters are copied as public member variables of the ``Manager`` with the same
649 names. This method creates the avatar by calling ``this.makeAvatar()`` and assigning it to the ``avatar`` public
650 member. Information on parameters:
651
652 ``source``
653 the source of dragged items, can be the same object as the target.
654
655 ``nodes``
656 the array of DOM nodes to be dropped. Their ids can be used to access associated types and data.
657
658 ``copy``
659 the Boolean flag. If ``true``, the target is requested to copy items, otherwise the target should move items.
660
661 ``stopDrag()``
662 resets the DnD operation by resetting all public members. It is not enough to just call this method to abort the DnD
663 operation. Before calling it you should publish ``dnd/cancel`` topic (or ``dnd/drop``, if your forcing the drop). See
664 more information on topics below.
665
666 ``canDrop(flag)``
667 called by the current target to notify that it can accept the DnD items, if flag is ``true``. Otherwise it refuses to
668 accept them.
669
670 Following methods deal with the avatar and can be overridden, if something different is required:
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
671
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
672 ``makeAvatar()``
673 returns the Avatar_'s node. By default it creates an instance of Avatar_ passing itself as a parameter.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
674
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
675 ``updateAvatar()``
676 updates avatar to reflect changes in the current DnD operation (e.g. copy vs. move) cannot drop at this point.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
677
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
678 Following public properties are defined on the manager and can be overwritten if desired:
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
679
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
680 ``OFFSET_X``
681 the horizontal offset in pixels between the mouse pointer position and the left edge of the avatar.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
682
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
683 ``OFFSET_Y``
684 the vertical offset in pixels between the mouse pointer position and the top edge of the avatar.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
685
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
686 Following public properties are used by the manager during the active DnD operation:
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
687
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
688 ``source``
689 the source of DnD items.
690
691 ``nodes``
692 the list of transferred DnD items.
693
694 ``copy``
695 Boolean value to track the copy/move status.
696
697 ``target``
698 the selected target of the drop.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
699
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
700 Event processors
701 ~~~~~~~~~~~~~~~~
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
702
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
703 Following events are processed by the manager to the body: ``onMouseMove``, ``onMouseUp``, ``onKeyDown``, ``onKeyUp``.
704 These events are attached only during the active DnD operation. Following keys have a special meaning for the manager:
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
705
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
706 *Ctrl* key
707 when it is pressed the copy semantics is assumed. Otherwise the move is assumed.
708
709 *Esc* key
710 when it is pressed the DnD operation is immediately canceled.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
711
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
712 Topic processors
713 ~~~~~~~~~~~~~~~~
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
714
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
715 Following topic events can be generated by the manager:
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
716
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
717 ``/dnd/start``
718 when DnD starts. Current ``source``, ``nodes``, and the ``copy`` flag (see ``startDrag()`` for more info) are passed
719 as parameters of this event.
720
721 ``/dnd/source/over``
722 when the mouse moves over a source. The source in question is passed as a parameter. The same event is raised when the
723 mouse goes out of a source. In this case ``null`` is passed as a parameter.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
724
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
725 ``/dnd/drop/before``
726 raised just before the drop. It can be used to capture the drop parameters. Parameters are the same as for
727 ``/dnd/start``, but reflect current values.
728
729 ``/dnd/drop``
730 raised to perform a drop. Parameters are the same as for ``/dnd/start`` and one additional parameter is ``target``
731 (the object where items are dropped).
732
733 ``/dnd/cancel``
734 when DnD was canceled either by user (by hitting *Esc*), or by dropping items in illegal location.
735
736 **Warning:** During the processing of topics any listener can change the original parameters. It can be done by the
737 target processing ``/dnd/drop``. In most cases you want to use events local to sources/targets, instead of processing
738 topics. See Source_'s ``onDrop`` for more details.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
739
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
740 CSS classes
741 ~~~~~~~~~~~
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
742
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
743 Following CSS classes are used by the manager to style the DnD operation:
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
744
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
745 ``dojoDndCopy``
746 assigned to ``body`` during the copy DnD operations.
747
748 ``dojoDndMove``
749 assigned to ``body`` during the move DnD operations.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
750
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
751 No styles are assigned when there is no DnD in progress.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
752
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
753 dojo/dnd/move Principals
754 ========================
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
755
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
756 The DnD move consists of two principal classes and several specific implementations.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
757
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
758 Moveable
759 --------
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
760
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
761 Moveable is the main class, which is used to give the "moveable" property to a DOM node. Instances of this class can be
762 created from the HTML markup automatically by :ref:`dojo/parser <dojo/parser>` using
763 ``data-dojo-type="dojo/dnd/Moveable"``.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
764
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
765 Constructor
766 ~~~~~~~~~~~
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
767
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
768 The constructor accepts following parameters:
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
769
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
770 ``node``
771 a DOM node or a String representing an ID of a node. This node will be made moveable. Both ``relative`` and
772 ``absolute`` nodes can be moved. Their ``left`` and ``top`` are assumed to be in pixels. All other nodes are converted
773 to ``absolute`` nodes on the first drag.
774
775 ``params``
776 a dictionary object, which defines optional parameters. Following optional parameters are recognized:
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
777
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
778 ``handle``
779 the node (or its String ID), which will be used as a drag handle. It should be a descendant of ``node``. If it is
780 ``null`` (the default), the ``node`` itself is used for dragging.
781
782 ``delay``
783 a number in pixels. When user started the drag we should wait for ``delay`` pixels before starting dragging the
784 node. It is used to prevent accidental drags. The default is 0 (no delay).
785
786 ``skip``
787 a Boolean flag, which indicates that we should skip form elements when initiating drags if it is ``true``. Otherwise
788 the node is dragged no matter what. This parameter is used when we want to drag a form, but keep form elements
789 usable (e.g. we can still select text in a text node). The default is ``false``. When working with a draggable form,
790 the better alternative to ``skip=true`` is to define a drag handle instead.
791
792 ``mover``
793 the class to be used to create a mover (see Mover_).
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
794
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
795 Public methods and attributes
796 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
797
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
798 Following public attributes are available:
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
799
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
800 ``node``
801 the node to be dragged.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
802
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
803 Following public methods are defined:
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
804
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
805 ``destroy()``
806 should be called when you want to remove the "moveable" behavior form the node.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
807
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
808 Event processors
809 ~~~~~~~~~~~~~~~~
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
810
36d5421 @wkeese fix broken links
wkeese authored
811 Following public methods/events are defined. They can be used with `dojo.connect()` or overridden:
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
812
813 ``onDragDetected(evt)``
814 called when the drag is detected. The default implementation creates a Mover_. Parameters:
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
815
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
816 ``evt``
817 the event object, which triggered the drag.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
818
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
819 ``onFirstMove(mover)``
820 called once after processing the first move event. The default implementation does nothing. Parameters:
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
821
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
822 ``mover``
823 the Mover_ object used to drag the node
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
824
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
825 ``onMoveStart(mover)``
826 called when the move is about to start. The parameter is a Mover_ object just like in ``onFirstMove()``. The default
827 implementation publishes the topic ``/dnd/move/start``, adds ``dojoMove`` class to ``body`` node, and ``dojoMoveItem``
828 class to the moved node.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
829
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
830 ``onMoveStop(mover)``
831 called when the move is finished. The parameter is a Mover_ object just like in ``onFirstMove()``. The default
832 implementation publishes the topic ``/dnd/move/stop``, removes ``dojoMove`` class from ``body`` node, and
833 ``dojoMoveItem`` class from the moved node.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
834
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
835 ``onMove(mover, leftTop)``
836 called on every update of ``node``'s position. The default implementation calls ``onMoving()``, sets new position of
837 the ``node`` using ``style``, and calls ``onMoved()``. Parameters:
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
838
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
839 ``mover``
840 the Mover_ object for the current move.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
841
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
842 ``leftTop``
843 ``{l, t}`` – an object which defines the new left and top position of the object by its attributes ``l`` and ``t``
844 respectively. Both of them are numbers in pixels.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
845
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
846 ``onMoving(mover, leftTop)``
847 called by the default implementation of ``onMove()`` before updating the ``node``'s position. It uses the same
848 parameters as ``onMove()`` above. You can update ``leftTop`` parameter to whatever you want. The default
849 implementation does nothing.
850
851 ``onMoved(mover, leftTop)``
852 called by the default implementation of ``onMove()`` after updating the ``node``'s position. It uses the same
853 parameters as ``onMove()`` above. The default implementation does nothing.
854
855 The most important events are ``onFirstMove()`` and ``onMove()``. ``onFirstMove()`` can be used to set up some initial
856 parameters for the move, and possibly update some DOM nodes. ``onMove()`` implements the move itself. By overriding
857 these two methods you can implement a variety of click-drag-release operations (e.g. a resize operation, a draw
858 operation, and so on).
859
860 As you can see ``onMoving()``, ``onMove()``, and ``onMoved()`` fit the classic aspect before/after pattern.
861 ``onMoving()`` can be used to actively modify move parameters, while ``onMoved()`` can be used for book-keeping. You may
862 want to override ``onMove()`` for your own purposes and use :ref:`dojo/aspect <dojo/aspect>` to augment it however you
863 like.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
864
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
865 Following mouse event handlers are set up:
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
866
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
867 ``onMouseDown``
868
869 ``onMouseMove``
870 can be set up by ``onMouseDown`` when executing the non-zero delay.
871
872 ``onMouseUp``
873 can be set up by ``onMouseDown`` to cancel the drag while processing the non-zero delay.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
874
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
875 Additionally ``ondragselect`` and ``onselectstart`` events are canceled by ``onSelectStart()`` handler.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
876
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
877 Topic processors
878 ~~~~~~~~~~~~~~~~
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
879
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
880 Following topic events are raised by Moveable_:
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
881
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
882 ``/dnd/move/start``
883 published by the default implementation of ``onMoveStart()`` passing the Mover_ object as a parameter.
884
885 ``/dnd/move/stop``
886 published by the default implementation of ``onMoveStop()`` passing the Mover_ as a parameter.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
887
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
888 CSS classes
889 ~~~~~~~~~~~
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
890
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
891 Following CSS classes are used by Moveable_:
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
892
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
893 ``dojoMove``
894 assigned to ``body`` when the move is in progress.
895
896 ``dojoMoveItem``
897 assigned to the moved node when the move is in progress.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
898
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
899 Mover
900 -----
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
901
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
902 Mover is a utility class, which handles events to move the node, and triggers appropriate high-level events on the
903 connected object (usually a Moveable_). Instances of this class exist only when the move is in progress. In some cases
904 you can use it directly.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
905
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
906 Constructor
907 ~~~~~~~~~~~
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
908
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
909 The constructor accepts following parameters:
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
910
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
911 ``node``
912 a DOM node or an id (string) of such node. This node will be moved.
913
914 ``evt``
915 a mouse event, which actually indicated the start of the move. It is used to extract the coordinates of the mouse
916 using ``pageX`` and ``pageY`` properties.
917
918 ``host``
919 a host object, which will be called by the mover during the move. It should define at least two methods:
920 ``onFirstMove()``, and ``onMove()``, and two optional methods: ``onMoveStart()`` and ``onMoveStop()``. See Moveable_
921 for details.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
922
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
923 Public methods and attributes
924 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
925
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
926 Following public members are available:
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
927
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
928 ``node``
929 the node being dragged.
930
931 ``mouseButton``
932 a mouse button, which was pressed when starting the drag.
933
934 ``marginBox``
935 an object with two integer attributes: ``l`` and ``t``. It is initialized by the constructor, updated by the
936 ``onFirstMove()`` method on the mover, and used later on to add to the mouse coordinates before passing them to host's
937 ``onMove()`` as ``leftTop``.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
938
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
939 Following public methods are defined:
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
940
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
941 ``destroy()``
942 should be called when you want to stop the move.
943
944 ``onFirstMove()``
945 called once to finish setting up the ``marginBox`` property. Additionally it calls the host's ``onFirstMove()``.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
946
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
947 Event processors
948 ~~~~~~~~~~~~~~~~
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
949
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
950 Following mouse event handlers are set up: ``onMouseMove``, ``onMouseUp``. Additionally ``ondragselect`` and
951 ``onselectstart`` events are canceled.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
952
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
953 Specialized Moveables
954 ---------------------
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
955
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
956 Following specialized moveable classes are defined:
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
957
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
958 constrainedMoveable
959 ~~~~~~~~~~~~~~~~~~~
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
960
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
961 ``dojo/dnd/move/constrainedMoveable`` can be used to constrain a move to a dynamically calculated box. This class is
962 defined in the ``dojo/dnd/move`` module. It is based on Moveable_, and accepts following additional parameters during
963 construction:
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
964
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
965 ``constraints``
966 a function, which is called in the context of this Moveable_, with a newly created Mover_ object, and returns a
967 rectangle to be used for restrictions. The rectangle is an object, which defines following numeric attributes: ``l``
968 for left, ``t`` for top, ``w`` for width, and ``h`` for height. All numbers are in pixels.
969
970 ``within``
971 a Boolean flag. When it is ``true``, the dragged node will be moved only within the defined rectangle, and cannot go
972 outside of it. Otherwise, the restriction applies to the left-top corner of the moved node.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
973
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
974 boxConstrainedMoveable
975 ~~~~~~~~~~~~~~~~~~~~~~
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
976
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
977 ``dojo/dnd/move/boxConstrainedMoveable`` can be used to constrain a move to a predefined box. This class is defined in
978 the ``dojo/dnd/move`` module. It is based on constrainedMoveable_ and accepts following additional parameters during
979 construction:
980
981 ``box``
982 a rectangle box (see constrainedMoveable_), which defines constraint boundaries.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
983
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
984 ``within``
985 see constrainedMoveable_ for details.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
986
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
987 parentConstrainedMoveable
988 ~~~~~~~~~~~~~~~~~~~~~~~~~
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
989
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
990 ``dojo/dnd/move/parentConstrainedMoveable`` can be used to constrain the move by the boundaries of the node's parent.
991 This class is defined in the ``dojo/dnd/move`` module. It is based on constrainedMoveable_ and accepts following
992 additional parameters during construction:
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
993
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
994 ``area``
995 a string, which defines constraint boundaries. Valid values are: ``"content"``, ``"padding"``, ``"border"``, and
996 ``"margin"``.
997
998 ``within``
999 see constrainedMoveable_ for details.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
1000
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
1001 TimedMoveable
1002 ~~~~~~~~~~~~~
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
1003
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
1004 ``dojo/dnd/TimedMoveable`` can be used to throttle refreshes while moving nodes. This class is defined in its own module. It is based on Moveable_, and accepts following additional parameters during construction:
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
1005
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
1006 ``timeout``
1007 the time delay number in milliseconds. The node will not be moved for that number of milliseconds, but it will
1008 continue to accumulate changes in the mouse position.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
1009
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
1010 Subclassing DnD classes
1011 =======================
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
1012
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
1013 If you want to subclass Container_, Selector_, Source_, Moveable_, or their descendants, and you want to use the
1014 declarative markup, don't forget to implement the ``markupFactory()`` method. The reason for that is :ref:`dojo/parser <dojo/parser>`, which instantiates the markup, expects a very particular signature from a constructor. Dojo DnD classes
1015 predate ``dojo/parser``, and have a non-conformant signature. ``dojo/parser`` is smart enough to use a special adapter
1016 function in such cases. See the source code for ``dojo/dnd/Source::markupFactory()`` (for the
1017 Container_-Selector_-Source_ chain), and ``dojo/dnd/Moveable::markupFactory()`` for details. The key point is to return
1018 the instance of your new class there. Otherwise the instance of your base class is going to be created, which is
1019 probably not what you want.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
1020
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
1021 Summary of CSS classes
1022 ======================
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
1023
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
1024 All DnD-related classes can be used on six different types of DOM nodes. All of them are listed here. Using CSS classes
1025 described here you can design an extremely sophisticated UI to improve usability and enhance the workflow of your
1026 applications.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
1027
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
1028 body
1029 ----
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
1030
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
1031 The ``body`` node is updated only during active DnD operations. It can be used during the move to de-emphasize
1032 temporarily the web page and to highlight available targets or a moved object.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
1033
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
1034 Following CSS classes are used:
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
1035
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
1036 ``dojoDndCopy``
1037 assigned to the ``body`` during the copy DnD operations.
1038
1039 ``dojoDndMove``
1040 assigned to the ``body`` during the move DnD operations.
1041
1042 ``dojoMove``
1043 assigned to the ``body`` when the drag (``dojo/dnd/move``) is in progress.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
1044
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
1045 Source/target (dojo/dnd)
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
1046 ------------------------
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
1047
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
1048 Source can be assigned several classes to reflect its current role. These classes can be used together with the body CSS
1049 classes described above to create CSS rules to differentiate containers visually during DnD.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
1050
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
1051 Following CSS classes are used:
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
1052
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
1053 ``dojoDndContainer``
1054 assigned to each container node during the construction.
1055
1056 ``dojoDndContainerOver``
1057 assigned when the mouse hovers over the container.
1058
1059 ``dojoDndHorizontal``
1060 assigned to the container node during the construction, if this object represents a horizontal list of DnD items
1061 its ``horizontal`` property set to ``true``.
1062
1063 ``dojoDndSource``
1064 assigned to the container node during the construction, if this object can be used as a source of DnD items its
1065 ``isSource`` property set to ``true``.
1066
1067 ``dojoDndSourceCopied``
1068 assigned to the container node during the active DnD operation when user copies items from it (e.g. the *Ctrl* key was
1069 pressed while dragging). When this class is assigned to the node ``dojoDndSource`` class is removed.
1070
1071 ``dojoDndSourceMoved``
1072 assigned to the container node during the active DnD operation when user moves items from it (e.g. the Ctrl key is not
1073 pressed while dragging). When this class is assigned to the node, ``dojoDndSource`` class is removed.
1074
1075 ``dojoDndTarget``
1076 assigned to the container node during the construction, if this object can potentially accept DnD items its ``accept``
1077 array is not empty.
1078
1079 ``dojoDndTargetDisabled``
1080 assigned to the container node during the active DnD operation when this node cannot accept currently dragged items
1081 (e.g., because it doesn't accept items of these types). When this class is assigned to the node, ``dojoDndTarget``
1082 class is removed.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
1083
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
1084 DnD Item (dojo/dnd)
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
1085 -------------------
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
1086
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
1087 DnD items can be assigned several classes to reflect their current role visually.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
1088
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
1089 Following CSS classes are used:
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
1090
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
1091 ``dojoDndItem``
1092 assigned to every new data item node. It should be assigned to every item before the container construction, if you
1093 want it to be added automatically by the constructor or ``sync()``.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
1094
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
1095 ``dojoDndItemOver``
1096 assigned to a data item node when the mouse hovers over the this item. This class is assigned in addition to
1097 ``dojoDndItem`` class.
1098
1099 ``dojoDndItemSelected``
1100 assigned if a data item is selected but it is not an anchor (the last selected element). This class is assigned in
1101 addition to ``dojoDndItem`` class.
1102
1103 ``dojoDndItemAnchor``
1104 assigned to an anchor data item. At any given time the selector can have zero or one anchor. This class is assigned in
1105 addition to ``dojoDndItem`` class. Being an anchor means that this item is selected.
1106
1107 ``dojoDndItemBefore``
1108 assigned to the data item node during the active DnD operation if transferred items will be inserted before this item.
1109 This class is assigned in addition to all other classes.
1110
1111 ``dojoDndItemAfter``
1112 assigned to the data item node during the active DnD operation if transferred items will be inserted after this item.
1113 This class is assigned in addition to all other classes.
1114
1115 DnD Handles (dojo/dnd)
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
1116 ----------------------
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
1117
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
1118 DnD items can defined special handles on their descendants, which can be used for dragging. In this case the body of the
1119 DnD item cannot be used to start the drag.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
1120
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
1121 Following CSS classes are used:
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
1122
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
1123 ``dojoDndHandle``
1124 assigned to handles of item nodes. See the ``withHandles`` parameter of Source_.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
1125
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
1126 Avatar (dojo/dnd)
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
1127 -----------------
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
1128
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
1129 The default avatar can be styled to suit your needs.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
1130
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
1131 Following CSS classes are used:
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
1132
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
1133 ``dojoDndAvatar``
1134 assigned to the avatar node (the table).
1135
1136 ``dojoDndAvatarHeader``
1137 assigned to the first row/the header (the first ``tr`` node).
1138
1139 ``dojoDndAvatarItem``
1140 assigned to the avatar item rows (``tr`` nodes excluding the very first one).
1141
1142 ``dojoDndAvatarCanDrop``
1143 added to the avatar node (the table) when the mouse is over a target, which can accept transferred items. Otherwise it
1144 is removed.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
1145
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
1146 Dragged node (dojo.dnd.move)
1147 ----------------------------
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
1148
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
1149 The dragged node can be specially styled while in move.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
1150
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
1151 Following CSS classes are used:
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
1152
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
1153 ``dojoMoveItem``
1154 assigned to the dragged node when the move is in progress.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
1155
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
1156 Summary of ``topics``
1157 =====================
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
1158
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
1159 While local events are the preferred way to handle state changes, in some cases topics (named global events) can be
1160 used. **Note** Please double-check if you have to use topics instead of events.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
1161
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
1162 Following topic events can be generated by Manager_:
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
1163
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
1164 ``/dnd/start``
1165 when DnD starts. Current ``source``, ``nodes``, and ``copy`` flag (see Manager_'s ``startDrag()`` for more info) are
1166 passed as parameters of this event.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
1167
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
1168 ``/dnd/source/over``
1169 when the mouse moves over a source. The source in question is passed as a parameter. The same event is raised when the
1170 mouse goes out of a source. In this case ``null`` is passed as a parameter.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
1171
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
1172 ``/dnd/drop/before``
1173 raised just before the drop. It can be used to capture the drop parameters. Parameters are the same as for
1174 ``/dnd/drop``.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
1175
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
1176 ``/dnd/drop``
1177 raised to perform a drop. The first three parameters are the same as for ``/dnd/start``. The fourth parameter is the
1178 target object. Note that during the processing of this event nodes can be already moved, or reused. If you need the
1179 original nodes, use ``/dnd/drop/before`` to capture them, or use events local to source/target objects.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
1180
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
1181 ``/dnd/cancel``
1182 when DnD was cancelled either by user (by hitting Esc), or by dropping items in illegal location. This topic has no
1183 parameters.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
1184
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
1185 All sources subscribe to Manager_'s topics. Some users fail to understand that if they override, say, ``onDndDrop()``
1186 method, which is a ``/dnd/drop`` topic listener, it will be called **every time** ``/dnd/drop`` is signalled. It means
1187 it will be notified even if your source was not the part of the DnD exchange. It wasn't a source of the items, and it is
1188 not a target of the drop. If you subclass Source_ and override ``onDndDrop()``, your new method will be called for every
1189 instance of your class.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
1190
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
1191 Following topic events are raised by Moveable_:
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
1192
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
1193 ``/dnd/move/start``
1194 published by the default implementation of Moveable_'s ``onMoveStart()`` passing a mover_ as parameter.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
1195
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
1196 ``/dnd/move/stop``
1197 published by the default implementation of Moveable_'s ``onMoveStop()`` passing a mover as parameter.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
1198
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
1199 Tips
1200 ====
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
1201
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
1202 In order to limit the maximum number of items in a DnD source, you can override the ``checkAcceptance()`` method on your
1203 source, and return ``false``, when you reached your limit.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
1204
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
1205 If you want to create ``dojo/dnd/Source`` declaratively, and want to select that Source for operations like
1206 ``insertNodes()``, you will need to manually supply that Source_ with a ``data-dojo-id``. For example:
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
1207
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
1208 .. html ::
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
1209
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
1210 <div data-dojo-type="dojo/dnd/Source" id="test" data-dojo-id="test"></div>
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
1211
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
1212 Then you reference it in your code like: ``test.insertNodes();``. Without that, there is no way to use the methods of
1213 the Source_ if you are creating it with markup.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
1214
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
1215 The DnD itself uses ``onmousedown``/``onmousemove``/``onmouseup`` to operate. If you want to process ``onclick``, be
1216 warned that this is the synthetic event: essentially it is ``onmousedown + onmouseup``, which occurred within some
1217 predefined time interval (usually settable on the OS level), or using other criteria. Some browsers generate ``onclick``
1218 on every ``onmouseup``. Working with DnD you will get plenty of false ``onclick`` events. Some of them happen naturally,
1219 when user decided to drag but changed her mind clicking the mouse button generating ``onclick``. *Be extra careful when
1220 processing* ``onclick`` *on DnD sources!*
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
1221
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
1222 Accessibility
1223 =============
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
1224
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
1225 Low Vision
1226 -----------
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
1227
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
1228 The DnD Icons are specifically designed to be useful in a low vision situation, where color is not the only indication
1229 of what is occurring with DnD operation. The follow icons are used:
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
1230
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
1231 ========================= ==============================================================================================
1232 Image Description
1233 ========================= ==============================================================================================
1234 .. image :: dndCopy.png If the copy operation can be performed the DnD icon is a green background with a plus.
1235 .. image :: dndNoCopy.png If the copy operation can not be performed, the DnD icon is a red background with an x.
1236 .. image :: dndMove.png If the move operation can be performed the DnD icon is a green background with an arrow.
1237 .. image :: dndNoMove.png If the move operation can not be performed the DnD icon is a red background with a dash.
1238 ========================= ==============================================================================================
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
1239
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
1240 For High Contrast mode in Windows or when images have been turned off in the browser, the following character
1241 representations are used for the DnD operations:
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
1242
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
1243 * If the copy operation can be performed the DnD character is a +.
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
1244
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
1245 * If the copy operation can not be performed, the DnD is an x.
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
1246
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
1247 * If the move operation can be performed the DnD character is a <.
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
1248
2eac111 @wkeese dojo/hccss
wkeese authored
1249 * If the move operation can not be performed the DnD character is an o.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
1250
1251
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
1252 See also
1253 ========
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
1254
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
1255 * `Dojo Drag And Drop Redux <http://www.sitepen.com/blog/2011/12/05/dojo-drag-n-drop-redux/>`_ by Colin Snover at
1256 `SitePen <http://www.sitepen.com/>`_. – The comprehensive explanation of ``dojo/dnd``, and how to leverage it in real
1257 applications. The author builds the "shopping cart" in several iterations commenting code snippets and providing full
1258 source code for all examples. The only drawback is: this article uses topic handlers, because it was published before
1259 the introduction of local events.
1260
1261 * `Inside Dojo DnD: Drag Handles <http://www.sitepen.com/blog/2008/10/24/inside-dojo-dnd-drag-handles/>`_ by `Eugene Lazutkin <http://lazutkin.com/>`_ at `SitePen <http://www.sitepen.com/>`_. – The article explains a frequently
1262 overlooked and underused feature of Dojo’s DnD system: drag handles. It features several simple
1263 examples and clarifies some fine points.
1264
1265 * `Queued: Drag and Drop in the Queue <http://www.sitepen.com/blog/2009/04/16/queued-drag-and-drop-in-the-queue/>`_ by
1266 Bryan Forbes at `SitePen <http://www.sitepen.com/>`_. – The article shows how Dojo's DnD was used to implement the
1267 Netflix movie queue reordering feature in Queued, what features of DnD were used, and how it affected design
1268 decisions. All relevant code snippets are published along with detailed comments.
1269
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
1270 * :ref:`dojo.dnd.Moveable <dojo/dnd/Moveable>` Makes a DOM node moveable using the mouse.
8727a07 Modernisation of dojo/dnd and dojo/dnd/Moveable
Kitson Kelly authored
1271
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
1272 * :ref:`dojox.mdnd <dojox/mdnd>` Experimental coordinates based moveable drag and drop.
Something went wrong with that request. Please try again.