Changeset 1080
- Timestamp:
- 11/21/06 03:02:58 (2 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
gaphor/branches/new-canvas/gaphor/adapters/connectors.py
r1079 r1080 21 21 22 22 def side(self, handle_pos, glued): 23 """Determine the side on which the handle is connecting. 23 """ 24 Determine the side on which the handle is connecting. 24 25 This is done by determining the proximity to the nearest edge. 25 26 """ … … 38 39 39 40 def glue(self, handle, x, y): 40 """Return the point the handle could connect to. None if no connection 41 """ 42 Return the point the handle could connect to. None if no connection 41 43 is allowed. 42 44 """ … … 46 48 47 49 def connect(self, handle, x, y): 48 """Connect to an element. Note that at this point the line may 50 """ 51 Connect to an element. Note that at this point the line may 49 52 be connected to some other, or the same element by means of the 50 53 handle.connected_to property. Also the connection at UML level … … 86 89 87 90 def disconnect_constraints(self, handle): 88 """Disconnect() takes care of disconnecting the handle from the 91 """ 92 Disconnect() takes care of disconnecting the handle from the 89 93 element it's attached to, by removing the constraints. 90 94 """ … … 97 101 98 102 def disconnect(self, handle): 99 """Do a full disconnect, also disconnect at UML model level. 103 """ 104 Do a full disconnect, also disconnect at UML model level. 100 105 Subclasses should disconnect model-level connections. 101 106 """ … … 105 110 106 111 class CommentLineConnect(SimpleConnect): 107 """Connect a comment line to a comment item. 112 """ 113 Connect a comment line to a comment item. 108 114 Connect Comment.annotatedElement to any element 109 115 … … 112 118 """ 113 119 component.adapts(items.ElementItem, items.CommentLineItem) 114 component.adapts(items.DiagramLine, items.CommentLineItem) 115 116 def glue(self, handle, x, y):117 """In addition to the normal check, both line ends may not be connected120 121 def glue(self, handle, x, y): 122 """ 123 In addition to the normal check, both line ends may not be connected 118 124 to the same element. Same goes for subjects. 119 125 One of the ends should be connected to a UML.Comment element. … … 163 169 164 170 class RelationshipConnect(SimpleConnect): 165 """Base class for relationship connections, such as Association, 171 """ 172 Base class for relationship connections, such as Association, 166 173 dependencies and implementations. 167 174 … … 172 179 173 180 def relationship(self, required_type, head, tail): 174 """ Find an existing relationship in the model that meets the 181 """ 182 Find an existing relationship in the model that meets the 175 183 required type and is connected to the same model element the head 176 184 and tail of the line are conncted to. … … 224 232 225 233 def relationship_or_new(self, type, head, tail): 226 """Like relation(), but create a new instance of none was found. 234 """ 235 Like relation(), but create a new instance of none was found. 227 236 """ 228 237 relation = self.relationship(type, head, tail) … … 253 262 254 263 def disconnect(self, handle): 255 """Disconnect model element. 264 """ 265 Disconnect model element. 256 266 """ 257 267 opposite = self.line.opposite(handle) … … 266 276 267 277 class DependencyConnect(RelationshipConnect): 268 """Connect two NamedItem elements using a Dependency 278 """ 279 Connect two NamedItem elements using a Dependency 269 280 """ 270 281 component.adapts(items.NamedItem, items.DependencyItem) 271 282 272 283 def glue(self, handle, x, y): 273 """In addition to the normal check, both line ends may not be connected 284 """ 285 In addition to the normal check, both line ends may not be connected 274 286 to the same element. Same goes for subjects. 275 287 """ … … 309 321 310 322 class ImplementationConnect(RelationshipConnect): 311 """Connect Interface and a BehavioredClassifier using an Implementation 323 """ 324 Connect Interface and a BehavioredClassifier using an Implementation 312 325 """ 313 326 component.adapts(items.NamedItem, items.ImplementationItem) 314 327 315 328 def glue(self, handle, x, y): 316 """In addition to the normal check, both line ends may not be connected 329 """ 330 In addition to the normal check, both line ends may not be connected 317 331 to the same element. Same goes for subjects. 318 332 """ … … 348 362 349 363 class GeneralizationConnect(RelationshipConnect): 350 """Connect Classifiers with a Generalization relationship. 364 """ 365 Connect Classifiers with a Generalization relationship. 351 366 """ 352 367 component.adapts(items.ClassifierItem, items.GeneralizationItem) … … 379 394 380 395 class IncludeConnect(RelationshipConnect): 381 """Connect Usecases with a Include relationship. 396 """ 397 Connect Usecases with a Include relationship. 382 398 """ 383 399 component.adapts(items.UseCaseItem, items.IncludeItem) 384 400 385 401 def glue(self, handle, x, y): 386 """In addition to the normal check, both line ends may not be connected 402 """ 403 In addition to the normal check, both line ends may not be connected 387 404 to the same element. Same goes for subjects. 388 405 """ … … 408 425 409 426 class ExtendConnect(RelationshipConnect): 410 """Connect Usecases with a Extend relationship. 427 """ 428 Connect Usecases with a Extend relationship. 411 429 """ 412 430 component.adapts(items.UseCaseItem, items.ExtendItem) 413 431 414 432 def glue(self, handle, x, y): 415 """In addition to the normal check, both line ends may not be connected 433 """ 434 In addition to the normal check, both line ends may not be connected 416 435 to the same element. Same goes for subjects. 417 436 """ … … 437 456 438 457 class ExtensionConnect(RelationshipConnect): 439 """Connect Class and a Stereotype using an Extension 458 """ 459 Connect Class and a Stereotype using an Extension 440 460 """ 441 461 component.adapts(items.ClassifierItem, items.ExtensionItem) 442 462 443 463 def glue(self, handle, x, y): 444 """In addition to the normal check, both line ends may not be connected 464 """ 465 In addition to the normal check, both line ends may not be connected 445 466 to the same element. Same goes for subjects. 446 467 """ … … 521 542 522 543 def disconnect(self, handle): 523 """Disconnect model element. 544 """ 545 Disconnect model element. 524 546 Disconnect property (memberEnd) too, in case of end of life for 525 547 Extension … … 541 563 542 564 class AssociationConnect(RelationshipConnect): 543 """Connect Class and a Stereotype using an Extension 565 """ 566 Connect Class and a Stereotype using an Extension 544 567 """ 545 568 component.adapts(items.ClassifierItem, items.AssociationItem) 546 569 547 570 def glue(self, handle, x, y): 548 """In addition to the normal check, both line ends may not be connected 571 """ 572 In addition to the normal check, both line ends may not be connected 549 573 to the same element. Same goes for subjects. 550 574 """ … … 622 646 623 647 def disconnect(self, handle): 624 """Disconnect model element. 648 """ 649 Disconnect model element. 625 650 Disconnect property (memberEnd) too, in case of end of life for 626 651 Extension
