Package muntjac :: Package data :: Module item
[hide private]
[frames] | no frames]

Source Code for Module muntjac.data.item

  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  """Provides a mechanism for handling a set of Properties.""" 
 17   
 18   
19 -class IItem(object):
20 """Provides a mechanism for handling a set of Properties, each associated 21 to a locally unique non-null identifier. The interface is split into 22 subinterfaces to enable a class to implement only the functionalities it 23 needs. 24 25 @author: Vaadin Ltd. 26 @author: Richard Lincoln 27 @version: 1.1.2 28 """ 29
30 - def getItemProperty(self, idd):
31 """Gets the Property corresponding to the given Property ID stored in 32 the IItem. If the IItem does not contain the Property, C{None} is 33 returned. 34 35 @param idd: 36 identifier of the Property to get 37 @return: the Property with the given ID or C{None} 38 """ 39 raise NotImplementedError
40 41
42 - def getItemPropertyIds(self):
43 """Gets the collection of IDs of all Properties stored in the IItem. 44 45 @return: iterable containing IDs of the Properties stored 46 the IItem 47 """ 48 raise NotImplementedError
49 50
51 - def addItemProperty(self, idd, prop):
52 """Tries to add a new Property into the IItem. 53 54 This functionality is optional. 55 56 @param idd: 57 ID of the new Property 58 @param prop: 59 the Property to be added and associated with the id 60 @return: C{True} if the operation succeeded, C{False} 61 if not 62 @raise NotImplementedError: 63 if the operation is not supported. 64 """ 65 raise NotImplementedError
66 67
68 - def removeItemProperty(self, idd):
69 """Removes the Property identified by ID from the IItem. 70 71 This functionality is optional. 72 73 @param idd: 74 ID of the Property to be removed 75 @return: C{True} if the operation succeeded C{False} if not 76 @raise NotImplementedError: 77 if the operation is not supported. 78 """ 79 raise NotImplementedError
80 81
82 -class IViewer(object):
83 """Interface implemented by viewer classes capable of using an IItem as a 84 data source. 85 """ 86
87 - def setItemDataSource(self, newDataSource):
88 """Sets the IItem that serves as the data source of the viewer. 89 90 @param newDataSource: 91 The new data source IItem 92 """ 93 raise NotImplementedError
94 95
96 - def getItemDataSource(self):
97 """Gets the IItem serving as the data source of the viewer. 98 99 @return: data source IItem 100 """ 101 raise NotImplementedError
102 103
104 -class IEditor(IViewer):
105 """Interface implemented by the C{IEditor} classes capable of editing the 106 IItem. Implementing this interface means that the IItem serving as the 107 data source of the editor can be modified through it. 108 109 Note: Not implementing the C{IEditor} interface does not restrict the class 110 from editing the contents of an internally. 111 """ 112 pass
113 114
115 -class IPropertySetChangeEvent(object):
116 """An C{Event} object specifying the IItem whose contents has been 117 changed through the C{Property} interface. 118 119 Note: The values stored in the Properties may change without triggering 120 this event. 121 """ 122
123 - def getItem(self):
124 """Retrieves the IItem whose contents has been modified. 125 126 @return: source IItem of the event 127 """ 128 raise NotImplementedError
129 130
131 -class IPropertySetChangeListener(object):
132 """The listener interface for receiving C{IPropertySetChangeEvent} 133 objects. 134 """ 135
136 - def itemPropertySetChange(self, event):
137 """Notifies this listener that the IItem's property set has changed. 138 139 @param event: 140 Property set change event object 141 """ 142 raise NotImplementedError
143 144
145 -class IPropertySetChangeNotifier(object):
146 """The interface for adding and removing C{IPropertySetChangeEvent} 147 listeners. By implementing this interface a class explicitly announces 148 that it will generate a C{IPropertySetChangeEvent} when its 149 Property set is modified. 150 """ 151
152 - def addListener(self, listener, iface=None):
153 """Registers a new property set change listener for this IItem. 154 155 @param listener: 156 The new Listener to be registered. 157 """ 158 raise NotImplementedError
159 160
161 - def addCallback(self, callback, eventType=None, *args):
162 raise NotImplementedError
163 164
165 - def removeListener(self, listener, iface=None):
166 """Removes a previously registered property set change listener. 167 168 @param listener: 169 Listener to be removed. 170 """ 171 raise NotImplementedError
172 173
174 - def removeCallback(self, callback, eventType=None):
175 raise NotImplementedError
176