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

Source Code for Module muntjac.event.dd.drag_source

 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  """A IComponent that builds a ITransferable for a drag and drop operation.""" 
17   
18  from muntjac.ui.component import IComponent 
19   
20   
21 -class IDragSource(IComponent):
22 """IDragSource is a L{IComponent} that builds a L{Transferable} for a 23 drag and drop operation. 24 25 In Muntjac the drag and drop operation practically starts from client side 26 component. The client side component initially defines the data that will 27 be present in L{Transferable} object on server side. If the server side 28 counterpart of the component implements this interface, terminal 29 implementation lets it create the L{Transferable} instance from the raw 30 client side "seed data". This way server side implementation may translate 31 or extend the data that will be available for L{DropHandler}. 32 """ 33
34 - def getTransferable(self, rawVariables):
35 """IDragSource may convert data added by client side component to 36 meaningful values for server side developer or add other data based 37 on it. 38 39 For example Tree converts item identifiers to generated string keys for 40 the client side. Muntjac developer don't and can't know anything about 41 these generated keys, only about item identifiers. When tree node is 42 dragged client puts that key to L{Transferable}s client side 43 counterpart. In L{Tree.getTransferable} the key is converted 44 back to item identifier that the server side developer can use. 45 46 @param rawVariables: 47 the data that client side initially included in 48 L{Transferable}s client side counterpart. 49 @return: the L{Transferable} instance that will be passed to 50 L{DropHandler} (and/or L{AcceptCriterion}) 51 """ 52 raise NotImplementedError
53