| 1 |
Relationships |
|---|
| 2 |
|
|---|
| 3 |
A difficult point is relationships. We already have coded out one specific case: |
|---|
| 4 |
comment lines, but those have a different behavior since they do not have |
|---|
| 5 |
a model element of their own... |
|---|
| 6 |
|
|---|
| 7 |
- In case of generalizations, realizations and dependencies, the direction of |
|---|
| 8 |
the relationship is very important (not to mention state diagrams...) |
|---|
| 9 |
- Assocuations have special model elements (AssociationEnd) at the end of |
|---|
| 10 |
each line. |
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
Generalization, Realization, Denepency, etc. |
|---|
| 14 |
|
|---|
| 15 |
If one end of a relationship is not connected, nothing should happen... |
|---|
| 16 |
|
|---|
| 17 |
We should try to manage all interaction from the model elements (classifiers, |
|---|
| 18 |
etc.), since the canvas sends connect signals to those items (not the item |
|---|
| 19 |
which handle is about to be connected). |
|---|
| 20 |
|
|---|
| 21 |
This means that we should be able to determine: |
|---|
| 22 |
- on which end of the relationship we are |
|---|
| 23 |
- what's on the other end of the relationship |
|---|
| 24 |
- do a lookup to see if such relationship already exists |
|---|
| 25 |
- create a new/assign an existing relationship to the connecting item |
|---|
| 26 |
- remove the relationship on disconnect or deletion (reset on UNDO) |
|---|
| 27 |
|
|---|
| 28 |
|
|---|
| 29 |
Association |
|---|
| 30 |
|
|---|
| 31 |
Association is a pretty difficult case, since we are dealing with a collection |
|---|
| 32 |
of objects at one (Assocation and a bunch of AssociationEnd objects). |
|---|
| 33 |
|
|---|
| 34 |
At first we will only make bi-directional assocaitions (no n-ary assocaitions, |
|---|
| 35 |
the ones with a 'diamond' inside). |
|---|
| 36 |
|
|---|
| 37 |
If only one end is connected we do not need to do anything. |
|---|
| 38 |
|
|---|
| 39 |
We should be able to determine: |
|---|
| 40 |
- If an assocaition already exists between the given classes |
|---|
| 41 |
- If an assocaition between classes is already drawn on the diagram (in which |
|---|
| 42 |
case we should look for another existing assocaition or create a new one) |
|---|
| 43 |
- |
|---|
| 44 |
|
|---|
| 45 |
Note: |
|---|
| 46 |
|
|---|
| 47 |
Some kinds of relations are repreesented by a line in a diagram, but have no |
|---|
| 48 |
direct mapping to some model element (e.g. a comment line which connects a |
|---|
| 49 |
comment to a model element). How do we determine if such a relation needs |
|---|
| 50 |
to be removed or can stay? For comment lines we could check all representations |
|---|
| 51 |
of the comment and see if one of the annotedElement's is in a diagram. If the |
|---|
| 52 |
count is 2 or more, the relationship should remain intact. |
|---|
| 53 |
|
|---|