Bug 403515 - Ports on component diagram are randomly disappeared
Summary: Ports on component diagram are randomly disappeared
Status: RESOLVED FIXED
Alias: None
Product: umbrello
Classification: Applications
Component: general (show other bugs)
Version: 2.27.1 (KDE Applications 18.12.1)
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Umbrello Development Group
URL:
Keywords:
Depends on: 403622 403888
Blocks:
  Show dependency treegraph
 
Reported: 2019-01-22 20:24 UTC by sggdev.im
Modified: 2019-02-03 16:28 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 2.27.2 (KDE Applications 18.12.2)
Sentry Crash Report:


Attachments
ESolverServer_umbrello.xmi (753.35 KB, application/x-uml)
2019-01-24 19:26 UTC, sggdev.im
Details
Working testcase with single component diagram and three ports (11.26 KB, application/x-uml)
2019-01-24 22:02 UTC, Ralf Habacker
Details

Note You need to log in before you can comment on or make changes to this bug.
Description sggdev.im 2019-01-22 20:24:35 UTC
SUMMARY
Some ports are disappeared on component diagram after saving/loading file.

STEPS TO REPRODUCE
1. Create component diagram
2. Create Component
3. Create more than 2 ports (do not connect them with other ports or interfaces) on component
4. Save file with diagram
5. Close Umbrello
6. Open Umbrello
7. Open file with diagram

OBSERVED RESULT
Some ports are disappeared on diagram, but still staying in list.

EXPECTED RESULT
Ports in list and on diagram are corresponding.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: OpenSuse Thumbleweed
Qt Version: 5.12
Comment 1 Ralf Habacker 2019-01-24 08:20:13 UTC
> Some ports are disappeared on diagram

I am not able to reproduce this issue. Following your advice I added 3 ports on different positions at the component border. After save and load they are always on the expected position.

> but still staying in list.
I assume that they are all on the same widget position - please try to select and move them to different locations.   

Please append a related xmi test file showing the issue to this ticket.
Comment 2 sggdev.im 2019-01-24 19:26:23 UTC
Created attachment 117643 [details]
ESolverServer_umbrello.xmi

Hello! Here is the sample file. Try to modify 'package diagram' by adding
some ports.

чт, 24 янв. 2019 г. в 11:20, Ralf Habacker <bugzilla_noreply@kde.org>:

> https://bugs.kde.org/show_bug.cgi?id=403515
>
> Ralf Habacker <ralf.habacker@freenet.de> changed:
>
>            What    |Removed                     |Added
>
> ----------------------------------------------------------------------------
>          Resolution|FIXED                       |WAITINGFORINFO
>
> --
> You are receiving this mail because:
> You reported the bug.
Comment 3 Ralf Habacker 2019-01-24 22:02:21 UTC
Created attachment 117647 [details]
Working testcase with single component diagram and three ports

The comparison of this file with the faulty file shows that there are missing <portwidget> tags in the xmi file.

It is possible to do this by manually editing the xmi file or by adding a correction method when loading a file. 

For manual editing, test.xmi can be used as an example for the mapping.

