Home » Modeling » GMF (Graphical Modeling Framework) » Affixed parent side
|
Re: Affixed parent side [message #237230 is a reply to message #237031] |
Wed, 22 July 2009 12:56 |
Dimitrios Kolovos Messages: 1776 Registered: July 2009 |
Senior Member |
|
|
Hi Gary,
This may be of assistance:
http://epsilonlabs.wiki.sourceforge.net/EuGENia+GMF+Affixed+ Nodes
If you don't want to install EuGENia, I'm happy to send you the
generated .gmfgraph, .gmfmap models.
Cheers,
Dimitris
Gary wrote:
> I have been unable to find much info about Affixed Parent Side, but I
> think that the use of it may be the solution to one of my problems.
> Note: I have tried using this attribute, but what ever I do it makes all
> my nodes go to the top left corner.
>
> The problem:
> I have a node(A) that contains child(B),
> I want the child(B) to be attached to the edge of its parent (node A)
> like a port.
>
> The Question:
> Will Affixed Parent Side solve my problem?
> If yes how?
> If no, then what is it used for?
>
> (any info would be appreciated)
>
> Thanks in advance,
> Gary
>
|
|
| |
Re: Affixed parent side [message #237313 is a reply to message #237271] |
Thu, 23 July 2009 11:56 |
Tobias Lingemann Messages: 11 Registered: July 2009 |
Junior Member |
|
|
Hi,
it's pretty simple.
Step0:
In your ecore model the parent node should have a containment reference
for your ports, as they are child nodes of the parent node.
Step1:
In your *.gmfgraph you define a node and figure for your port like you do
with every node. With one little difference: You set the option affixed
parent side in the node of your port. With this option you set the default
side, on which side of the parent node the port will be added. But the
generated code doesn't prevent the user to move the port at any side of
the parent node. You have to modify your source code for that.
Step2:
In your *.gmfmap go to the parent node mapping and a child reference for
your port. The compartment option can (maybe even has to???) left empty.
Just enter the contaiment feature of your model and the referenced child
node mapping (your port).
Best regards,
Tobias
Gary wrote:
> Hi Dimitris,
> Thanks for the reply, the link you provided demenstrates exactly what I
> want to produce, with the port attached to its parent node!
> Do you know how I can produce this using the 'affixed parent node' option
> in the ***.gmfgraph ?
> (I have tried using this option, but it just doesn't work, I think I might
> be missing something ..do I need to change the mapping model to get this
> to work?)
> I would like to produce it without editing the generated code where
> possible.
> Thanks for your help,
> Gary
|
|
| | | | | | | | | | |
Re: Affixed parent side [message #237552 is a reply to message #237539] |
Mon, 27 July 2009 11:59 |
Peter Lang Messages: 153 Registered: July 2009 |
Senior Member |
|
|
Hi,
I was about to write a tutorial for you, when I encountered the same
problem that you are facing ;-)
The tutorial is at the end of this post, maybe it will help others.
I do not know exactly why it does not work, but the problem seems to be in
http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.gmf/plu gins/org.eclipse.gmf.codegen/templates/xpt/diagram/editparts /NodeEditPart.xpt?root=Modeling_Project&view=co
where
«IF hasFixedChildren()-»
is false.
My workaround for now is to add a "Feature Label Mapping" to the
parent-node (A). With this, AEditPart is generated correct and you get
addFixedChild as described.
I am just trying without really knowing what happens, but I'm quite sure
that this is a bug.
Let's have some closer look and then file a bugzilla, if there's not
already one.
Regards, Peter
> (How do you know the version og GMF? is it in
> Help > About Eclipse > Installation Details ?)
Yes, the Version of "Graphical Modeling Framework SDK" should be your
version.
--------
So, here's what I do (using xsd-file as definition):
# Create new project (Empty EMF Project)
# Under model:
Create bordernode.xsd:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<xsd:schema
targetNamespace="http://www.example.com/bordernode"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
xmlns:bn="http://www.example.com/bordernode
elementFormDefault="unqualified">
<xsd:complexType name="BorderNode">
<xsd:sequence>
<xsd:element name="a" type="bn:A" maxOccurs="unbounded"
minOccurs="0"></xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="A">
<xsd:sequence>
<xsd:element name="b" type="bn:B" maxOccurs="unbounded"
minOccurs="0">
</xsd:element>
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string"></xsd:attribute>
</xsd:complexType>
<xsd:complexType name="B">
<xsd:attribute name="name" type="xsd:string"></xsd:attribute>
</xsd:complexType>
</xsd:schema>
# Under model:
New "EMF Generator Model"
File name: bordernode.genmodel
Model Importers: XML Schema
Select bordernode.xsd (Browse Workspace..."
Finish
# Open GMF Dashboard (Window -> Show View -> Other... -> General/GMF
Dashboard
In Dashboard:
# Select "Domain Model" -> bordernode.ecore
# Select "Domain Gen Model" -> bordernode.genmodel
# Derive "Graphical Def Model":
File name as suggested
Diagram Element: BorderNode
Leave as selected (A,B as nodes, A.name, B.name as attributes)
# Derive "Tooling Def Model":
File name as suggested
Diagram Element: BorderNode
Leave as selected (A,B as nodes)
# Combine:
File name as suggested
Class: BorderNode
Diagram Palette as suggested
Diagram Canvas as suggested
Remove B from Links
# In bordernode.gmfmap:
As already described
* Under your Node Mapping for "A", add a "Child Reference"
** Set "Children Feature" and "Containment Feature" to your child of type B
* Add a "Node Mapping" under the new "Children Feature"
** Set "Element" to "B"
** Set "Diagram Node" and "Tool" as you would do for a usual node
!!!Workaround!!!
* Add Feature Label Mapping to Node Mapping for "A"
# In bordernode.gmfgraph:
Set "Affixed Parent Side" of Node (B) to anything but NONE.
HINT: Do not open *.gmfgraph directly, always edit through *.gmfmap to
allow synchronization
# Generate bordernode.gmfgen
# Generate all sources
# Run
|
|
| | | | |
Re: Affixed parent side [message #1607872 is a reply to message #1603326] |
Mon, 09 February 2015 05:46 |
Jimmy Lu Messages: 11 Registered: October 2014 |
Junior Member |
|
|
Figured this out by myself. This is due to a bug in template, which I fixed temporarily by patching impl::diagram::update::CanonicalUpdate:
«AROUND executeLayoutCommand(String createdViewsVar) FOR gmfgen::GenContainerBase-»
for (java.util.Iterator<org.eclipse.core.runtime.IAdaptable> iterator = «createdViewsVar».iterator(); iterator.hasNext();) {
org.eclipse.gmf.runtime.notation.View v =
(org.eclipse.gmf.runtime.notation.View)iterator.next().getAdapter(org.eclipse.gmf.runtime.notation.View.class);
if (host().getViewer().getEditPartRegistry().get(v) instanceof org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart)
iterator.remove();
}
«targetDef.proceed()»
«ENDAROUND»
Jimmy Lu wrote on Fri, 06 February 2015 04:53Hi Gary,
I ran into the same problem but my node parent does not have XYLayout. What's your workaround for this problem?
Gary wrote on Fri, 24 July 2009 09:08Hi all,
Thanks for your help/input.
I have spent some time trying to work out why I was getting this error and
have finaly discovered the problem!
The Affixed parent side doesn't work if your parent has XYlayout, I think
this could possibly be a bug, but I haven't added a bug report thing
because I don't know how to do that!
Anyway I can work around this for now but if you know of any solution to
this I may need it at a later stage, plus it may be useful for others!
Thanks again,
Gary
|
|
|
Goto Forum:
Current Time: Fri Sep 20 16:46:45 GMT 2024
Powered by FUDForum. Page generated in 0.05438 seconds
|