1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 """Parent class for Transferable implementations that have a Muntjac
17 container as a data source."""
18
19 from muntjac.event.transferable_impl import TransferableImpl
20 from muntjac.data.container import IViewer
21
22
24 """Parent class for L{Transferable} implementations that have a Muntjac
25 container as a data source. The transfer is associated with an item
26 (identified by its Id) and optionally also a property identifier (e.g. a
27 table column identifier when transferring a single table cell).
28
29 The component must implement the interface L{IViewer}.
30
31 In most cases, receivers of data transfers should depend on this class
32 instead of its concrete subclasses.
33 """
34
35 - def __init__(self, sourceComponent, rawVariables):
38
39
41 """Returns the identifier of the item being transferred.
42
43 @return: item identifier
44 """
45 pass
46
47
49 """Returns the optional property identifier that the transfer concerns.
50
51 This can be e.g. the table column from which a drag operation
52 originated.
53
54 @return: property identifier
55 """
56 pass
57
58
60 """Returns the container data source from which the transfer occurs.
61
62 L{IViewer.getContainerDataSource} is used to obtain the underlying
63 container of the source component.
64
65 @return: Container
66 """
67 sourceComponent = self.getSourceComponent()
68 if isinstance(sourceComponent, IViewer):
69 return sourceComponent.getContainerDataSource()
70 else:
71
72 return None
73