Changeset 2226
- Timestamp:
- 02/26/08 04:06:00 (3 months ago)
- Files:
-
- gaphor/trunk/gaphor/adapters/connectors.py (modified) (2 diffs)
- gaphor/trunk/gaphor/adapters/tests/test_connector.py (modified) (2 diffs)
- gaphor/trunk/gaphor/diagram/activitynodes.py (modified) (3 diffs)
- gaphor/trunk/gaphor/diagram/objectnode.py (modified) (1 diff)
- gaphor/trunk/gaphor/tests/testcase.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
gaphor/trunk/gaphor/adapters/connectors.py
r2224 r2226 90 90 def _disconnect(): 91 91 self.disconnect(handle) 92 handle.disconnect = lambda: 093 92 handle.disconnect = _disconnect 94 93 … … 101 100 """ 102 101 self.disconnect_constraints(handle) 103 # TODO: AJM: is this correct? Should move to handle.disconnect()?104 102 handle.connected_to = None 103 handle.disconnect = lambda: 0 105 104 106 105 gaphor/trunk/gaphor/adapters/tests/test_connector.py
r2224 r2226 42 42 assert not comment.subject.annotatedElement, comment.subject.annotatedElement 43 43 44 # print '# now connect the actor'44 # now connect the actor 45 45 46 46 adapter = component.queryMultiAdapter((actor, line), IConnect) … … 74 74 assert len(comment.subject.annotatedElement) == 0, comment.subject.annotatedElement 75 75 assert not actor2.subject in comment.subject.annotatedElement, comment.subject.annotatedElement 76 77 adapter = component.queryMultiAdapter((comment, line), IConnect) 78 79 handle = line.head 80 adapter.disconnect(handle) 81 82 83 def test_commentline_class(self): 84 """ 85 Connect a CommentLine to a class and unlink the commentLine 86 afterwards. 87 """ 88 clazz = self.create(items.ClassItem, UML.Class) 89 comment = self.create(items.CommentItem, UML.Comment) 90 line = self.create(items.CommentLineItem) 91 92 adapter = component.queryMultiAdapter((comment, line), IConnect) 93 handle = line.head 94 adapter.connect(handle) 95 96 adapter = component.queryMultiAdapter((clazz, line), IConnect) 97 handle = line.tail 98 adapter.connect(handle) 99 100 assert clazz.subject in comment.subject.annotatedElement 101 assert comment.subject in clazz.subject.ownedComment 102 103 line.unlink() 104 105 assert not comment.subject.annotatedElement 106 assert not clazz.subject.ownedComment 107 108 109 def test_commentline_relationship_unlink(self): 110 """ 111 Connect a CommentLine to a relationship item. 112 Removing the relationship should work. 113 114 Demonstrates defect #103. 115 """ 116 clazz1 = self.create(items.ClassItem, UML.Class) 117 clazz2 = self.create(items.ClassItem, UML.Class) 118 gen = self.create(items.GeneralizationItem) 119 120 adapter = component.queryMultiAdapter((clazz1, gen), IConnect) 121 handle = gen.head 122 adapter.connect(handle) 123 124 adapter = component.queryMultiAdapter((clazz2, gen), IConnect) 125 handle = gen.tail 126 adapter.connect(handle) 127 128 assert gen.subject 129 130 # And now the comment: 131 132 comment = self.create(items.CommentItem, UML.Comment) 133 line = self.create(items.CommentLineItem) 134 135 adapter = component.queryMultiAdapter((comment, line), IConnect) 136 handle = line.head 137 adapter.connect(handle) 138 139 adapter = component.queryMultiAdapter((gen, line), IConnect) 140 handle = line.tail 141 adapter.connect(handle) 142 143 assert gen.subject in comment.subject.annotatedElement 144 assert comment.subject in gen.subject.ownedComment 145 146 gen.unlink() 147 148 assert not comment.subject.annotatedElement 149 assert not gen.subject 76 150 77 151 gaphor/trunk/gaphor/diagram/activitynodes.py
r2120 r2226 216 216 visible=self.is_join_spec_visible) 217 217 218 obj._name = obj.add_text('name', style={218 self._name = self.add_text('name', style={ 219 219 'text-align': self.style.name_align, 220 220 'text-padding': self.style.name_padding, … … 224 224 }, editable=True) 225 225 226 self.add_watch(UML.NamedElement.name, on_named_element_name)227 self.add_watch(UML.JoinNode.joinSpec, on_join_node_join_spec)228 self.add_watch(UML.LiteralSpecification.value, on_join_node_join_spec)226 self.add_watch(UML.NamedElement.name, self.on_named_element_name) 227 self.add_watch(UML.JoinNode.joinSpec, self.on_join_node_join_spec) 228 self.add_watch(UML.LiteralSpecification.value, self.on_join_node_join_spec) 229 229 230 230 … … 331 331 332 332 def on_named_element_name(self, event): 333 self._name.text = subject.name 334 self.request_update() 333 subject = self.subject 334 if subject and (event is None or event.element is subject): 335 self._name.text = subject.name 336 self.request_update() 335 337 336 338 def on_join_node_join_spec(self, event): 337 339 subject = self.subject 338 if s elf.subject and is_join_node(subject) and \340 if subject and is_join_node(subject) and \ 339 341 (event.element is subject.joinSpec or \ 340 342 event.element is subject.joinSpec.value): gaphor/trunk/gaphor/diagram/objectnode.py
r2120 r2226 49 49 visible=self._get_show_ordering) 50 50 51 self.add_watch(UML.ValueSpecification) 52 self.add_watch(UML.ValueSpecification.value) 51 self.add_watch(UML.LiteralSpecification.value) 53 52 self.add_watch(UML.ObjectNode.ordering) 54 53 gaphor/trunk/gaphor/tests/testcase.py
r2225 r2226 10 10 11 11 from gaphor import UML 12 from gaphor import storage12 from gaphor.storage import storage 13 13 from gaphor.application import Application 14 14 from gaphor.misc.xmlwriter import XMLWriter
