remove code that restricts contained nodes from been drawn [message #204278] |
Wed, 03 September 2008 07:25  |
Eclipse User |
|
|
|
Hi, does anyone know where I can find the section of generated code that
stops Nodes been drawn if they belong to a container?
(I need to disable this code so that contained nodes are drawn on my
diagram)
This is because I was unable to use shadow/phantom nodes because it caused
problems in my XML output, so I have disabled the code that removed nodes
when they were given a containment relationship (allowing me to see the
nodes on the diagram when drawing it, and correcting XML model output).
However this has now caused problems when loading a diagram from the
XML(note all xml code is correct), since the graphical representation of
the diagram no-longer uses shadow/phantom nodes the contained nodes are
not displayed on diagram generation!
I am fairly sure that somewhere in the generated code is a function that
checks to see if a node has a container and if it does It restricts the
node from been drawn, I just have no idea where to look for this!
Any help you can offer would be greatly appreciated,
Thank you in advance,
Gary
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: remove code that restricts contained nodes from been drawn [message #206602 is a reply to message #206585] |
Tue, 23 September 2008 08:51   |
Eclipse User |
|
|
|
on re-generating the diagram from model file? A)all the nodes with a
containment relationship are not drawn
Do you mean nodes with incoming containment reference visualized as link?
----Yes!
reopen diagram to check it? A)I have already checked this and the
diagram is drawn with all the nodes, its only when initalizing from
the model file that they are not drawn!
So, looks like diagram initialization code works incorrectly..
---This could very well be the case!
(Updater code should be corrected probably).
-I thought it was the case that it checked to see if nodes had a
containment relationship, and if this was the case it didn't draw
them!
Then to my understanding these nodes should not be drawn on "normal"
diagram as well. So, looks like the problem is: undater does not recognize
these nodes as existing diagram elements and do not try to create them.
---Yes, Maby yor right!
Due to this I haven't looked at the Updater code(maby this should be
my next move?)
Looks like. I suggest you debugging updated on small diagram to see why
corresponding element was not recognized/created on diagram. I think you
can first check generated getA_1000SemanticChildren method. This method is
responsible for returning all the semantic elements of the main diagram
element. In case of containment reference represented as a links on
diagram this method should call getPhantomNodesIterator. I think you can
try debugging this logic to see why corresponding elements was not
recognized as diagram nodes.
As an addition you can try debugging same method on existing diagram
openning to see the difference.
---OK, I will try your above suggestions and get back to you with the
results!
A (container)
|
__B__ (container/not container/can contain elements of same
type)!Abstract
| |
C D (can contain elements of same type)
So, you have two node mappings for C/D without containment reference
specified and link mapping visualizing containment reference from C/D to
C/D, right?
---Yes!
All C/D nodes without incoming containment link (just created or after
link deletion) have to be stored inside A (using containment reference
from A to C/D), right?
---Yes!
Thank you for your advice,
Gary
|
|
|
|
|
|
Re: remove code that restricts contained nodes from been drawn [message #206648 is a reply to message #206618] |
Tue, 23 September 2008 12:50   |
Eclipse User |
|
|
|
Hello Gary,
> Hi Alex, I have created this method as demonstraited below, this still
> has no affect on the issue I am facing!
Well, are you sure this method was the reason of the problem you are facing?
GMF-generated code should be compilable (at least, we do not have any reports
like this). Can you try to re-generate code from scratch (hope it will be
compilable then).
>the one with shadow nodes works except produces incorrect XML since
>nothing is contained within the canvas! (note: contained nodes are
I remember I already suggested a way to solve this problem - you have to
modify generated ???CreateCommand and ???ItemSemanticEditPolicy for containment
link.
>displayed but the link between is shown as a empty node rather than a link
>when initalizing from the model file)
Are you saying the "node" is visible instead of the link visualizing containment
reference on diagram?.. You have to double-check .gmfmap model in this case.
>-- the one without shadow nodes works except doesn't display the contained
>nodes at all when initalizing from the model file! (note: the diagram file
>is displayed correctly)
AFAIU you have to create ChildMappings for the contained nodes to place them
into the top-level nodes in this case.
> ...I think it best to decide which method I should use, based on which
> will be the easyest to fix since working with 2 possible solutions is
> taking more time than needed!
Sure, but for me two different proposed solutions produces really different
diagrams.. (Correct me if I'm wrong, but in first case you'll have only top-level
nodes connected with the links, in second one you'll have top-level nodes
visualizing their children inside their figures etc..) So, i think you should
decide which type of the diagram you are going to create and then choose
one of the solutions to follow (both can be implemented).
> Your suggestion on which method to use and fix would be greatly
> appreciated since you have a much greater knowlage of GMF and know
> which would probably be the easyest issue to solve!!!
For me both solutions looks rather different and taking into account the
fact we were discussing sol.1 in prev. messages in this thread I propose
you continue moving into that direction..
-----------------
Alex Shatalin
|
|
|
Re: remove code that restricts contained nodes from been drawn [message #206696 is a reply to message #206648] |
Wed, 24 September 2008 04:25   |
Eclipse User |
|
|
|
Hi, Alex
Well, are you sure this method was the reason of the problem you are
facing?
GMF-generated code should be compilable (at least, we do not have any
reports like this). Can you try to re-generate code from scratch (hope it
will be compilable then).
----No, I have no idea if this is the reason for my problem, however I
have re-generated code from scratch and still this error is there.
I remember I already suggested a way to solve this problem - you have to
modify generated ???CreateCommand and ???ItemSemanticEditPolicy for
containment link.
----Yes, I tryed this though it would not alow me to create containment to
the canvas when the node is created!
Are you saying the "node" is visible instead of the link visualizing
containment reference on diagram?.. You have to double-check .gmfmap model
in this case.
---No, the parent node is displayed and the child node is displayed but
the link is replaced with an empty node, this also causes nodes to
disapear and move when you move one of the other nodes!
AFAIU you have to create ChildMappings for the contained nodes to place
them into the top-level nodes in this case.
---This cannot be done, since all nodes can be containde by all other nodes
Sure, but for me two different proposed solutions produces really
different diagrams.. (Correct me if I'm wrong, but in first case you'll
have only top-level nodes connected with the links, in second one you'll
have top-level nodes visualizing their children inside their figures
etc..) So, i think you should decide which type of the diagram you are
going to create and then choose one of the solutions to follow (both can
be implemented).
---I think both diagrams should produce the same result all top level
nodes visable and any containd children visible as nodes with a diagram
link.
For me both solutions looks rather different and taking into account the
fact we were discussing sol.1 in prev. messages in this thread I propose
you continue moving into that direction..
---OK, I agree, the solution with shadow nodes does also seam the best way
forward!
Thank you,
Gary
|
|
|
|
|
|
|
|
|
|
|
|
Re: remove code that restricts contained nodes from been drawn [message #207090 is a reply to message #207076] |
Thu, 25 September 2008 10:24  |
Eclipse User |
|
|
|
Hello Gary,
> Any Ideas?
Well, there is an error in diagram definition, i suppose.. Can you try to
re-define this diagram from scratch, make it working and then step-by-step
adding more and more features on it?
BTW, I suggest you using version controll to track changes/store working
versions of model/code..
-----------------
Alex Shatalin
|
|
|