Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Parent-child layout problem
Parent-child layout problem [message #149447] Thu, 06 September 2007 22:50 Go to next message
Merlin is currently offline MerlinFriend
Messages: 1
Registered: July 2009
Junior Member
Hi, I am new with GMF and I am trying to get use of the layouts... but
somehow I am not able to do it right. What I want to achieve is the
following - one figure which children (two types of children) are
displayed left and right (according to the type) at the figure rand. I
thought using BorderLayout and two compartments for the childes, but I
can't get it right. The best I got was by using affixed parent side, bit
this solution seems not stable enough - when I resize the figure or add
more childes, it is not clear where the new child will appear - on top,
bottom or even on the opposite side of the figure - when there are more
childes.

This is what I want to achieve:
_____________
| |
|O O|
|O |
| |
|_____________|

Can someone please post an example how a parent can layout it's childes?
Some clues at least?

Thanks a lot, I am really stuck for some time...

Merlin
Re: Parent-child layout problem [message #150931 is a reply to message #149447] Mon, 17 September 2007 07:08 Go to previous messageGo to next message
Krassimir Kondarev is currently offline Krassimir KondarevFriend
Messages: 32
Registered: July 2009
Member
Somebody? Come on... PLEASE?

At least can you tell me what I am doing wrong - here are the model files
for an example library project - library with "left" and "right" books.
The results when I change the Library figure's layout are... well, strange.
With no layout defined in gmfgraph I get two compartments, one below the
other, with books in them - this is OK, I guess. When I add a FlowLayout to
the Library figure, the compartments are next to the Library name label
ordered in one row - exactly what is expected from FlowLayout. But when I
remove the FlowLayout and add BorderLayout and add BorderLayoutData for the
childs, the results are definitely not as expected - but compartments
disappear and I can not see any childes books.

Am I doing something wrong?


"Merlin" <MerlinBG@gbg.bg> wrote in message
news:be9ae1f78bbd43e474eb7c4ea8ebc54a$1@www.eclipse.org...
> Hi, I am new with GMF and I am trying to get use of the layouts... but
> somehow I am not able to do it right. What I want to achieve is the
> following - one figure which children (two types of children) are
> displayed left and right (according to the type) at the figure rand. I
> thought using BorderLayout and two compartments for the childes, but I
> can't get it right. The best I got was by using affixed parent side, bit
> this solution seems not stable enough - when I resize the figure or add
> more childes, it is not clear where the new child will appear - on top,
> bottom or even on the opposite side of the figure - when there are more
> childes.
>
> This is what I want to achieve:
> _____________
> | |
> |O O|
> |O |
> | |
> |_____________|
>
> Can someone please post an example how a parent can layout it's childes?
> Some clues at least?
>
> Thanks a lot, I am really stuck for some time...
>
> Merlin
>





Re: Parent-child layout problem [message #151299 is a reply to message #150931] Mon, 17 September 2007 10:52 Go to previous messageGo to next message
Stefan Kuhn is currently offline Stefan KuhnFriend
Messages: 355
Registered: July 2009
Senior Member
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

try specifing preferred size and/or minimum size for each figure
involved. Draw2D Figures return -1 for getMinimum size when no minSize
or prefSize is defined. Based on the LayoutManager -1 is sometimes
handeled as maximum available size, which might result in overdrawing
other elements. Afaik this happens for the center of BorderLayout.

- -stefan



Krassimir Kondarev schrieb:
> Somebody? Come on... PLEASE?
>
> At least can you tell me what I am doing wrong - here are the model files
> for an example library project - library with "left" and "right" books.
> The results when I change the Library figure's layout are... well, strange.
> With no layout defined in gmfgraph I get two compartments, one below the
> other, with books in them - this is OK, I guess. When I add a FlowLayout to
> the Library figure, the compartments are next to the Library name label
> ordered in one row - exactly what is expected from FlowLayout. But when I
> remove the FlowLayout and add BorderLayout and add BorderLayoutData for the
> childs, the results are definitely not as expected - but compartments
> disappear and I can not see any childes books.
>
> Am I doing something wrong?
>
>
> "Merlin" <MerlinBG@gbg.bg> wrote in message
> news:be9ae1f78bbd43e474eb7c4ea8ebc54a$1@www.eclipse.org...
>> Hi, I am new with GMF and I am trying to get use of the layouts... but
>> somehow I am not able to do it right. What I want to achieve is the
>> following - one figure which children (two types of children) are
>> displayed left and right (according to the type) at the figure rand. I
>> thought using BorderLayout and two compartments for the childes, but I
>> can't get it right. The best I got was by using affixed parent side, bit
>> this solution seems not stable enough - when I resize the figure or add
>> more childes, it is not clear where the new child will appear - on top,
>> bottom or even on the opposite side of the figure - when there are more
>> childes.
>>
>> This is what I want to achieve:
>> _____________
>> | |
>> |O O|
>> |O |
>> | |
>> |_____________|
>>
>> Can someone please post an example how a parent can layout it's childes?
>> Some clues at least?
>>
>> Thanks a lot, I am really stuck for some time...
>>
>> Merlin
>>
>
>

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.7 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFG7lxTIYVWjMSpDwwRAmxwAJwP2sObdYpeKN+emvF16N56/+DG9ACg vB5A
oLHC7ZMXyV0RZOl6rHMx8Kk=
=g48G
-----END PGP SIGNATURE-----
Re: Parent-child layout problem [message #151314 is a reply to message #151299] Mon, 17 September 2007 11:10 Go to previous messageGo to next message
Krassimir Kondarev is currently offline Krassimir KondarevFriend
Messages: 32
Registered: July 2009
Member
Thanks for answering!
Unfortunately this don't change the described behavior... something else is
missing...


"SKuhn" <kuhn@oio.de> wrote in message
news:fclm9c$h1d$1@build.eclipse.org...
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> try specifing preferred size and/or minimum size for each figure
> involved. Draw2D Figures return -1 for getMinimum size when no minSize
> or prefSize is defined. Based on the LayoutManager -1 is sometimes
> handeled as maximum available size, which might result in overdrawing
> other elements. Afaik this happens for the center of BorderLayout.
>
> - -stefan
>
>
>
> Krassimir Kondarev schrieb:
>> Somebody? Come on... PLEASE?
>>
>> At least can you tell me what I am doing wrong - here are the model files
>> for an example library project - library with "left" and "right" books.
>> The results when I change the Library figure's layout are... well,
>> strange.
>> With no layout defined in gmfgraph I get two compartments, one below the
>> other, with books in them - this is OK, I guess. When I add a FlowLayout
>> to
>> the Library figure, the compartments are next to the Library name label
>> ordered in one row - exactly what is expected from FlowLayout. But when I
>> remove the FlowLayout and add BorderLayout and add BorderLayoutData for
>> the
>> childs, the results are definitely not as expected - but compartments
>> disappear and I can not see any childes books.
>>
>> Am I doing something wrong?
>>
>>
>> "Merlin" <MerlinBG@gbg.bg> wrote in message
>> news:be9ae1f78bbd43e474eb7c4ea8ebc54a$1@www.eclipse.org...
>>> Hi, I am new with GMF and I am trying to get use of the layouts... but
>>> somehow I am not able to do it right. What I want to achieve is the
>>> following - one figure which children (two types of children) are
>>> displayed left and right (according to the type) at the figure rand. I
>>> thought using BorderLayout and two compartments for the childes, but I
>>> can't get it right. The best I got was by using affixed parent side, bit
>>> this solution seems not stable enough - when I resize the figure or add
>>> more childes, it is not clear where the new child will appear - on top,
>>> bottom or even on the opposite side of the figure - when there are more
>>> childes.
>>>
>>> This is what I want to achieve:
>>> _____________
>>> | |
>>> |O O|
>>> |O |
>>> | |
>>> |_____________|
>>>
>>> Can someone please post an example how a parent can layout it's childes?
>>> Some clues at least?
>>>
>>> Thanks a lot, I am really stuck for some time...
>>>
>>> Merlin
>>>
>>
>>
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v2.0.7 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFG7lxTIYVWjMSpDwwRAmxwAJwP2sObdYpeKN+emvF16N56/+DG9ACg vB5A
> oLHC7ZMXyV0RZOl6rHMx8Kk=
> =g48G
> -----END PGP SIGNATURE-----
Re: Parent-child layout problem [message #151575 is a reply to message #151314] Wed, 19 September 2007 10:16 Go to previous messageGo to next message
Krassimir Kondarev is currently offline Krassimir KondarevFriend
Messages: 32
Registered: July 2009
Member
Here are the 3 models as text - in the web based interface the attachments
are not exactly readable.
Once again - any help is greatly appreciated!

default.gmfgraph:
<?xml version="1.0" encoding="UTF-8"?>
<gmfgraph:Canvas xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:gmfgraph="http://www.eclipse.org/gmf/2006/GraphicalDefinition"
name="name">
<figures
name="Default">
<descriptors
name="LibraryFigure">
<actualFigure
xsi:type="gmfgraph:Rectangle"
name="LibraryFigure">
<layout
xsi:type="gmfgraph:BorderLayout"/>
<backgroundColor
xsi:type="gmfgraph:ConstantColor"
value="green"/>
<children
xsi:type="gmfgraph:Label"
name="LibraryNameFigure"
text="&lt;...>">
<layoutData
xsi:type="gmfgraph:BorderLayoutData"
vertical="true"/>
</children>
</actualFigure>
<accessors
figure="//@figures.0/@descriptors.0/@actualFigure/@children.0 "/>
</descriptors>
<descriptors
name="LeftBookFigure">
<actualFigure
xsi:type="gmfgraph:Rectangle"
name="LeftBookFigure">
<layoutData
xsi:type="gmfgraph:BorderLayoutData"
alignment="BEGINNING"/>
<backgroundColor
xsi:type="gmfgraph:ConstantColor"
value="red"/>
<children
xsi:type="gmfgraph:Label"
name="LeftBookBookNameFigure"
text="&lt;...>"/>
</actualFigure>
<accessors
figure="//@figures.0/@descriptors.1/@actualFigure/@children.0 "/>
</descriptors>
<descriptors
name="RightBookFigure">
<actualFigure
xsi:type="gmfgraph:Rectangle"
name="RightBookFigure">
<layoutData
xsi:type="gmfgraph:BorderLayoutData"
alignment="END"/>
<backgroundColor
xsi:type="gmfgraph:ConstantColor"
value="blue"/>
<children
xsi:type="gmfgraph:Label"
name="RightBookBookNameFigure"
text="&lt;...>"/>
</actualFigure>
<accessors
figure="//@figures.0/@descriptors.2/@actualFigure/@children.0 "/>
</descriptors>
</figures>
<nodes
name="Library"
figure="LibraryFigure"/>
<nodes
name="LeftBook"
figure="LeftBookFigure"/>
<nodes
name="RightBook"
figure="RightBookFigure"/>
<compartments
name="LeftCompartment"
figure="LeftBookFigure">
<facets
xsi:type="gmfgraph:AlignmentFacet"/>
</compartments>
<compartments
name="RightCompartment"
figure="RightBookFigure">
<facets
xsi:type="gmfgraph:AlignmentFacet"
alignment="END"/>
</compartments>
<labels
name="LibraryName"
figure="LibraryFigure"
accessor="//@figures.0/@descriptors.0/@accessors.0"/>
<labels
name="LeftBookBookName"
figure="LeftBookFigure"
accessor="//@figures.0/@descriptors.1/@accessors.0"/>
<labels
name="RightBookBookName"
figure="RightBookFigure"
accessor="//@figures.0/@descriptors.2/@accessors.0"/>
</gmfgraph:Canvas>

default.gmfmap:
<?xml version="1.0" encoding="UTF-8"?>
<gmfmap:Mapping xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:gmfmap="http://www.eclipse.org/gmf/2006/mappings"
xmlns:gmftool="http://www.eclipse.org/gmf/2005/ToolDefinition">
<nodes>
<containmentFeature
href="default.ecore#//RootObj/library"/>
<ownedChild>
<domainMetaElement
href="default.ecore#//Library"/>
<labelMappings
xsi:type="gmfmap:FeatureLabelMapping">
<diagramLabel
href="default.gmfgraph#LibraryName"/>
<features
href="default.ecore#//Library/name"/>
</labelMappings>
<tool
xsi:type="gmftool:CreationTool"
href="default.gmftool#//@palette/@tools.0/@tools.0"/>
<diagramNode
href="default.gmfgraph#Library"/>
<children
compartment="//@nodes.0/@ownedChild/@compartments.0">
<containmentFeature
href="default.ecore#//Library/leftBooks"/>
<ownedChild>
<domainMetaElement
href="default.ecore#//LeftBook"/>
<labelMappings
xsi:type="gmfmap:FeatureLabelMapping">
<diagramLabel
href="default.gmfgraph#LeftBookBookName"/>
<features
href="default.ecore#//Book/bookName"/>
</labelMappings>
<tool
xsi:type="gmftool:CreationTool"
href="default.gmftool#//@palette/@tools.0/@tools.1"/>
<diagramNode
href="default.gmfgraph#LeftBook"/>
</ownedChild>
</children>
<children
compartment="//@nodes.0/@ownedChild/@compartments.1">
<containmentFeature
href="default.ecore#//Library/rightBooks"/>
<ownedChild>
<domainMetaElement
href="default.ecore#//RightBook"/>
<labelMappings
xsi:type="gmfmap:FeatureLabelMapping">
<diagramLabel
href="default.gmfgraph#RightBookBookName"/>
<features
href="default.ecore#//Book/bookName"/>
</labelMappings>
<tool
xsi:type="gmftool:CreationTool"
href="default.gmftool#//@palette/@tools.0/@tools.2"/>
<diagramNode
href="default.gmfgraph#RightBook"/>
</ownedChild>
</children>
<compartments
children="//@nodes.0/@ownedChild/@children.0">
<compartment
href="default.gmfgraph#LeftCompartment"/>
</compartments>
<compartments
children="//@nodes.0/@ownedChild/@children.1">
<compartment
href="default.gmfgraph#RightCompartment"/>
</compartments>
</ownedChild>
</nodes>
<diagram>
<diagramCanvas
href="default.gmfgraph#name"/>
<domainModel
href="default.ecore#/"/>
<domainMetaElement
href="default.ecore#//RootObj"/>
<palette
href="default.gmftool#//@palette"/>
</diagram>
</gmfmap:Mapping>

default.ecore:
<?xml version="1.0" encoding="UTF-8"?>
<ecore:EPackage xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="name"
nsURI="http://name" nsPrefix="name">
<eClassifiers xsi:type="ecore:EClass" name="RootObj">
<eStructuralFeatures xsi:type="ecore:EReference" name="library"
eType="#//Library"
containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Library">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="leftBooks"
upperBound="-1"
eType="#//LeftBook" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="rightBooks"
upperBound="-1"
eType="#//RightBook" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="LeftBook"
eSuperTypes="#//Book"/>
<eClassifiers xsi:type="ecore:EClass" name="RightBook"
eSuperTypes="#//Book"/>
<eClassifiers xsi:type="ecore:EClass" name="Book">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="bookName"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
</ecore:EPackage>



"Krassimir Kondarev" <krassimir.kondarev@sap.com> wrote in message
news:fclnam$jk4$1@build.eclipse.org...
> Thanks for answering!
> Unfortunately this don't change the described behavior... something else
> is missing...
>
>
> "SKuhn" <kuhn@oio.de> wrote in message
> news:fclm9c$h1d$1@build.eclipse.org...
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> try specifing preferred size and/or minimum size for each figure
>> involved. Draw2D Figures return -1 for getMinimum size when no minSize
>> or prefSize is defined. Based on the LayoutManager -1 is sometimes
>> handeled as maximum available size, which might result in overdrawing
>> other elements. Afaik this happens for the center of BorderLayout.
>>
>> - -stefan
>>
>>
>>
>> Krassimir Kondarev schrieb:
>>> Somebody? Come on... PLEASE?
>>>
>>> At least can you tell me what I am doing wrong - here are the model
>>> files
>>> for an example library project - library with "left" and "right" books.
>>> The results when I change the Library figure's layout are... well,
>>> strange.
>>> With no layout defined in gmfgraph I get two compartments, one below the
>>> other, with books in them - this is OK, I guess. When I add a FlowLayout
>>> to
>>> the Library figure, the compartments are next to the Library name label
>>> ordered in one row - exactly what is expected from FlowLayout. But when
>>> I
>>> remove the FlowLayout and add BorderLayout and add BorderLayoutData for
>>> the
>>> childs, the results are definitely not as expected - but compartments
>>> disappear and I can not see any childes books.
>>>
>>> Am I doing something wrong?
>>>
>>>
>>> "Merlin" <MerlinBG@gbg.bg> wrote in message
>>> news:be9ae1f78bbd43e474eb7c4ea8ebc54a$1@www.eclipse.org...
>>>> Hi, I am new with GMF and I am trying to get use of the layouts... but
>>>> somehow I am not able to do it right. What I want to achieve is the
>>>> following - one figure which children (two types of children) are
>>>> displayed left and right (according to the type) at the figure rand. I
>>>> thought using BorderLayout and two compartments for the childes, but I
>>>> can't get it right. The best I got was by using affixed parent side,
>>>> bit
>>>> this solution seems not stable enough - when I resize the figure or add
>>>> more childes, it is not clear where the new child will appear - on top,
>>>> bottom or even on the opposite side of the figure - when there are more
>>>> childes.
>>>>
>>>> This is what I want to achieve:
>>>> _____________
>>>> | |
>>>> |O O|
>>>> |O |
>>>> | |
>>>> |_____________|
>>>>
>>>> Can someone please post an example how a parent can layout it's
>>>> childes?
>>>> Some clues at least?
>>>>
>>>> Thanks a lot, I am really stuck for some time...
>>>>
>>>> Merlin
>>>>
>>>
>>>
>>
>> -----BEGIN PGP SIGNATURE-----
>> Version: GnuPG v2.0.7 (GNU/Linux)
>> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>>
>> iD8DBQFG7lxTIYVWjMSpDwwRAmxwAJwP2sObdYpeKN+emvF16N56/+DG9ACg vB5A
>> oLHC7ZMXyV0RZOl6rHMx8Kk=
>> =g48G
>> -----END PGP SIGNATURE-----
>
>
Re: Parent-child layout problem [message #151894 is a reply to message #151575] Fri, 21 September 2007 07:02 Go to previous messageGo to next message
Krassimir Kondarev is currently offline Krassimir KondarevFriend
Messages: 32
Registered: July 2009
Member
Nobody knows how to layout the child elements using BorderLayout?
Should I report a bug for this behavior? From my tests it sure looks like a
bug...
Alex?

"Krassimir Kondarev" <krassimir.kondarev@sap.com> wrote in message
news:fcqsuv$6j4$1@build.eclipse.org...
> Here are the 3 models as text - in the web based interface the attachments
> are not exactly readable.
> Once again - any help is greatly appreciated!
>
> default.gmfgraph:
> <?xml version="1.0" encoding="UTF-8"?>
> <gmfgraph:Canvas xmi:version="2.0"
> xmlns:xmi="http://www.omg.org/XMI"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:gmfgraph="http://www.eclipse.org/gmf/2006/GraphicalDefinition"
> name="name">
> <figures
> name="Default">
> <descriptors
> name="LibraryFigure">
> <actualFigure
> xsi:type="gmfgraph:Rectangle"
> name="LibraryFigure">
> <layout
> xsi:type="gmfgraph:BorderLayout"/>
> <backgroundColor
> xsi:type="gmfgraph:ConstantColor"
> value="green"/>
> <children
> xsi:type="gmfgraph:Label"
> name="LibraryNameFigure"
> text="&lt;...>">
> <layoutData
> xsi:type="gmfgraph:BorderLayoutData"
> vertical="true"/>
> </children>
> </actualFigure>
> <accessors
> figure="//@figures.0/@descriptors.0/@actualFigure/@children.0 "/>
> </descriptors>
> <descriptors
> name="LeftBookFigure">
> <actualFigure
> xsi:type="gmfgraph:Rectangle"
> name="LeftBookFigure">
> <layoutData
> xsi:type="gmfgraph:BorderLayoutData"
> alignment="BEGINNING"/>
> <backgroundColor
> xsi:type="gmfgraph:ConstantColor"
> value="red"/>
> <children
> xsi:type="gmfgraph:Label"
> name="LeftBookBookNameFigure"
> text="&lt;...>"/>
> </actualFigure>
> <accessors
> figure="//@figures.0/@descriptors.1/@actualFigure/@children.0 "/>
> </descriptors>
> <descriptors
> name="RightBookFigure">
> <actualFigure
> xsi:type="gmfgraph:Rectangle"
> name="RightBookFigure">
> <layoutData
> xsi:type="gmfgraph:BorderLayoutData"
> alignment="END"/>
> <backgroundColor
> xsi:type="gmfgraph:ConstantColor"
> value="blue"/>
> <children
> xsi:type="gmfgraph:Label"
> name="RightBookBookNameFigure"
> text="&lt;...>"/>
> </actualFigure>
> <accessors
> figure="//@figures.0/@descriptors.2/@actualFigure/@children.0 "/>
> </descriptors>
> </figures>
> <nodes
> name="Library"
> figure="LibraryFigure"/>
> <nodes
> name="LeftBook"
> figure="LeftBookFigure"/>
> <nodes
> name="RightBook"
> figure="RightBookFigure"/>
> <compartments
> name="LeftCompartment"
> figure="LeftBookFigure">
> <facets
> xsi:type="gmfgraph:AlignmentFacet"/>
> </compartments>
> <compartments
> name="RightCompartment"
> figure="RightBookFigure">
> <facets
> xsi:type="gmfgraph:AlignmentFacet"
> alignment="END"/>
> </compartments>
> <labels
> name="LibraryName"
> figure="LibraryFigure"
> accessor="//@figures.0/@descriptors.0/@accessors.0"/>
> <labels
> name="LeftBookBookName"
> figure="LeftBookFigure"
> accessor="//@figures.0/@descriptors.1/@accessors.0"/>
> <labels
> name="RightBookBookName"
> figure="RightBookFigure"
> accessor="//@figures.0/@descriptors.2/@accessors.0"/>
> </gmfgraph:Canvas>
>
> default.gmfmap:
> <?xml version="1.0" encoding="UTF-8"?>
> <gmfmap:Mapping xmi:version="2.0"
> xmlns:xmi="http://www.omg.org/XMI"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:gmfmap="http://www.eclipse.org/gmf/2006/mappings"
> xmlns:gmftool="http://www.eclipse.org/gmf/2005/ToolDefinition">
> <nodes>
> <containmentFeature
> href="default.ecore#//RootObj/library"/>
> <ownedChild>
> <domainMetaElement
> href="default.ecore#//Library"/>
> <labelMappings
> xsi:type="gmfmap:FeatureLabelMapping">
> <diagramLabel
> href="default.gmfgraph#LibraryName"/>
> <features
> href="default.ecore#//Library/name"/>
> </labelMappings>
> <tool
> xsi:type="gmftool:CreationTool"
> href="default.gmftool#//@palette/@tools.0/@tools.0"/>
> <diagramNode
> href="default.gmfgraph#Library"/>
> <children
> compartment="//@nodes.0/@ownedChild/@compartments.0">
> <containmentFeature
> href="default.ecore#//Library/leftBooks"/>
> <ownedChild>
> <domainMetaElement
> href="default.ecore#//LeftBook"/>
> <labelMappings
> xsi:type="gmfmap:FeatureLabelMapping">
> <diagramLabel
> href="default.gmfgraph#LeftBookBookName"/>
> <features
> href="default.ecore#//Book/bookName"/>
> </labelMappings>
> <tool
> xsi:type="gmftool:CreationTool"
> href="default.gmftool#//@palette/@tools.0/@tools.1"/>
> <diagramNode
> href="default.gmfgraph#LeftBook"/>
> </ownedChild>
> </children>
> <children
> compartment="//@nodes.0/@ownedChild/@compartments.1">
> <containmentFeature
> href="default.ecore#//Library/rightBooks"/>
> <ownedChild>
> <domainMetaElement
> href="default.ecore#//RightBook"/>
> <labelMappings
> xsi:type="gmfmap:FeatureLabelMapping">
> <diagramLabel
> href="default.gmfgraph#RightBookBookName"/>
> <features
> href="default.ecore#//Book/bookName"/>
> </labelMappings>
> <tool
> xsi:type="gmftool:CreationTool"
> href="default.gmftool#//@palette/@tools.0/@tools.2"/>
> <diagramNode
> href="default.gmfgraph#RightBook"/>
> </ownedChild>
> </children>
> <compartments
> children="//@nodes.0/@ownedChild/@children.0">
> <compartment
> href="default.gmfgraph#LeftCompartment"/>
> </compartments>
> <compartments
> children="//@nodes.0/@ownedChild/@children.1">
> <compartment
> href="default.gmfgraph#RightCompartment"/>
> </compartments>
> </ownedChild>
> </nodes>
> <diagram>
> <diagramCanvas
> href="default.gmfgraph#name"/>
> <domainModel
> href="default.ecore#/"/>
> <domainMetaElement
> href="default.ecore#//RootObj"/>
> <palette
> href="default.gmftool#//@palette"/>
> </diagram>
> </gmfmap:Mapping>
>
> default.ecore:
> <?xml version="1.0" encoding="UTF-8"?>
> <ecore:EPackage xmi:version="2.0"
> xmlns:xmi="http://www.omg.org/XMI"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="name"
> nsURI="http://name" nsPrefix="name">
> <eClassifiers xsi:type="ecore:EClass" name="RootObj">
> <eStructuralFeatures xsi:type="ecore:EReference" name="library"
> eType="#//Library"
> containment="true"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="Library">
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="name"
> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
> <eStructuralFeatures xsi:type="ecore:EReference" name="leftBooks"
> upperBound="-1"
> eType="#//LeftBook" containment="true"/>
> <eStructuralFeatures xsi:type="ecore:EReference" name="rightBooks"
> upperBound="-1"
> eType="#//RightBook" containment="true"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="LeftBook"
> eSuperTypes="#//Book"/>
> <eClassifiers xsi:type="ecore:EClass" name="RightBook"
> eSuperTypes="#//Book"/>
> <eClassifiers xsi:type="ecore:EClass" name="Book">
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="bookName"
> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
> </eClassifiers>
> </ecore:EPackage>
>
>
>
> "Krassimir Kondarev" <krassimir.kondarev@sap.com> wrote in message
> news:fclnam$jk4$1@build.eclipse.org...
>> Thanks for answering!
>> Unfortunately this don't change the described behavior... something else
>> is missing...
>>
>>
>> "SKuhn" <kuhn@oio.de> wrote in message
>> news:fclm9c$h1d$1@build.eclipse.org...
>>> -----BEGIN PGP SIGNED MESSAGE-----
>>> Hash: SHA1
>>>
>>> try specifing preferred size and/or minimum size for each figure
>>> involved. Draw2D Figures return -1 for getMinimum size when no minSize
>>> or prefSize is defined. Based on the LayoutManager -1 is sometimes
>>> handeled as maximum available size, which might result in overdrawing
>>> other elements. Afaik this happens for the center of BorderLayout.
>>>
>>> - -stefan
>>>
>>>
>>>
>>> Krassimir Kondarev schrieb:
>>>> Somebody? Come on... PLEASE?
>>>>
>>>> At least can you tell me what I am doing wrong - here are the model
>>>> files
>>>> for an example library project - library with "left" and "right" books.
>>>> The results when I change the Library figure's layout are... well,
>>>> strange.
>>>> With no layout defined in gmfgraph I get two compartments, one below
>>>> the
>>>> other, with books in them - this is OK, I guess. When I add a
>>>> FlowLayout to
>>>> the Library figure, the compartments are next to the Library name label
>>>> ordered in one row - exactly what is expected from FlowLayout. But when
>>>> I
>>>> remove the FlowLayout and add BorderLayout and add BorderLayoutData for
>>>> the
>>>> childs, the results are definitely not as expected - but compartments
>>>> disappear and I can not see any childes books.
>>>>
>>>> Am I doing something wrong?
>>>>
>>>>
>>>> "Merlin" <MerlinBG@gbg.bg> wrote in message
>>>> news:be9ae1f78bbd43e474eb7c4ea8ebc54a$1@www.eclipse.org...
>>>>> Hi, I am new with GMF and I am trying to get use of the layouts... but
>>>>> somehow I am not able to do it right. What I want to achieve is the
>>>>> following - one figure which children (two types of children) are
>>>>> displayed left and right (according to the type) at the figure rand. I
>>>>> thought using BorderLayout and two compartments for the childes, but I
>>>>> can't get it right. The best I got was by using affixed parent side,
>>>>> bit
>>>>> this solution seems not stable enough - when I resize the figure or
>>>>> add
>>>>> more childes, it is not clear where the new child will appear - on
>>>>> top,
>>>>> bottom or even on the opposite side of the figure - when there are
>>>>> more
>>>>> childes.
>>>>>
>>>>> This is what I want to achieve:
>>>>> _____________
>>>>> | |
>>>>> |O O|
>>>>> |O |
>>>>> | |
>>>>> |_____________|
>>>>>
>>>>> Can someone please post an example how a parent can layout it's
>>>>> childes?
>>>>> Some clues at least?
>>>>>
>>>>> Thanks a lot, I am really stuck for some time...
>>>>>
>>>>> Merlin
>>>>>
>>>>
>>>>
>>>
>>> -----BEGIN PGP SIGNATURE-----
>>> Version: GnuPG v2.0.7 (GNU/Linux)
>>> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>>>
>>> iD8DBQFG7lxTIYVWjMSpDwwRAmxwAJwP2sObdYpeKN+emvF16N56/+DG9ACg vB5A
>>> oLHC7ZMXyV0RZOl6rHMx8Kk=
>>> =g48G
>>> -----END PGP SIGNATURE-----
>>
>>
>
>
Re: Parent-child layout problem [message #151977 is a reply to message #149447] Fri, 21 September 2007 19:27 Go to previous messageGo to next message
Cherie Revells is currently offline Cherie RevellsFriend
Messages: 299
Registered: July 2009
Senior Member
Merlin,

The behavior you are seeing use the affixed parent side is expected.
There is a locator used to determine where these border item figures
should be placed. You can customize the locator used to place the
figures where you want.

Regards,
Cherie


Merlin wrote:
> Hi, I am new with GMF and I am trying to get use of the layouts... but
> somehow I am not able to do it right. What I want to achieve is the
> following - one figure which children (two types of children) are
> displayed left and right (according to the type) at the figure rand. I
> thought using BorderLayout and two compartments for the childes, but I
> can't get it right. The best I got was by using affixed parent side, bit
> this solution seems not stable enough - when I resize the figure or add
> more childes, it is not clear where the new child will appear - on top,
> bottom or even on the opposite side of the figure - when there are more
> childes.
>
> This is what I want to achieve:
> _____________
> | |
> |O O|
> |O |
> | |
> |_____________|
>
> Can someone please post an example how a parent can layout it's childes?
> Some clues at least?
>
> Thanks a lot, I am really stuck for some time...
>
> Merlin
>
Re: Parent-child layout problem [message #152028 is a reply to message #151977] Mon, 24 September 2007 09:09 Go to previous messageGo to next message
Krassimir Kondarev is currently offline Krassimir KondarevFriend
Messages: 32
Registered: July 2009
Member
Hi Cherie,

thanks for answering, I use currently exactly affixed parent side in my
prototype - this is working more or less as expected.

My question is about the layout usage in GMF - the example is with
BorderLayout, but the same issue is noticed with other layouts as well -
GrigLayout as example. Somehow I am not able to use other layout than Flow
and XY.

I posted the model files - probably I do something wrong? But what? Same
models work fline with only changing the layout to Flow.

Any further help is greatly appreciated...


"Cherie Revells" <crevells@ca.ibm.com> wrote in message
news:fd163r$mf0$1@build.eclipse.org...
> Merlin,
>
> The behavior you are seeing use the affixed parent side is expected. There
> is a locator used to determine where these border item figures should be
> placed. You can customize the locator used to place the figures where you
> want.
>
> Regards,
> Cherie
>
>
> Merlin wrote:
>> Hi, I am new with GMF and I am trying to get use of the layouts... but
>> somehow I am not able to do it right. What I want to achieve is the
>> following - one figure which children (two types of children) are
>> displayed left and right (according to the type) at the figure rand. I
>> thought using BorderLayout and two compartments for the childes, but I
>> can't get it right. The best I got was by using affixed parent side, bit
>> this solution seems not stable enough - when I resize the figure or add
>> more childes, it is not clear where the new child will appear - on top,
>> bottom or even on the opposite side of the figure - when there are more
>> childes.
>>
>> This is what I want to achieve:
>> _____________
>> | |
>> |O O|
>> |O |
>> | |
>> |_____________|
>>
>> Can someone please post an example how a parent can layout it's childes?
>> Some clues at least?
>>
>> Thanks a lot, I am really stuck for some time...
>>
>> Merlin
>>
Re: Parent-child layout problem [message #152036 is a reply to message #152028] Mon, 24 September 2007 13:07 Go to previous messageGo to next message
Cherie Revells is currently offline Cherie RevellsFriend
Messages: 299
Registered: July 2009
Senior Member
Krassimir,

The last time I checked, the affixed parent side figures have their
locations determined by a locator. The layouts you mentioned should not
be affecting the affixed parent side figures. Put a breakpoint in the
setBounds() of the affixed parent side figure to see how it's location
is being set.

Regards,
Cherie

Krassimir Kondarev wrote:
> Hi Cherie,
>
> thanks for answering, I use currently exactly affixed parent side in my
> prototype - this is working more or less as expected.
>
> My question is about the layout usage in GMF - the example is with
> BorderLayout, but the same issue is noticed with other layouts as well -
> GrigLayout as example. Somehow I am not able to use other layout than Flow
> and XY.
>
> I posted the model files - probably I do something wrong? But what? Same
> models work fline with only changing the layout to Flow.
>
> Any further help is greatly appreciated...
>
>
> "Cherie Revells" <crevells@ca.ibm.com> wrote in message
> news:fd163r$mf0$1@build.eclipse.org...
>> Merlin,
>>
>> The behavior you are seeing use the affixed parent side is expected. There
>> is a locator used to determine where these border item figures should be
>> placed. You can customize the locator used to place the figures where you
>> want.
>>
>> Regards,
>> Cherie
>>
>>
>> Merlin wrote:
>>> Hi, I am new with GMF and I am trying to get use of the layouts... but
>>> somehow I am not able to do it right. What I want to achieve is the
>>> following - one figure which children (two types of children) are
>>> displayed left and right (according to the type) at the figure rand. I
>>> thought using BorderLayout and two compartments for the childes, but I
>>> can't get it right. The best I got was by using affixed parent side, bit
>>> this solution seems not stable enough - when I resize the figure or add
>>> more childes, it is not clear where the new child will appear - on top,
>>> bottom or even on the opposite side of the figure - when there are more
>>> childes.
>>>
>>> This is what I want to achieve:
>>> _____________
>>> | |
>>> |O O|
>>> |O |
>>> | |
>>> |_____________|
>>>
>>> Can someone please post an example how a parent can layout it's childes?
>>> Some clues at least?
>>>
>>> Thanks a lot, I am really stuck for some time...
>>>
>>> Merlin
>>>
>
>
Re: Parent-child layout problem [message #152061 is a reply to message #152036] Mon, 24 September 2007 14:56 Go to previous messageGo to next message
Krassimir Kondarev is currently offline Krassimir KondarevFriend
Messages: 32
Registered: July 2009
Member
Perhaps I am not asking my question very clear...
In the example application I posted there are no elements with affixed
parent side set. This is also not my intention. I "simply" try to use the
provided layouts. When I do this with "static" elements, the layouts seem to
function OK - I can easy display 20 boxes with different colors in 5 rows, 4
columns per row. But when I try to use childs, instead of static elements,
the childs are not ordered in 5 rows, 4 columns per row - they are not
displayed at all.
I don't think the question is concerning the affixed parent side feature,
please correct me if I am wrong?

Can anyone please post a simple example using BorderLayout or GridLayout?
Any ideas/suggestions/explanations are more than welcome...

Regards,
Krasi


"Cherie Revells" <crevells@ca.ibm.com> wrote in message
news:46F7B689.1000309@ca.ibm.com...
> Krassimir,
>
> The last time I checked, the affixed parent side figures have their
> locations determined by a locator. The layouts you mentioned should not
> be affecting the affixed parent side figures. Put a breakpoint in the
> setBounds() of the affixed parent side figure to see how it's location is
> being set.
>
> Regards,
> Cherie
>
> Krassimir Kondarev wrote:
>> Hi Cherie,
>>
>> thanks for answering, I use currently exactly affixed parent side in my
>> prototype - this is working more or less as expected.
>>
>> My question is about the layout usage in GMF - the example is with
>> BorderLayout, but the same issue is noticed with other layouts as well -
>> GrigLayout as example. Somehow I am not able to use other layout than
>> Flow and XY.
>>
>> I posted the model files - probably I do something wrong? But what? Same
>> models work fline with only changing the layout to Flow.
>>
>> Any further help is greatly appreciated...
>>
>>
>> "Cherie Revells" <crevells@ca.ibm.com> wrote in message
>> news:fd163r$mf0$1@build.eclipse.org...
>>> Merlin,
>>>
>>> The behavior you are seeing use the affixed parent side is expected.
>>> There is a locator used to determine where these border item figures
>>> should be placed. You can customize the locator used to place the
>>> figures where you want.
>>>
>>> Regards,
>>> Cherie
>>>
>>>
>>> Merlin wrote:
>>>> Hi, I am new with GMF and I am trying to get use of the layouts... but
>>>> somehow I am not able to do it right. What I want to achieve is the
>>>> following - one figure which children (two types of children) are
>>>> displayed left and right (according to the type) at the figure rand. I
>>>> thought using BorderLayout and two compartments for the childes, but I
>>>> can't get it right. The best I got was by using affixed parent side,
>>>> bit this solution seems not stable enough - when I resize the figure or
>>>> add more childes, it is not clear where the new child will appear - on
>>>> top, bottom or even on the opposite side of the figure - when there are
>>>> more childes.
>>>>
>>>> This is what I want to achieve:
>>>> _____________
>>>> | |
>>>> |O O|
>>>> |O |
>>>> | |
>>>> |_____________|
>>>>
>>>> Can someone please post an example how a parent can layout it's
>>>> childes?
>>>> Some clues at least?
>>>>
>>>> Thanks a lot, I am really stuck for some time...
>>>>
>>>> Merlin
>>>>
>>
Re: Parent-child layout problem [message #1859294 is a reply to message #149447] Sat, 27 May 2023 23:30 Go to previous message
Eclipse UserFriend
Merlin wrote on Thu, 06 September 2007 22:50
Hi, I am new with GMF and I am trying to get use of the layouts... but
somehow I am not able to do it right. What I want to achieve is the
following - one figure which children (two types of children) are
displayed left and right (according to the type) at the figure rand. I
thought using BorderLayout and two compartments for the childes, but I
can't get it right. The best I got was by using affixed parent side, bit
this solution seems not stable enough Child arrangement orders- when I resize the figure or add
more childes, it is not clear where the new child will appear - on top,
bottom or even on the opposite side of the figure - when there are more
childes.

This is what I want to achieve:
_____________
| |
|O O|
|O |
| |
|_____________|

Can someone please post an example how a parent can layout it's childes?
Some clues at least?

Thanks a lot, I am really stuck for some time...

Merlin

To achieve the desired layout with children displayed on the left and right sides of a figure, you can use a combination of layout managers. Here's an example using Java Swing's BorderLayout:

java
Copy code
import java.awt.BorderLayout;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

public class ParentLayoutExample {
public static void main(String[] args) {
JFrame frame = new JFrame("Parent Layout Example");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

JPanel parentPanel = new JPanel(new BorderLayout());

// Create child panels
JPanel leftChild = new JPanel();
JPanel rightChild = new JPanel();

// Set background color for clarity
leftChild.setBackground(java.awt.Color.GREEN);
rightChild.setBackground(java.awt.Color.YELLOW);

// Add child panels to parent panel
parentPanel.add(leftChild, BorderLayout.WEST);
parentPanel.add(rightChild, BorderLayout.EAST);

// Create the figure as a label
JLabel figureLabel = new JLabel("O");
figureLabel.setHorizontalAlignment(JLabel.CENTER);

// Add the figure label to the parent panel's center
parentPanel.add(figureLabel, BorderLayout.CENTER);

// Add the parent panel to the frame's content pane
frame.getContentPane().add(parentPanel);

frame.pack();
frame.setVisible(true);
}
}
In this example, we create a JPanel called parentPanel as the main container. Then, we create two child panels, leftChild and rightChild, and set their background colors for visual distinction. We add the child panels to the parent panel using BorderLayout.WEST and BorderLayout.EAST positions.

Next, we create a JLabel called figureLabel to represent the figure (in this case, the letter "O"). We set its horizontal alignment to CENTER and add it to the parent panel's center using BorderLayout.CENTER.

Finally, we add the parent panel to the frame's content pane, pack the frame to adjust its size, and make it visible.

This layout ensures that the children are displayed on the left and right sides of the figure, regardless of window resizing or the number of children added.

[Updated on: Sat, 27 May 2023 23:32] by Moderator

Report message to a moderator

Previous Topic:bad certificate on eclipse repro server
Next Topic:Unresolved Requirements
Goto Forum:
  


Current Time: Wed Apr 24 17:35:20 GMT 2024

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

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

Back to the top