gaphor icon indicating copy to clipboard operation
gaphor copied to clipboard

Disallow free-floating ports for SysML

Open sz332 opened this issue 2 years ago • 25 comments

Describe the solution you'd like

1, Ports cannot exist without a container, so creating a port not as part of a "block" should be disallowed. 2, When a port is added to a block, it shall be added to the outside line. 3, When a port as part of the block is being moved, it shall move only around the border, not inside or outside.

sz332 avatar Jul 10 '23 11:07 sz332

The way you describe it, it looks a lot like Parameters on Activities: edit delete parameters in the Property Editor. Are you proposing a similar approach for ports?

amolenaar avatar Jul 11 '23 08:07 amolenaar

I would simplify the possible actions a user can do to the following:

Adding a new port:

  • Select a port icon on the toolbar
  • Click outside a non-block element's boundary: nothing happens
  • Moves the mouse to the boundary of the block: show rectangle. Clicks: display port on the edge.
  • Moves the mouse inside the block and clicks: add ports to the edge.

To move a port around:

  • Drags a port at the edge: can be moved only around the edges. Not inside, not outside.

To remove a port:

  • Click on the port and press delete or anything alike.

sz332 avatar Jul 11 '23 11:07 sz332

Click outside a non-block element's boundary: nothing happens

I think it's weird to let nothing happen. We should at least provide feedback to the user.

A ProxyPort is only created in the model when a Port (item) is connected to a block.

amolenaar avatar Jul 12 '23 12:07 amolenaar

I think we just found another problem.

Create a block. Select proxy port. Click on the diagram outside the block. I will see a port being displayed free floating. It is although not associated to a block, that is true, but I would argue that a port cannot exist (displayed) on a diagram as NOT part of a block.

image

sz332 avatar Jul 12 '23 12:07 sz332

I agree that a port has no value, unless it's connected to the border of a block.

I propose we make the interaction similar to what we currently have for Parameters on Activities.

amolenaar avatar Jul 12 '23 13:07 amolenaar

I tried out the parameters on activities and it wasn't intuitive to be honest. I started looking for the activity parameter on the toolbar, but did not find it, and then I by mistake clicked on the activity and then I saw, okay, this is how I can add a new parameter.

The current functionality is great, the only thing you need to do is to disallow adding a port to a diagram alone.

sz332 avatar Jul 12 '23 14:07 sz332

We could also do something with color. For example make the port red if it is not connected.

(just thinking through some options)

amolenaar avatar Jul 12 '23 14:07 amolenaar

I would say a solution that is well designed shall not allow invalid states. In my opinion having a free floating port is an invalid state, therefore it shall not be achieved. By not allowing it will simply cut down the "and what if" complexity. What do you think?

sz332 avatar Jul 12 '23 18:07 sz332

The underlaying mechanism is similar to the issues you describe in #2484, and #2481.

The elements in the model are only created when the pin/port/relationship is properly connected. The underlaying model is always consistent.

I do not think Gaphor should be very restrictive/prescriptive in that respect. A user should be able to move a relationship aside and reconnect it at a later point. The model is in an "invalid state" for a while.

Also, what is valid and not valid depends on the methodology you follow. SysML is only a generic language.

I think we should treat validation as a separate (opt-in) topic.

Validation can currently be achieved with:

amolenaar avatar Jul 15 '23 12:07 amolenaar

In my opinion this is not a need from a modeler point of view. I never wanted to reuse a connection during the years I have been doing modeling, and in the usability it causes me personally more harm than good, because I mistakenly tend to disconnect pins/edges and then I have to reconnect them which goes really against my user experience. It is especially painful when working on a laptop, using a touchpad.

In my opinion it is both a philosophical question and a UX (user experience) question as well. What I suggest here is to get the community involved more and ask their opinion, and/or make some video recording about how people would use the tool and ask them to comment their feelings so that we get realistic feedback.

sz332 avatar Jul 15 '23 12:07 sz332

