1. #1
    Sencha User chalu's Avatar
    Join Date
    Feb 2008
    Location
    Benin City, Nigeria
    Posts
    480
    Answers
    1
    Vote Rating
    1
    chalu is on a distinguished road

      0  

    Default Unanswered: DnD on TreePanel

    Unanswered: DnD on TreePanel


    I am trying to do DnD on a TreePanel, my intention is to inspect the object been dropped and the node on which it is about to be dropped, and then either allow or cancel the drop operation based on my choice. However I am finding it difficult to get the tree node on which the drop is about to occur, Ioverride onDragEnter() thus :
    Code:
     new TreePanelDropTarget(tree){		
        @Override
        protected void onDragEnter(DNDEvent evt) {	
    	super.onDragEnter(evt);
    	List<BeanModel> sel = evt.getData(); // what is been dragged
    		
            // activeItem is NULL 
    	ModelData nodeModel = activeItem.getModel(); 
    
            // every node has a gender property
            // so does every object been dragged here
            // only allow drop if the values are same.
        	String nodeGrp = nodeModel.get("gender").toString();
        }
      }
    Alternatively, is there a way to set a DnD group for a tree-node as can be done with TreePanelDropTarget. I just want to allow or reject drops on nodes if the node and the dragged model has the same value for a certain property. Thanks a bunch.

  2. #2
    Sencha User
    Join Date
    Sep 2011
    Location
    Leipzig, Germany
    Posts
    75
    Vote Rating
    1
    A.Rothe is on a distinguished road

      1  

    Default


    http://www.sencha.com/forum/showthre...ets-during-DnD

    This is a solution, how I check the valid drop zones. You can also "group" nodes if you use different instances of ModelData (like Folder extends ModelData, Leaf extends ModelData, SomethingElse extends ModelData). So it is possible to check the instance (for example you can forbid drop targets on instance SomethingElse). Another way is to prevent the selection of the nodes with a custom SelectionModel (Events.BeforeSelect). So you have only valid nodes within the selection and you have to check the target only.

    Best regards
    André

  3. #3
    Sencha User
    Join Date
    Apr 2012
    Posts
    2
    Vote Rating
    0
    ganesh vyas is on a distinguished road

      0  

    Default


    Hi Andre,

    Could you please explain, with an example, how can group be used to select valid drop tragets in tree panel. I am using GXT 3.1. How can i assign group to partiular node of a tree? There is a setGroup() method with TreeDragSource and TreeDropTarget object but that will assign same group to full tree. Any help will be truely appricated.

    Thanks
    Ganesh

  4. #4
    Sencha User
    Join Date
    Sep 2011
    Location
    Leipzig, Germany
    Posts
    75
    Vote Rating
    1
    A.Rothe is on a distinguished road

      0  

    Default


    This has nothing to do with the Groups, I guessed, that you use a base class within your Tree and you have to check its subclass instances with instanceof. So you have always nodes of the type of the baseclass, but you could check the subclass type, whether or not it is a valid target (i.e. Folder subclass is allowed, File subclass is not allowed, Folder/File are subclasses of FileSystemObject).

    Best regards
    Andre

  5. #5
    Sencha User
    Join Date
    Apr 2012
    Posts
    2
    Vote Rating
    0
    ganesh vyas is on a distinguished road

      0  

    Default


    Thanks Andre, for your prompt reply. I was not able to get the target tree element to compare their objects instance. Now the problem is resolved with the following code.

    Tree target = (Tree) event.getDropTarget().getWidget();
    final TreeNode item = (TreeNode)target.findNode(event.getDragMoveEvent().getNativeEvent().getEventTarget(). cast());

    Above lines provide the target tree node(on which currently mouse is placed).
    Regards,
    Ganesh

Thread Participants: 2

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..."