sorry I am creating monologic threads ... more like a blog ... my 
problems seem to be quite esoteric.

Anyways, here is an update. I want to drag a tree node from one 
treeVirtual to another. I am using this supportsDrop function to check 
whether I can drop the node:

// function to check whether drop can be possible
var _this = timesTree;
_this.supportsDrop = function(dragCache) {

    // hack: update cell focus indicator
    _this._getPaneScrollerArr()[0]._focusCellAtPagePos(dragCache.pageX, 
dragCache.pageY);

    // drag target
    var row = _this._getPaneScrollerArr()[0].getFocusedRow();
      var rowData = _this.getDataModel().getRowData(row);
      if ( ! rowData ) return;
      var targetNode = rowData[0];
    
      // programmatically select node to load children after a delay
      if ( ! _this.__dragSelectionTimeStamp )
      {
        _this.__dragSelectionTimeStamp = (new Date).getTime();
    }
    else
    {
        if ( (new Date).getTime() - _this.__dragSelectionTimeStamp > 1000 )
        {
            if ( row != _this.__dragSelectionRow )
            {
                _this.getSelectionModel().addSelectionInterval(row, row);
            }
            _this.__dragSelectionTimeStamp = (new Date).getTime();
            _this.__dragSelectionRow = row;
        }
    }
 
    // this doesn't work:
  
    // drag source node
    var sourceNode = 
qx.event.handler.DragAndDropHandler.getInstance().getData();
  
    // source and destination node type
    var sourceType = sourceNode.type;        
      var targetType = targetNode.type;
    
      switch (sourceType)
      {
          case "staffschedule.types.Person":
              if ( targetType == "staffschedule.types.Date" ) return false;
              break;
            
          default: return true;
      }
      return true;
}

What this does is

- to update the focus indicator in the target tree during the drag session
- to select the tree node after a delay of 1s, triggering a 
selectionChange event. This loads the node children in my app, so I can 
open the tree branches during the drag session
- finally, it should check whether the drop is allowed. In order to do 
this, I need the drag source data as explained in my last post. It is 
not contained in the dragCache object, but it also doesn't seem to be 
contained in qx.event.handler.DragAndDropHandler.getInstance().getData() 
(which has "no properties", thus, it is null).

What can I do?

Thanks,

Christian




bibliograph schrieb:
> Hello,
>
> there seems to be a problem (or at least I am having this problem) with 
> drag & drop involving virtual widgets.
>
> The current architecture assumes that it is enough to store the 
> sourceWidget and the destinationWidget during the drag session. However, 
> with virtual widgets this is not enough - we need to store the internal 
> information on what node/row/cell etc. has been dragged.
>
> Of course, we can send it with the drag event during dragStart:
>
> myVirtualTree.addEventHandler("dragStart",function(event){
>             // get drag source
>             node = this.getDataModel().getSelectedNodes()[0];
>             if ( node && node.type =="staffschedule.types.Person" )
>             {
>                 event.addData(node.type, node);
>                 event.addAction("move");
>                 event.startDrag();
>               }
> }
>
> but if I use the "supportsDrop" method on the destination widget, I have 
> no access to the event data, because the dragCache object that is sent 
> to the supportsDrop function does not contain the drag data. So I am 
> left to attaching the data to the source widget and retrieving it 
> manually inside the supportsDrop function. Or is there a way to get the 
> drag data through qx.event.handler.DragAndDropHandler ?
>
> Thanks,
>
> Christian
>
>   
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems?  Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >>  http://get.splunk.com/
> _______________________________________________
> qooxdoo-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>   


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to