Package muntjac :: Package ui :: Module field
[hide private]
[frames] | no frames]

Source Code for Module muntjac.ui.field

  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  from muntjac.data import property as prop 
 17   
 18  from muntjac.data.buffered import IBufferedValidatable 
 19   
 20  from muntjac.ui.component import \ 
 21      IFocusable, Event as ComponentEvent 
 22   
 23   
24 -class IField(IBufferedValidatable, prop.IValueChangeNotifier, # IComponent, 25 prop.IValueChangeListener, prop.IEditor, IFocusable):
26 """@author: Vaadin Ltd. 27 @author: Richard Lincoln 28 """ 29
30 - def setCaption(self, caption):
31 """Sets the Caption. 32 """ 33 raise NotImplementedError
34 35
36 - def getDescription(self):
37 raise NotImplementedError
38 39
40 - def setDescription(self, caption):
41 """Sets the Description. 42 """ 43 raise NotImplementedError
44 45
46 - def isRequired(self):
47 """Is this field required. 48 49 Required fields must filled by the user. 50 51 @return: C{True} if the field is required, otherwise C{False}. 52 """ 53 raise NotImplementedError
54 55
56 - def setRequired(self, required):
57 """Sets the field required. Required fields must filled by the user. 58 59 @param required: 60 Is the field required. 61 """ 62 raise NotImplementedError
63 64
65 - def setRequiredError(self, requiredMessage):
66 """Sets the error message to be displayed if a required field is 67 empty. 68 69 @param requiredMessage: 70 Error message. 71 """ 72 raise NotImplementedError
73 74
75 - def getRequiredError(self):
76 """Gets the error message that is to be displayed if a required 77 field is empty. 78 79 @return: Error message. 80 """ 81 raise NotImplementedError
82 83
84 -class ValueChangeEvent(ComponentEvent, prop.ValueChangeEvent):
85 """An C{Event} object specifying the IField whose value has 86 been changed. 87 88 @author: Vaadin Ltd. 89 @author: Richard Lincoln 90 @version: 1.1.2 91 """ 92
93 - def __init__(self, source):
94 """Constructs a new event object with the specified source field 95 object. 96 97 @param source: 98 the field that caused the event. 99 """ 100 super(ValueChangeEvent, self).__init__(source)
101 102
103 - def getProperty(self):
104 """Gets the IProperty which triggered the event. 105 106 @return: the Source IProperty of the event. 107 """ 108 return self.getSource()
109