コード例 #1
0
 def compareTo(self, other):
     myElement = self.getDropTarget().getElement()
     otherElement = other.getDropTarget().getElement()
     if myElement == otherElement:
         return 0
     elif myElement == otherElement:
         return 0
     elif DOM.isOrHasChild(myElement, otherElement):
         return -1
     elif DOM.isOrHasChild(otherElement, myElement):
         return 1
     else:
         return 0
コード例 #2
0
 def resetCache(self, boundaryPanel, context):
     """
     Cache a list of eligible drop controllers, sorted by relative DOM positions
     of their respective drop targets. Called at the beginning of each drag operation,
     or whenever drop target eligibility has changed while dragging.
     
     @param boundaryPanel boundary area for drop target eligibility considerations
     @param context the current drag context
     """
     list_ = ArrayList((Candidate),)
     if context.draggable is not None:
         boundaryArea = WidgetArea(boundaryPanel, None)
         for dropController in self.dropControllerList:
             candidate = self.Candidate(dropController)
             if DOM.isOrHasChild(context.draggable.getElement(), candidate.getDropTarget().getElement()):
                 continue
             if candidate.getTargetArea().intersects(boundaryArea):
                 list_.add(candidate)
     self.sortedCandidates = list_.toArray([ None for i in range(list_.size())])
     Arrays.sort(self.sortedCandidates)