Changeset 2178
- Timestamp:
- 01/15/08 23:42:14 (11 months ago)
- Files:
-
- gaphor/trunk/gaphor/plugins/pynsource/engineer.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
gaphor/trunk/gaphor/plugins/pynsource/engineer.py
r1996 r2178 101 101 # Finally, create the generalization relationship 102 102 print 'Creating Generalization for %s' % clazz, superclass 103 gen = self.element_factory.create(UML.Generalization)104 gen.general = superclass105 gen.specific = clazz.gaphor_class103 #gen = self.element_factory.create(UML.Generalization) 104 #gen.general = superclass 105 #gen.specific = clazz.gaphor_class 106 106 geni = self.diagram.create(items.GeneralizationItem) 107 geni.subject = gen107 #geni.subject = gen 108 108 109 109 adapter = component.queryMultiAdapter((superclass_item, geni), IConnect) … … 172 172 head_type_item = clazz.gaphor_class_item 173 173 174 relation = self.element_factory.create(UML.Association) 175 head_end = self.element_factory.create(UML.Property) 176 head_end.lowerValue = self.element_factory.create(UML.LiteralSpecification) 177 tail_end = self.element_factory.create(UML.Property) 178 tail_end.name = attr.attrname 179 tail_end.visibility = self._visibility(attr.attrname) 180 tail_end.aggregation = 'composite' 181 tail_end.lowerValue = self.element_factory.create(UML.LiteralSpecification) 182 relation.package = self.diagram.namespace 183 relation.memberEnd = head_end 184 relation.memberEnd = tail_end 185 head_end.type = head_type 186 tail_end.type = tail_type 187 head_type.ownedAttribute = tail_end 188 tail_type.ownedAttribute = head_end 189 190 # Now create the diagram item: 174 #relation = self.element_factory.create(UML.Association) 175 #head_end = self.element_factory.create(UML.Property) 176 #head_end.lowerValue = self.element_factory.create(UML.LiteralSpecification) 177 #tail_end = self.element_factory.create(UML.Property) 178 #tail_end.name = attr.attrname 179 #tail_end.visibility = self._visibility(attr.attrname) 180 #tail_end.aggregation = 'composite' 181 #tail_end.lowerValue = self.element_factory.create(UML.LiteralSpecification) 182 #relation.package = self.diagram.namespace 183 #relation.memberEnd = head_end 184 #relation.memberEnd = tail_end 185 #head_end.type = head_type 186 #tail_end.type = tail_type 187 #head_type.ownedAttribute = tail_end 188 #tail_type.ownedAttribute = head_end 189 190 191 # Now the subject 192 #association.subject = relation 193 #association.head_end.subject = head_end 194 #association.tail_end.subject = tail_end 195 196 # Create the diagram item: 191 197 association = self.diagram.create(items.AssociationItem) 192 198 193 # First connect one handle:194 #head_type_item.connect_handle(association.handles[0])195 199 adapter = component.queryMultiAdapter((head_type_item, association), IConnect) 196 200 assert adapter … … 198 202 adapter.connect(handle) 199 203 200 201 # Now the subject202 association.subject = relation203 association.head_end.subject = head_end204 association.tail_end.subject = tail_end205 206 # Connecting the other handle last will avoid a lookup for207 # an Association. in stead the association applied as subject208 # is used.209 #tail_type_item.connect_handle(association.handles[-1])210 204 adapter = component.queryMultiAdapter((tail_type_item, association), IConnect) 211 205 assert adapter … … 213 207 adapter.connect(handle) 214 208 209 # Apply attribute information to the association (ends) 210 association.head_end.navigability = False 211 tail_prop = association.tail_end.subject 212 tail_prop.name = attr.attrname 213 tail_prop.visibility = self._visibility(attr.attrname) 214 tail_prop.aggregation = 'composite' 215 215 else: 216 216 # Create a simple attribute:
