1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 """Criterion for checking if drop target details contains the specific
17 property with the specific value."""
18
19 from muntjac.event.dd.acceptcriteria.client_side_criterion import \
20 ClientSideCriterion
21
22
24 """Criterion for checking if drop target details contains the specific
25 property with the specific value. Currently only String values are
26 supported.
27
28 TODO: add support for other basic data types that we support in UIDL.
29 """
30
32 """Constructs a criterion which ensures that the value there is a
33 value in L{TargetDetails} that equals the reference value.
34
35 @param dataFlavor:
36 the type of data to be checked
37 @param value:
38 the reference value to which the drop target detail will
39 be compared
40 """
41 self._propertyName = dataFlavor
42 self._value = value
43
44
45 - def paintContent(self, target):
46 super(TargetDetailIs, self).paintContent(target)
47 target.addAttribute('p', self._propertyName)
48
49 if isinstance(self._value, bool):
50 target.addAttribute('v', self._value.booleanValue())
51 target.addAttribute('t', 'b')
52 elif isinstance(self._value, str):
53 target.addAttribute('v', self._value)
54
55
59
60
62
63 return 'com.vaadin.event.dd.acceptcriteria.TargetDetailIs'
64