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

Source Code for Module muntjac.event.dd.acceptcriteria.and_

 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 compound criterion that accepts the drag if all of its criteria 
17  accepts the drag.""" 
18   
19  from muntjac.event.dd.acceptcriteria.client_side_criterion import \ 
20      ClientSideCriterion 
21   
22   
23 -class And(ClientSideCriterion):
24 """A compound criterion that accepts the drag if all of its criteria 25 accepts the drag. 26 27 @see: L{Or} 28 """ 29
30 - def __init__(self, *criteria):
31 """@param criteria: 32 criteria of which the And criterion will be composed 33 """ 34 self.criteria = criteria
35 36
37 - def paintContent(self, target):
38 super(And, self).paintContent(target) 39 for crit in self.criteria: 40 crit.paint(target)
41 42
43 - def accept(self, dragEvent):
44 for crit in self.criteria: 45 if not crit.accept(dragEvent): 46 return False 47 return True
48 49
50 - def getIdentifier(self):
51 return 'com.vaadin.event.dd.acceptcriteria.And'
52