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

Source Code for Module muntjac.event.transferable

 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  """Wraps the data that is to be imported into another component.""" 
17   
18   
19 -class ITransferable(object):
20 """ITransferable wraps the data that is to be imported into another 21 component. Currently ITransferable is only used for drag and drop. 22 """ 23
24 - def getData(self, dataFlavor):
25 """Returns the data from ITransferable by its data flavor (aka data 26 type). Data types can be any string keys, but MIME types like 27 "text/plain" are commonly used. 28 29 Note, implementations of L{ITransferable} often provide a better 30 typed API for accessing data. 31 32 @param dataFlavor: 33 the data flavor to be returned from ITransferable 34 @return: the data stored in the ITransferable or null if ITransferable 35 contains no data for given data flavour 36 """ 37 raise NotImplementedError
38 39
40 - def setData(self, dataFlavor, value):
41 """Stores data of given data flavor to ITransferable. Possibly existing 42 value of the same data flavor will be replaced. 43 44 @param dataFlavor: 45 the data flavor 46 @param value: 47 the new value of the data flavor 48 """ 49 raise NotImplementedError
50 51
52 - def getDataFlavors(self):
53 """@return: a collection of data flavors ( data types ) available in 54 this ITransferable 55 """ 56 raise NotImplementedError
57 58
59 - def getSourceComponent(self):
60 """@return: the component that created the ITransferable or null if 61 the source component is unknown 62 """ 63 raise NotImplementedError
64