Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » Dropping palette element from palette onto connection
Dropping palette element from palette onto connection [message #1771587] Mon, 28 August 2017 11:08 Go to next message
Alex Kravets is currently offline Alex KravetsFriend
Messages: 561
Registered: November 2009
Senior Member
When element is dropped, the connection is broken up and two connections are created A-B-C. It looks like this is done automatically by Graphiti, if this is the case, how can I attach a listener when this happens?

[Updated on: Mon, 28 August 2017 19:40]

Report message to a moderator

Re: Dropping palette element from palette onto connection [message #1771672 is a reply to message #1771587] Tue, 29 August 2017 13:02 Go to previous messageGo to next message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1931
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Alex,

not sure if I understood your question. Do you mean splitting the connection between 2 objects when you drop a 3rd object onto the connection line? Graphiti allows dropping an object onto a connection but the tool has to react on that and create 2 connections from the one existing and do the wiring of the involved objects and connections, so I'm not sure if you mean that thing as you speak about automatically.

Michael
Re: Dropping palette element from palette onto connection [message #1771673 is a reply to message #1771672] Tue, 29 August 2017 13:15 Go to previous messageGo to next message
Alex Kravets is currently offline Alex KravetsFriend
Messages: 561
Registered: November 2009
Senior Member
So how do I react to this event - when object is dropped? When I put breakpoints in my Add and Create connection features, I don't get any feedback when I drop object from palette onto a connection line between two objects. I do hit the breakpoints when I first drop object onto diagram, and then onto a connection.
Re: Dropping palette element from palette onto connection [message #1771797 is a reply to message #1771673] Wed, 30 August 2017 14:59 Go to previous messageGo to next message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1931
Registered: July 2009
Location: Walldorf, Germany
Senior Member
On drop of an object from the palette the create feature for that object is triggered. In the case of dropping onto a connection the context will have a targetConnection set.

Does that help?

Michael
Re: Dropping palette element from palette onto connection [message #1771799 is a reply to message #1771797] Wed, 30 August 2017 15:20 Go to previous messageGo to next message
Alex Kravets is currently offline Alex KravetsFriend
Messages: 561
Registered: November 2009
Senior Member
Yes, thank you. That's what I needed.
Re: Dropping palette element from palette onto connection [message #1771962 is a reply to message #1771799] Fri, 01 September 2017 14:54 Go to previous messageGo to next message
Alex Kravets is currently offline Alex KravetsFriend
Messages: 561
Registered: November 2009
Senior Member
While working on this I feel like I am doing manual manipulation of connections instead of working with the framework. Here is an example, when I have two object connected the Graphiti model is:
 <connections xsi:type="pi:ManhattanConnection" visible="true" active="true" start="/0/@children.1/@children.0/@anchors.0" end="/0/@children.2/@children.0/@anchors.0">
      <graphicsAlgorithm xsi:type="al:Polyline" foreground="/0/@colors.3" lineWidth="2" filled="false" transparency="0.0"/>
      <link businessObjects="/1/@server/@processflow/@relations/@relation.0"/>
      <connectionDecorators visible="true" active="true" locationRelative="true" location="0.5">
        <graphicsAlgorithm xsi:type="al:Text" foreground="/0/@colors.2" lineWidth="1" filled="false" transparency="0.0" x="10" font="/0/@fonts.0" value=""/>
        <link businessObjects="/1/@server/@processflow/@relations/@relation.0/@relationlabel"/>
      </connectionDecorators>
      <connectionDecorators visible="true" locationRelative="true" location="1.0">
        <graphicsAlgorithm xsi:type="al:Polyline" lineWidth="2" lineStyle="UNSPECIFIED" filled="false">
          <points x="-10" y="7"/>
          <points x="1"/>
          <points x="-10" y="-7"/>
        </graphicsAlgorithm>
      </connectionDecorators>
    </connections>


and my EMF model is:

<relation completion="OnCompletion" frominstance="1" lineid="FLOWCHART_DEFAULT_LINE" toinstance="2">
            <relationlabel/>
          </relation>


As you can see everything corresponds correctly: "children.1" -> "children.2" and frominstance="1" -> frominstance="2"

Once I drop a new object on a connection I get:
<connections xsi:type="pi:ManhattanConnection" visible="true" active="true" start="/0/@children.1/@children.0/@anchors.0" end="/0/@children.3/@children.0/@anchors.0">
      <graphicsAlgorithm xsi:type="al:Polyline" foreground="/0/@colors.3" lineWidth="2" filled="false" transparency="0.0"/>
      <link businessObjects="/1/@server/@processflow/@relations/@relation.0"/>
      <connectionDecorators visible="true" active="true" locationRelative="true" location="0.5">
        <graphicsAlgorithm xsi:type="al:Text" foreground="/0/@colors.2" lineWidth="1" filled="false" transparency="0.0" x="10" font="/0/@fonts.0" value=""/>
        <link businessObjects="/1/@server/@processflow/@relations/@relation.0/@relationlabel"/>
      </connectionDecorators>
      <connectionDecorators visible="true" locationRelative="true" location="1.0">
        <graphicsAlgorithm xsi:type="al:Polyline" lineWidth="2" lineStyle="UNSPECIFIED" filled="false">
          <points x="-10" y="7"/>
          <points x="1"/>
          <points x="-10" y="-7"/>
        </graphicsAlgorithm>
      </connectionDecorators>
    </connections>
    <connections xsi:type="pi:ManhattanConnection" visible="true" active="true" start="/0/@children.3/@children.0/@anchors.0" end="/0/@children.2/@children.0/@anchors.0">
      <graphicsAlgorithm xsi:type="al:Polyline" foreground="/0/@colors.3" lineWidth="2" filled="false" transparency="0.0"/>
      <connectionDecorators visible="true" locationRelative="true" location="1.0">
        <graphicsAlgorithm xsi:type="al:Polyline" lineWidth="2" lineStyle="UNSPECIFIED" filled="false">
          <points x="-10" y="7"/>
          <points x="1"/>
          <points x="-10" y="-7"/>
        </graphicsAlgorithm>
      </connectionDecorators>


Which is children.1 -> children.3 and children.3 -> children.2, this is correct because initial children.1 -> children.2 has been altered with drop of children.3.

However, as you can see second connection does not have connection model linked to it graphical representation and also the model representation was not changed either:

<relation completion="OnCompletion" frominstance="1" lineid="FLOWCHART_DEFAULT_LINE" toinstance="2" />


instead of expected:

<relation completion="OnCompletion" frominstance="1" lineid="FLOWCHART_DEFAULT_LINE" toinstance="3" />
relation completion="OnCompletion" frominstance="3" lineid="FLOWCHART_DEFAULT_LINE" toinstance="2" />


The reason I wrote this was because I feel like framework partially updates UI model and does not update EMF model after drop. Why is there Connection created without linked objects? Should I manually add newly created model Connections to my EMF model? I try that and it works, but I always have the hanging unlinked Connection present.
Re: Dropping palette element from palette onto connection [message #1772082 is a reply to message #1771962] Tue, 05 September 2017 11:12 Go to previous messageGo to next message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1931
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Alex,

one of the basic Graphiti concepts is that the tool is repsonsible for updating the domain model. Graphiti as a framework does not have any knowledge on the domain. When you create a new connections on such a drop operation you will also need to create any domain object that ight be associated with it.

HTH,
Michael
Re: Dropping palette element from palette onto connection [message #1772099 is a reply to message #1772082] Tue, 05 September 2017 13:55 Go to previous messageGo to next message
Alex Kravets is currently offline Alex KravetsFriend
Messages: 561
Registered: November 2009
Senior Member
I understand that, but where does empty connection comes from when I drop onto connection:
 <connections xsi:type="pi:ManhattanConnection" visible="true" active="true" start="/0/@children.3/@children.0/@anchors.0" end="/0/@children.2/@children.0/@anchors.0">
      <graphicsAlgorithm xsi:type="al:Polyline" foreground="/0/@colors.3" lineWidth="2" filled="false" transparency="0.0"/>
      <connectionDecorators visible="true" locationRelative="true" location="1.0">
        <graphicsAlgorithm xsi:type="al:Polyline" lineWidth="2" lineStyle="UNSPECIFIED" filled="false">
          <points x="-10" y="7"/>
          <points x="1"/>
          <points x="-10" y="-7"/>
        </graphicsAlgorithm>
      </connectionDecorators>


I thought that since original link is know 1-2 and new connections are created 1-3-2 then framework knows to create connection 3-2, especially when it created 1-3 already.
Re: Dropping palette element from palette onto connection [message #1772506 is a reply to message #1772099] Mon, 11 September 2017 15:40 Go to previous message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1931
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Alex,

as I wrote above Graphiti as a framework does not have any knowledge about tool-specific things, like how and when to create connections. When you drop an object onto a connection, the tool needs to react on that and:
1) Create the new object or move an existing one in case a more that a location change is required
2) Let the existing connection end (or start) at the dropped object
3) Create a new connection (as clone or also different) as required to connect the dropped object with the original target object
4) Create any domain object for the new connection
5) Adapt existing domain objects if needed

Especially Graphiti does not assume it can create the new connection just the same as the old one.

HTH,
Michael
Previous Topic:Can context menus provided by Graphiti be removed?
Next Topic:Graphiti Graphic Editor
Goto Forum:
  


Current Time: Fri Mar 29 14:45:17 GMT 2024

Powered by FUDForum. Page generated in 0.02575 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top