[Uml-devel] [Bug 126391] User interaction with UMLWidget improvements

Daniel Calviño Sánchez danxuliu at gmail.com
Fri Apr 28 00:06:05 UTC 2006


------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=126391         




------- Additional Comments From danxuliu gmail com  2006-04-28 05:56 -------
Created an attachment (id=15811)
 --> (http://bugs.kde.org/attachment.cgi?id=15811&action=view)
User interaction with UMLWidget improvements

As you can see, it's a "big" patch. When I first began coding it, I kept the
existent code. But then I thought that it needed a refactoring. So I added the
new features and also redesigned this part of the code to, in my humble
opinion, a more maintenable and easier to understand code. Every method and
class is commented to help understanding it.

User interaction with UMLWidgets seemed as a complex enough matter to deserve a
class on its own, so I made it. I copied the old code and began refactoring it.
I've also wrote some parts from scratch. Some things where also modified
outside UMLWidget where it was needed. I think that code documentation is
complete enough to not to need to explain it here :) But if there's something
you want me to explain just ask.

In brief, user interaction in UMLWidget is handled in UMLWidgetController. If a
widget needs an specific behaviour (resize only in X axis, for example), a
subclass of UMLWidgetController must be made. There are some virtual protected
methods which are used by the events handler (a Template Design Pattern). In
most cases, override those protected methods will suffice.

The patch, although at this moment it works, has some pending tasks. Those are
marked with comments starting with "TODO" (without quotes). Those TODO tasks
are, in most cases, code copied from the old one that I don't know what it
does. There are also pending tasks such as refactor some code, or fix a method
that stopped working in UMLView (which, by the way, isn't used anywhere... so I
think it could be removed). I upload the patch in this state because I don't
know when I'll have time to work on it again (so maybe someone can finish it)
and because, as said, it already works (not taking into account the bugs :) ).

If I can suggest some things:
-Rename FloatingText to FloatingTextWidget, because it's the only child of
UMLWidget with a name not ending in Widget.
-Move all the widgets classes from umbrello/ to umbrello/widget/, because they
have a common purpose and it'd help to keep the files organized.
-In MessageWidget, methods getMinHeight and getMaxHeight, shouldn't they be
called getMinY and getMaxY? (I may be wrong, but I think they return a
position, not a height nor a width)




More information about the umbrello-devel mailing list