We mention the formats in the List section
of the drag and drop chapter I think.
Matt
From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Sean McKibben
Sent: Thursday, July 07, 2005 3:46
PM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Reorder
tree via dragging
So, what I've ended up using is the dataForFormat("source")
when the
dragSource is a tree, which gets a reference to
the tree. Once you
have that, the actual items being dragged will be
the selectedNode or
the selectedNodes, depending on whether or not the
tree allows
multiple selection.
So if you do
(selectedNode ==
event.target.getDropParent().getTreeNodeAt
(event.target.getDropLocation())
it will return true if they are, in fact, the same
node.
Is anyone aware of a published list of what the
various dataForFormat
strings are in the components that ship with flex?
Thanks,
Sean
On Jul 7, 2005, at 12:13 PM, Matthew Shirey wrote:
> As I am currently working with this, I can
say that dataForFormat
> ("source") will give you a
reference to the source object of the
> drag drop operation. I am not sure
about the "items" one though.
> I've read mixed documentation, some say its
"treeItems". Any rate,
> there's a formats array in the event object
that you can itterate
> through and see all of the available formats
if needed.
>
> M.
>
> On 7/6/05, Matt Chotin
<[EMAIL PROTECTED]> wrote:
> I think dataForFormat("items") or
dataForFormat("source"), not sure
> which is valid for Tree, might give you the
original items as
> opposed to the copies.
>
>
> Matt
>
>
> From: flexcoders@yahoogroups.com
> [mailto:flexcoders@yahoogroups.com]
On Behalf Of Sean McKibben
> Sent: Wednesday, July 06, 2005 1:17 PM
> To: flexcoders@yahoogroups.com
> Subject: [flexcoders] Reorder tree via
dragging
>
>
> So I'm trying to make a tree which can
reorder its nodes by dragging
> them. One of the things I wanted to do is
prevent a parent item from
> being dragged on to any of its children, and
to show that during the
> dragOver event.
>
> In order to calculate whether the source is
being dragged on to any
> of its offspring, I've been comparing the
>
event.dragSource.dataForFormat("treeItems") first to
>
firstValue=event.target.getDropParent().getTreeNodeAt
> (event.target.getDropLocation()) then
recursively to the parents of
> firstValue.
>
> This apparently doesn't work because
dataForFormat seems to hand me a
> copy of the items being dragged instead of an
actual reference, so
> the two values are never equal. I did note
that the items that
> dataForFormat give me, do contain references
to the real parents,
> data and other objects, it is just that the
items themselves are
> copies for some reason.
>
> What I ended up doing is something like the
following:
>
>
if(checkParentDrop(myowncustom.TreeUtils.findDataItemNode
> (view.TemplateAssemblyTree,
dragItems[i].getData())
>
, event.target.getDropParent().getTreeNodeAt
> (event.target.getDropLocation())))
> action =
"">
>
> private function checkParentDrop(source,
node):Boolean
> {
>
if(source == node)
>
return true;
>
if(node.getParent()!=null)
>
return checkParentDrop(source, node.getParent());
>
else
>
return false;
> }
>
>
> public static function
findDataItemNode(tree:mx.controls.Tree,
> o:Object):TreeNode
> ... recursively check the entire tree for the
same getData()
> reference ...
>
> So basically instead of comparing items from
>
event.dragSource.dataForFormat("treeItems"), i have to recursively
> look them up by the reference they contain to
their getData()
> information, to get the actual reference to
the TreeNode which I then
> compare to the drop target and its ancestors
for referential equality.
>
> This is horribly ugly, but it works. Is there
a better way that
> people have stumbled across to validate
tree->self drags? I wish that
> dataForFormat handed over references instead
of copies!
>
> (sorry if this was discussed before; I'm
apparently bad at finding
> previously discussed topics in this list!)
>
> Sean
>
>
>
>
> --
> Flexcoders Mailing List
> FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> Search Archives: http://www.mail-archive.com/flexcoders%
> 40yahoogroups.com
>
>
>
>
>
> --
> Flexcoders Mailing List
> FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> Search Archives: http://www.mail-archive.com/flexcoders%
> 40yahoogroups.com
>
>
> YAHOO! GROUPS LINKS
>
> Visit your group "flexcoders"
on the web.
>
> To unsubscribe from this group, send an
email to:
>
[EMAIL PROTECTED]
>
> Your use of Yahoo! Groups is subject to
the Yahoo! Terms of Service.
>
>
>
>
> --
> Flexcoders Mailing List
> FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> Search Archives: http://www.mail-archive.com/flexcoders%
> 40yahoogroups.com
>
>
> YAHOO! GROUPS LINKS
>
> Visit your group "flexcoders"
on the web.
>
> To unsubscribe from this group, send an
email to:
> [EMAIL PROTECTED]
>
> Your use of Yahoo! Groups is subject to
the Yahoo! Terms of Service.
>
>
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
---- LSpots keywords ?>---- HM ADS ?>
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
---- LSpots keywords ?>
---- HM ADS ?>
YAHOO! GROUPS LINKS