Hi Amit,
cool, all solved except for the indicator position. May be the Qooxdoo-gods
of 1&1 will be able to help ... Chris?
Thanks,
Fritz
On Tue, 24 Mar 2009, Amit Rana wrote:
> Hi,
>
> Amit Rana wrote:
>> Hi Fritz,
>>
>> Fritz Zaucker wrote:
>>
>>> Hi Amit,
>>>
>>> thanks for coming up with the code snippet.
>>>
>>> For dropping to work in the drop-listener you must replace the line
>>>
>>> this.addBefore(sel[i], orig); //error - this.addBefore is not a
>>> function
>>>
>>> with
>>>
>>> orig.getParent().addBefore(sel[i], orig);
>>>
>>> You must drop (e.g. add) to the parentFolder in a tree.
>>>
>>>
>> thanks for the tip but i guess I was not using that properly. After removal
>> of "for" loop, now its working fine.
>>
>>> However, there are still issues:
>>>
>>> 1) The indicator is not shown (it is probably at the wrong place as the
>>> call
>>>
>>> var origCoords = orig.getContainerLocation();
>>>
>>> gets the coordinates of the "surrounding" parent part of the tree.
>>>
>>> This is the problem I originally described in my posting. Your code
>>> snippet nicely describes the problem (with the above change for
>>> dropping).
>>>
>>>
>> as you already know, same problem with me but i guess we can try solving
>> this in case no-one else comes up with any suggestions :-)
>>
>>> 2) Depending on where the drop occurs the call to getOriginalTarget()
>>> seems
>>> to pick up the label part of the TreeFolder widget and thus the
>>> attempt
>>> to add the droppable widget to its parent (the labels) fails with the
>>> following error in the firebug console:
>>>
>>> orig.getParent is not a function
>>> var cz=new qx.ui.basic.Label(this.tr(bn));
>>>
>>> This can be reproduced with your code snippet in the playground by
>>> experimenting with dragging/dropping.
>>>
>>> I guess the logic of detecting the widget to drop to needs some
>>> improvement (probably some instanceOf magic).
>>>
>> The List example works perfect (it doesn't allow you to drop on the label
>> and only allows the drop at place when indicator is seen between the
>> items). So, we need to do something similar. Even without indicator, the
>> cursor changes to cursor with a small box at top and if we can make this
>> appear only between the nodes, then maybe this error will not come.
>> BTW, in my code, if I try dropping on the label, the script simply hangs
>> (without giving any error). :-(
>>
> I solved this problem by modifying my "drop" eventlistener as :
> ----snip----
> tree.addListener("drop", function(e)
> {
> var sel = this.getSortedSelection();
> var src = sel[0];
> var dest = e.getOriginalTarget();
> var p1 = src.getParent();
> var p2 = dest.getParent();
> if(p1 == p2) //solves issue 4)
> if(dest instanceof qx.ui.tree.TreeFolder){ //solves issue 2)
> dest.getParent().addBefore(src, dest);
> }
> });
> ----snip----
> But, if I try dropping after the last node, I get error. So need to handle
> this special case.
>
> Amit
>>> 3) The for loop in the drop listener is probably not needed, as in a tree
>>> only one Folder can be selected at a time, so sel.length is always 1.
>>> So
>>> I guess this could be simplified a bit.
>>>
>>>
>> Yeah... I changed it to orig.getParent().addBefore(sel[0], orig); and its
>> working fine. thnks
>>
>>> 4) For my application I need to limit the dragging of a folder to within
>>> the
>>> same sub-tree (e.g. the parent folder cannot change). So more drag
>>> detection logic is needed, but this shouldn't be too difficult.
>>>
>> same in my case too. :-)
>>
>>> So currently I am in need for some help on 1) and if somebody has a hint
>>> for
>>> 2) that would even be better.
>>>
>>> Thanks,
>>> Fritz
>>>
>>>
>> thanks
>> Amit
>>
>>> On Mon, 23 Mar 2009, Amit Rana wrote:
>>>
>>>
>>>> Hi,
>>>>
>>>> As mentioned before, I am also working on drag-drop feature on tree. I
>>>> have made a sample code, but I am stuck up with :
>>>>
>>>> 1. moving the folder at the right place (How to get the list of parsed
>>>> nodes - I tried to add them to an array on "dragover" event but same node
>>>> gets added multiple times and also node label gets added separately, so
>>>> need to write lot of code to avoid all that and I am lokking at some
>>>> simplified method possible)
>>>>
>>>> 2. Indicator position (indicator gets shown at wrong place - it has to do
>>>> with the container but not sure how to rectify that)
>>>>
>>>> Please find the code snippet (made on Playground) and let me know your
>>>> suggestions.
>>>> Please note that the "drop" part does not work properly.
>>>>
>>>> Amit
>>>>
>>>> P.S. : I am sorry that I have added my doubt in the same thread. Please
>>>> let me know if I should create a new thread or its ok in this one
>>>> (created by Fritz)
>>>>
>>>>
>>>> Fritz Zaucker wrote:
>>>>
>>>>> Hi Amit,
>>>>>
>>>>> I'll have to extract the relevant code from my application (I currently
>>>>> use
>>>>> a class derived from TreeFolder and a somewhat complex code to
>>>>> dynamically
>>>>> create the Folders). I'll post the snippet on the mailing list asap.
>>>>>
>>>>> Cheers,
>>>>> Fritz
>>>>>
>>>>> On Mon, 23 Mar 2009, Amit Rana wrote:
>>>>>
>>>>>
>>>>>
>>>>>> Hi Fritz,
>>>>>>
>>>>>> I am also trying to implement the drag-drop feature on tree but the
>>>>>> script hangs if I try in playground application. Can you please pass me
>>>>>> your code snippet ?
>>>>>>
>>>>>> BR
>>>>>> Amit
>>>>>>
>>>>>> Christian Schmidt wrote:
>>>>>>
>>>>>>
>>>>>>> Hi Fritz,
>>>>>>>
>>>>>>> could you please send a code snipped or an example, that would make it
>>>>>>> easier to help you by this problem.
>>>>>>>
>>>>>>> Thanks,
>>>>>>> Chris
>>>>>>>
>>>>>>> Fritz Zaucker schrieb:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> I have started to implement drag/drop in my application for the
>>>>>>>> qx .ui.tree.TreeFolder()s of a qx.ui.tree.Tree(). I followed the
>>>>>>>> Drag/Drop-Demo for Lists in the demobrowser. I had to change the line
>>>>>>>>
>>>>>>>> orig.addBefore(sel[i], orig);
>>>>>>>>
>>>>>>>> to
>>>>>>>>
>>>>>>>> orig.getParent().addBefore(sel[i], orig);
>>>>>>>>
>>>>>>>> to drop the folder into the correct widget.
>>>>>>>>
>>>>>>>> The only problem I have is to figure out how to get the coordinates
>>>>>>>> for the
>>>>>>>> drag/drop indicator right. The demo code has the line
>>>>>>>>
>>>>>>>> var orig = e.getOriginalTarget();
>>>>>>>> var origCoords = orig.getContainerLocation();
>>>>>>>>
>>>>>>>> but this places the indicator several folders below where it should.
>>>>>>>> I guess
>>>>>>>> that this actually gives the lower end of the sub-tree in which the
>>>>>>>> folder
>>>>>>>> lives.
>>>>>>>>
>>>>>>>> So my question is, which widget would I have to call
>>>>>>>> getContainerLocation()
>>>>>>>> or some other method on to get the right coordinates?
>>>>>>>>
>>>>>>>> Thanks for your help,
>>>>>>>> Fritz
>>>>>>>>
>
--
Oetiker+Partner AG tel: +41 62 775 9903 (direct)
Fritz Zaucker +41 62 775 9900 (switch board)
Aarweg 15 +41 79 675 0630 (mobile)
CH-4600 Olten fax: +41 62 775 9905
Schweiz web: www.oetiker.ch
------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel