Package muntjac :: Package event :: Package dd :: Module drop_handler
[hide private]
[frames] | no frames]

Source Code for Module muntjac.event.dd.drop_handler

 1  # Copyright (C) 2012 Vaadin Ltd.  
 2  # Copyright (C) 2012 Richard Lincoln 
 3  #  
 4  # Licensed under the Apache License, Version 2.0 (the "License");  
 5  # you may not use this file except in compliance with the License.  
 6  # You may obtain a copy of the License at  
 7  #  
 8  #     http://www.apache.org/licenses/LICENSE-2.0  
 9  #  
10  # Unless required by applicable law or agreed to in writing, software  
11  # distributed under the License is distributed on an "AS IS" BASIS,  
12  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
13  # See the License for the specific language governing permissions and  
14  # limitations under the License. 
15   
16  """Contains the actual business logic for drag and drop operations.""" 
17   
18   
19 -class IDropHandler(object):
20 """DropHandlers contain the actual business logic for drag and drop 21 operations. 22 23 The L{drop} method is used to receive the transferred data and the 24 L{getAcceptCriterion} method contains the (possibly client side verifiable) 25 criterion whether the dragged data will be handled at all. 26 """ 27
28 - def drop(self, event):
29 """Drop method is called when the end user has finished the drag 30 operation on a L{DropTarget} and L{DragAndDropEvent} has passed 31 L{AcceptCriterion} defined by L{getAcceptCriterion} method. The 32 actual business logic of drag and drop operation is implemented 33 into this method. 34 35 @param event: 36 the event related to this drop 37 """ 38 raise NotImplementedError
39 40
41 - def getAcceptCriterion(self):
42 """Returns the L{AcceptCriterion} used to evaluate whether the 43 L{Transferable} will be handed over to L{IDropHandler.drop} method. 44 If client side can't verify the L{AcceptCriterion}, the same criteria 45 may be tested also prior to actual drop - during the drag operation. 46 47 Based on information from L{AcceptCriterion} components may display 48 some hints for the end user whether the drop will be accepted or not. 49 50 Muntjac contains a variety of criteria built in that can be composed 51 to more complex criterion. If the build in criteria are not enough, 52 developer can use a L{ServerSideCriterion} or build own custom 53 criterion with client side counterpart. 54 55 If developer wants to handle everything in the L{drop} method, 56 L{AcceptAll} instance can be returned. 57 58 @return: the L{AcceptCriterion} 59 """ 60 raise NotImplementedError
61