[Uml-devel] Some fixes for sequence diagrams - at least partly very important
Achim Spangler
Achim.Spangler at mnet-online.de
Thu Jul 15 10:53:07 UTC 2004
Hi,
I had some problems with sequence diagrams -> so I fixed them.
a) The FloatingText was not correctly placed on load
+ Reason: the FloatingText was _not_ saved during saveToXMI
but load FromXMI requested, that the FloatingText can be
found _before_ the load of the corresponding
MessageWidget - Hen and Egg Problem
+ Solution:
1) save FloatingText like performed by normal AssociationWidget
2) load the data child element with the FloatingText so that
it can be initialised correctly during loadFromXMI
THIS FIX IS VERY IMPORTANT
IF NEEDED FOR CODE FREEZE, I CAN MAKE A SINGLE DIFF FOR THIS CHANGE
( in case some people are asking, why this change must come this late.
At the moment, the FloatingText of each sequence diagram is placed in the
upper left corner on load; after the message widget is moved with mouse,
the text is moved to the right place - but the initial diagram is hopefully
wrong )
b) The horizontal positioning of FloatingText has problems, if text len is
longer than the distance between both objects
-> Fix: limit left position always to lifeline of the left object
( alternative: limit it at least to the co-ordinate 0 - otherwise some
warning messages are triggered by FloatingText to indicate a wrong
text movement - the current position calculation leads often to
negative x-pos )
c) the lifeline of the objects is too long on initial load
If at least one message is moved in the sequence diagram, the lifeline is
changed to the correct position ( 20 units longer than lowest message
widget ). But the len of the initial load is often wrong.
Reason:
The function SeqLineWidget::setEndOfLine(int) was wrong and too complicated
( maybe as a result from the behavioural change from fixed size to event
based automatic len update ).
It calculates the following:
+ delta := newY - oldY;
+ endPos.Y := oldY + delta
( written in other order with some unused variables inbetween - but the net
result is this calculation )
During this cleanup, the unused function SeqLineWidget::setLineLength() is
deleted and the variables m_nOffsetY, m_nOldY, m_nMinY are also erased.
The m_nOffsetY was only set to _0_ in constructor and _read_ in a
calculation in the old version of SeqLineWidget::setEndOfLine(int) -> no
effect.
The m_nOldY was only used for the complicated calculation.
The m_nMinY was planned to reflect the lower side of the object rectangle
-> upper limit for the lifeline
- but this value was set only in constructor where at least during
load the corresponding ObjectWidget
- it's better to check in the function
SeqLineWidget::setEndOfLine(int) the current placement
d) Some small changes: The warning about UMLWidget::adjustAssocs(),
AssociationWidget::moveEvent() and AssociationWidget::widgetMoved()
prints now also the type of diagram and type of element in the debug
stream.
Thus we can trace the event chain better, to avoid all these move
activities during project load, where only the initial state shall be
reloaded.
Bye,
Achim
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fixSequenceDiagLoad.diff
Type: text/x-diff
Size: 9018 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/umbrello-devel/attachments/20040715/b88ee748/attachment.bin>
More information about the umbrello-devel
mailing list