Changeset 2430

Show
Ignore:
Timestamp:
10/11/08 05:06:16 (2 months ago)
Author:
wrobe..@pld-linux.org
Message:

- connecting normal dependencies to folded interfaces won't be supported

(see gaphor.diagram.classes.interface module documentation for reasons)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • gaphor/branches/ports/gaphor/adapters/classes/tests/test_interfaceconnect.py

    r2428 r2430  
    6868 
    6969LINES = (items.ImplementationItem, 
     70        items.DependencyItem, 
    7071        items.GeneralizationItem, 
    7172        items.AssociationItem, 
     
    7374        items.ExtendItem) 
    7475 
    75 class FoldedInterfaceWithImplementationTestCase(TestCase): 
     76class FoldedInterfaceMultipleLinesTestCase(TestCase): 
    7677    """ 
    7778    Test connection of additional diagram lines to folded interface, 
    78     which has already implementation connected. 
     79    which has already usage depenendency or implementation connected. 
    7980    """ 
    8081    def setUp(self): 
    81         super(FoldedInterfaceWithImplementationTestCase, self).setUp() 
     82        super(FoldedInterfaceMultipleLinesTestCase, self).setUp() 
    8283 
    8384        self.iface = self.create(items.InterfaceItem, UML.Interface) 
    8485        self.iface.folded = self.iface.FOLDED_PROVIDED 
     86 
     87 
     88    def test_interface_with_implementation(self): 
     89        """Test glueing different lines to folded interface with implementation 
     90        """ 
    8591        impl = self.create(items.ImplementationItem) 
    86  
    8792        self.connect(impl, impl.head, self.iface) 
    8893 
    89  
    90     def test_any_line(self): 
    91         """Test glueing different lines to folded interface with implementation 
    92         """ 
    9394        for cls in LINES: 
    9495            line = self.create(cls) 
     
    9899 
    99100 
    100     def test_dependency_glue(self): 
    101         """Test glueing dependency to folded interface with implementation 
     101    def test_interface_with_dependency(self): 
     102        """Test glueing different lines to folded interface with dependency 
    102103        """ 
    103104        dep = self.create(items.DependencyItem) 
    104         glued = self.glue(dep, dep.head, self.iface) 
    105         # dependency can be glued... 
    106         self.assertTrue(glued) 
    107         # ... but it cannot be usage dependency 
    108         self.assertFalse(dep.is_usage(self.iface.subject)) 
    109  
    110  
    111  
    112 class FoldedInterfaceWithDependency(TestCase): 
    113     """ 
    114     Test connection of additional diagram lines to folded interface, 
    115     which has already dependency connected. 
    116     """ 
    117     def setUp(self): 
    118         super(FoldedInterfaceWithDependency, self).setUp() 
    119  
    120         self.iface = self.create(items.InterfaceItem, UML.Interface) 
    121         self.iface.folded = self.iface.FOLDED_PROVIDED 
    122         dep = self.create(items.DependencyItem) 
    123  
    124105        self.connect(dep, dep.head, self.iface) 
    125106 
    126  
    127     def test_any_line(self): 
    128         """Test glueing different lines to folded interface with dependency 
    129         """ 
    130107        for cls in LINES: 
    131108            line = self.create(cls) 
     
    135112 
    136113 
    137     def test_dependency_glue(self): 
    138         """Test glueing dependency to folded interface with dependency 
    139         """ 
    140         dep = self.create(items.DependencyItem) 
    141         glued = self.glue(dep, dep.head, self.iface) 
    142         # dependency can be glued... 
    143         self.assertTrue(glued) 
    144         # ... but it cannot be usage dependency 
    145         self.assertFalse(dep.is_usage(self.iface.subject)) 
    146  
    147  
    148114 
    149115# vim:sw=4:et:ai 
  • gaphor/branches/ports/gaphor/diagram/classes/interface.py

    r2429 r2430  
    1414    - only an implementation can be connected (ball - provided interface) 
    1515    - or only usage dependency can be connected (socket - required interface) 
    16     - normal dependencies can be connected as well  
    1716 
    1817Above means that interface cannot be folded when 
    1918 
    2019    - both, usage dependency and implementation are connected 
    21     - any other lines, beside normal dependecies, are connected 
    22  
    23 For examples, see http://martinfowler.com/bliki/BallAndSocket.html. 
     20    - any other lines are connected 
     21 
     22Dependencies 
     23------------ 
     24Dependencies between folded interfaces are *not supported* 
     25 
     26+---------------------+---------------------+ 
     27|     *Supported*     |    *Unsupported*    | 
     28+=====================+=====================+ 
     29| ::                  | ::                  | 
     30|                     |                     | 
     31|   |A|--(    O--|B|  |   |A|--(--->O--|B|  | 
     32|        Z    Z       |        Z    Z       | 
     33+---------------------+---------------------+ 
     34 
     35A requires interface Z and B provides interface Z, Z is connected to itself 
     36with dependency. 
     37 
     38There is no need for additional dependency 
     39 
     40    - UML data model provides information, that Z is common for A and B 
     41      (A requires Z, B provides Z) 
     42    - on a diagram, both folded interface items (required and provided) 
     43      represent the same interface, which is easily identifiable with its 
     44      name 
     45 
     46Even more, adding a dependency between folded interfaces provides 
     47information (on UML data model level) that an interface depenends on itself 
     48but it is not the intention of this (*unsupported*) notation. 
     49 
     50For more examples of non-supported by Gaphor notation, see 
     51http://martinfowler.com/bliki/BallAndSocket.html. 
     52 
    2453 
    2554Folding and Connecting 
     
    3261    - when interface is folded, allow only one implementation or depenedency 
    3362      usage to be connected 
    34     - when interface is folded, allow normal dependencies to be connected as 
    35       well  
    3663 
    3764Above solution is bit restrictive, for example we could allow folding when