I agree that constraining the port once it has been connected to the block to the boundary of the block would greatly improve the ability to align them.

It also isn't consistent with Parameter Nodes on Activities, which @amolenaar pointed out. I propose we make them match, then a future feature could be adding ports and parameter nodes to the toolbars for drag and drop, if we think that is a better user experience (I'm unsure of this or not to be honest).

danyeaw avatar Jul 15 '23 14:07 danyeaw

I propose we make them match

What do you mean by match? Provide port functionality similar to how Parameters on Activities work? Or allow Parameters to be added via the toolbox?

amolenaar avatar Jul 15 '23 14:07 amolenaar

In my opinion both functions shall be available.

  • For an action there should be a way to add ports by using a tabular structure
  • Also for an Activity parameters there should be a way to add parameter from the menu using drag and drop

sz332 avatar Jul 15 '23 14:07 sz332

For this first step, I propose we add ports using the tabular structure, which is how Parameter Nodes work.

danyeaw avatar Jul 15 '23 15:07 danyeaw

And make them not disconnect, as Parameter Nodes do.

I suppose we should give a similar treatment to Pins (in activity diagrams).

amolenaar avatar Jul 16 '23 21:07 amolenaar

Totally agree. They shall work consistently.

sz332 avatar Jul 17 '23 05:07 sz332

Making the node pins not free-floating is a really good idea. At the moment moving a node pin slightly off its line causes it to disconnect and lose its label which is frustrating because you often want to move them up or down, if they behaved like parameter nodes that would solve this problem. Additionally, you can copy/paste text into the right-hand side window much quicker than you can drag the node pin.

RichardB01 avatar Jul 17 '23 19:07 RichardB01

@amolenaar how should we progress with this? In my opinion we should just simply remove the capability to disconnect a pin, and it solves most of the problems in usability and we can simply close this task.

sz332 avatar Jul 23 '23 05:07 sz332

I have to check how it's done for Parameter nodes. Effectively, if you refuse to disconnect, it should stay connected, but we should also check if it works if you delete a pin.

amolenaar avatar Jul 23 '23 08:07 amolenaar

From the user point of view, when working with an action having pins, it is extremely easy to disconnect a pin, especially when using a laptop. I see no use case where a modeler wants to disconnect a pin: either he wants to move it on the edge of the action in order to make the diagram look nicer or remove it altogether.

sz332 avatar Jul 23 '23 08:07 sz332

From the user point of view, when working with an action having pins, it is extremely easy to disconnect a pin, especially when using a laptop.

I had the same experience when I was playing around with it a bit.

amolenaar avatar Jul 23 '23 11:07 amolenaar

https://github.com/gaphor/gaphor/issues/2484#issuecomment-1646857560 I made a proposal under the related issue. I think it can be applied to the ports as well and would solve a part of what has been discussed under this issue.

marek-piirikivi avatar Jul 23 '23 14:07 marek-piirikivi

This ticket is almost solved, the only thing we are missing is to disallow adding a pin to a diagram without an action as a parent.

sz332 avatar Aug 10 '23 08:08 sz332

@sz332 I'll do that.

marek-piirikivi avatar Aug 11 '23 03:08 marek-piirikivi

Here's what I would probose to do with these floating ports. It was also discussed in Element app about async validation which is in itself much larger issue. Let us agree whether what I propose is what we want so I can implement it (while taking consideration your refinements); or if not, then lets close the issue.

@sz332 @amolenaar Please review:

  1. When clicking on pin/port in the toolbox, the active diagram grays out everything that the pin/port can not be attached to.
  2. When clicking on the diagram while the pin/port tool is active, new floating pin/port item is added to the diagram and it can be dragged around.
  3. When releasing the pin/port item and it is not attached to anything, the diagram removes the item and displays notification that pin/port can only be attached to and was removed automatically.

Refinements (2) gray out still is active while dragging to guide the user to do valid things. (3) we can also add setting to control this behavior if someone finds it undesireable.

marek-piirikivi avatar Aug 13 '23 04:08 marek-piirikivi