A corresponding correction function should be included in UMLScenePrivate (for example fixupPorts()) and should be called at the end of UMLScene::loadFromXMI1() for component diagrams. The implementation should do the following:
1. iterate over all component widgets (UMLScene::widgetList())
1.1. get the corresponding UML component instance (by UMLWidget::umlObject())
1.2. get the corresponding ports (UMLComponent::containedObjects())
1.3 iterate over all UMLPort instances 
1.3.1 find corresponding port widget by comparing UMLObject::id() with UMLWidget::id()
If no widget is available, it would have to be created with the component widget as parent.
Comment 4 Ralf Habacker 2019-01-24 22:15:11 UTC
(In reply to sggdev.im from comment #2)
> Created attachment 117643 [details]
> ESolverServer_umbrello.xmi

Nice example - which contains some additional problems that should be fixed in other fixup functions, like multiple flow texts (e.g. xmi.id="uGPoF20rHakfx") and text lying around that actually belong to an interface (e.g. "UserGetScriptsJob").
Comment 5 Ralf Habacker 2019-01-24 22:53:39 UTC
Git commit 4cd475f384c50661b7751d50a91befd5504b7d87 by Ralf Habacker.
Committed on 24/01/2019 at 22:52.
Pushed by habacker into branch 'Applications/18.12'.

Add missing port widgets when loading component diagrams

The open question is why portwidgets get lost.
FIXED-IN:18.12.2

M  +50   -2    umbrello/umlscene.cpp

https://commits.kde.org/umbrello/4cd475f384c50661b7751d50a91befd5504b7d87
Comment 6 Ralf Habacker 2019-01-25 16:02:13 UTC
(In reply to Ralf Habacker from comment #5)
> The open question is why portwidgets get lost.

The answer is simple: Umbrello allows you to delete the port widget in the diagram, but does not delete the corresponding Uml port.

Deleting the uml port in the tree view also deletes the corresponding port widget.
Comment 7 Ralf Habacker 2019-01-25 23:48:31 UTC
Git commit bc435c590cf357818f99a1e9120a023e1ea5a380 by Ralf Habacker.
Committed on 25/01/2019 at 23:47.
Pushed by habacker into branch 'Applications/18.12'.

When deleting port widgets, also delete the corresponding UML port
FIXED-IN:2.27.2 (KDE Applications 18.12.2)

M  +8    -0    umbrello/umlwidgets/portwidget.cpp

https://commits.kde.org/umbrello/bc435c590cf357818f99a1e9120a023e1ea5a380
Comment 8 Ralf Habacker 2019-01-25 23:48:31 UTC
Git commit f0afd735dc1aaf66da208951b96377a421b3653e by Ralf Habacker.
Committed on 25/01/2019 at 17:05.
Pushed by habacker into branch 'Applications/18.12'.

Fix center position for showing port widgets

Port widgets are childs of component widgets, for which pos() returns
local position. Therefore we need to use scenePos() to get the
absolute scene position.

M  +1    -1    umbrello/umllistview.cpp

https://commits.kde.org/umbrello/f0afd735dc1aaf66da208951b96377a421b3653e
Comment 9 Ralf Habacker 2019-01-26 00:18:33 UTC
Another problem with this example is that in component "UserAdminAccounts" ports are located inside the component, where in most other places ports are located over the component border (see for example https://www.uml-diagrams.org/port.html)  Moving such a ports let it jumps to the top of the component.

A fix would be to adjust the vertical or horizontal position of such ports on loading. If the port is located on top/bottom the vertical position need to be adjusted and the horizontal position if located at the left/right border.
Comment 10 Ralf Habacker 2019-01-26 10:41:37 UTC
Git commit 7f44fe35f4978096176285ffbc0a36aba1d4d0de by Ralf Habacker.
Committed on 26/01/2019 at 10:41.
Pushed by habacker into branch 'Applications/18.12'.

Use a better location for deleting UML Port instance

Using the PortWidget destructor to delete the related uml object is the
wrong place. Instead handle this in UMLScene::deleteSelection().

M  +5    -1    umbrello/umlscene.cpp
M  +0    -6    umbrello/umlwidgets/portwidget.cpp

https://commits.kde.org/umbrello/7f44fe35f4978096176285ffbc0a36aba1d4d0de
Comment 11 Ralf Habacker 2019-01-26 12:53:41 UTC
Git commit fd91b82bacd1d928362d06440b14e09452df8d2f by Ralf Habacker.
Committed on 26/01/2019 at 12:53.
Pushed by habacker into branch 'Applications/18.12'.

Make sure to only remove present ports

Fixup of commit a649d0e15.

M  +2    -1    umbrello/umlscene.cpp

https://commits.kde.org/umbrello/fd91b82bacd1d928362d06440b14e09452df8d2f
Comment 12 Ralf Habacker 2019-02-03 13:16:23 UTC
(In reply to Ralf Habacker from comment #9)
> Another problem with this example is that in component "UserAdminAccounts"
> ports are located inside the component, where in most other places ports are
> located over the component border (see for example

This has been fixed with bug 403622.
Comment 13 Ralf Habacker 2019-02-03 13:17:30 UTC
(In reply to Ralf Habacker from comment #4)

> Nice example - which contains some additional problems that should be fixed
> in other fixup functions, like multiple flow texts (e.g.
> xmi.id="uGPoF20rHakfx") and text lying around that actually belong to an
> interface (e.g. "UserGetScriptsJob").

fixed with bug 403888
Comment 14 Gerhard Landsmann 2019-02-03 16:27:20 UTC
PLEASE GET ME OFF THE DISTRIBUTION!!!


Am 03.02.19 um 14:17 schrieb Ralf Habacker:
> https://bugs.kde.org/show_bug.cgi?id=403515
>
> Ralf Habacker <ralf.habacker@freenet.de> changed:
>
>             What    |Removed                     |Added
> ----------------------------------------------------------------------------
>           Depends on|                            |403888
>
> --- Comment #13 from Ralf Habacker <ralf.habacker@freenet.de> ---
> (In reply to Ralf Habacker from comment #4)
>
>> Nice example - which contains some additional problems that should be fixed
>> in other fixup functions, like multiple flow texts (e.g.
>> xmi.id="uGPoF20rHakfx") and text lying around that actually belong to an
>> interface (e.g. "UserGetScriptsJob").
> fixed with bug 403888
>
>
> Referenced Bugs:
>
> https://bugs.kde.org/show_bug.cgi?id=403888
> [Bug 403888] Duplicated text labels in xmi file
Comment 15 Gerhard Landsmann 2019-02-03 16:28:20 UTC
PLEASE GET ME OFF THE DISTRIBUTION!!!


Am 03.02.19 um 14:16 schrieb Ralf Habacker:
> https://bugs.kde.org/show_bug.cgi?id=403515
>
> Ralf Habacker <ralf.habacker@freenet.de> changed:
>
>             What    |Removed                     |Added
> ----------------------------------------------------------------------------
>           Depends on|                            |403622
>
> --- Comment #12 from Ralf Habacker <ralf.habacker@freenet.de> ---
> (In reply to Ralf Habacker from comment #9)
>> Another problem with this example is that in component "UserAdminAccounts"
>> ports are located inside the component, where in most other places ports are
>> located over the component border (see for example
> This has been fixed with bug 403622.
>
>
> Referenced Bugs:
>
> https://bugs.kde.org/show_bug.cgi?id=403622
> [Bug 403622] Incorrect port positions when loading old files