Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Two layout realted questions
Two layout realted questions [message #148958] Mon, 30 August 2004 14:44 Go to next message
Simon Moser is currently offline Simon MoserFriend
Messages: 21
Registered: July 2009
Junior Member
This is a multipart message in MIME format.
--=_alternative 00515CC2C1256F00_=
Content-Type: text/plain; charset="US-ASCII"

Hi

I have two layout related questions:

First, When I have an GEF Editor, and I have a CanvasEditPart as
"contents", and in create Figure() I do the following:

public class CanvasEditPart extends CommonEditPart
{
protected IFigure createFigure()
{
FreeformLayer layer = new FreeformLayer();

//define flow layout
FlowLayout layout = new FlowLayout(false);

layout.setMinorAlignment(FlowLayout.ALIGN_CENTER);
layout.setMajorAlignment(FlowLayout.ALIGN_CENTER);

layer.setLayoutManager(layout);

return layer;
}


I would expect that the figure gets placed in the middle of the Canvas,
both in X and Y direction. However, it only gets centered in Y direction.
Any ideas, anyone ?


Second: When I use an layout Manager, like i.e. FlowLayout or
ToolbarLayout, is there a way to tell the layout that it should keep a
margin at the top
WITHOUT inserting a dummy figure ? I Know that I can set up spacing, but
this doesnt work for the top and bottom margins ?



--=_alternative 00515CC2C1256F00_=
Content-Type: text/html; charset="US-ASCII"


<br><font size=1 face="sans-serif">Hi </font>
<br>
<br><font size=1 face="sans-serif">I have two layout related questions:
</font>
<br>
<br><font size=1 face="sans-serif">First, When I have an GEF Editor, and
I have a CanvasEditPart as &quot;contents&quot;, and in create Figure()
I do the following: </font>
<br>
<br><font size=1 face="sans-serif">public class CanvasEditPart extends
CommonEditPart </font>
<br><font size=1 face="sans-serif">{</font>
<br><font size=1 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; protected
IFigure createFigure() </font>
<br><font size=1 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; {</font>
<br><font size=1 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; FreeformLayer layer = new FreeformLayer();</font>
<br><font size=1 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; </font>
<br><font size=1 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; //define flow layout</font>
<br><font size=1 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; FlowLayout layout = new FlowLayout(false);</font>
<br><font size=1 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; </font>
<br><font size=1 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; layout.setMinorAlignment(FlowLayout.ALIGN_CENTER);</font>
<br><font size=1 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; layout.setMajorAlignment(FlowLayout.ALIGN_CENTER);</font>
<br><font size=1 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; </font>
<br><font size=1 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; layer.setLayoutManager(layout);</font>
<br><font size=1 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; </font>
<br><font size=1 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; return layer;</font>
<br><font size=1 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; }</font>
<br>
<br>
<br><font size=1 face="sans-serif">I would expect that the figure gets
placed in the middle of the Canvas, both in X and Y direction. However,
it only gets centered in Y direction. Any ideas, anyone ?</font>
<br>
<br>
<br><font size=1 face="sans-serif">Second: When I use an layout Manager,
like i.e. FlowLayout or ToolbarLayout, is there a way to tell the layout
that it should keep a margin at the top </font>
<br><font size=1 face="sans-serif">WITHOUT inserting a dummy figure ? I
Know that I can set up spacing, but this doesnt work for the top and bottom
margins ?</font>
<br>
<br>
<br>
--=_alternative 00515CC2C1256F00_=--
Re: Two layout realted questions [message #149012 is a reply to message #148958] Mon, 30 August 2004 16:31 Go to previous messageGo to next message
Pratik Shah is currently offline Pratik ShahFriend
Messages: 1077
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.

------=_NextPart_000_0116_01C48E8D.4DEAC160
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

First: Let's say you have two figures in a column (vertical flowlayout), =
one twice the width of the other. If you set minorAlignment to center, =
the two figures will be aligned such that their centers lie on the same =
y coordinate. If you set the majorAlignment to center, the column =
containing those two figures will be placed in such a way that any empty =
space in that column will be distributed evenly at the top and bottom. =
FlowLayout does not reposition columns along the x axis or rows along =
the y axis.

Second: You can set a MarginBorder on the figure to do that.
<smoser@de.ibm.com> wrote in message news:cgvefg$a51$1@eclipse.org...

Hi=20

I have two layout related questions:=20

First, When I have an GEF Editor, and I have a CanvasEditPart as =
"contents", and in create Figure() I do the following:=20

public class CanvasEditPart extends CommonEditPart=20
{=20
protected IFigure createFigure()=20
{=20
FreeformLayer layer =3D new FreeformLayer();=20
=20
//define flow layout=20
FlowLayout layout =3D new FlowLayout(false);=20
=20
layout.setMinorAlignment(FlowLayout.ALIGN_CENTER);=20
layout.setMajorAlignment(FlowLayout.ALIGN_CENTER);=20
=20
layer.setLayoutManager(layout);=20
=20
return layer;=20
}=20


I would expect that the figure gets placed in the middle of the =
Canvas, both in X and Y direction. However, it only gets centered in Y =
direction. Any ideas, anyone ?=20


Second: When I use an layout Manager, like i.e. FlowLayout or =
ToolbarLayout, is there a way to tell the layout that it should keep a =
margin at the top=20
WITHOUT inserting a dummy figure ? I Know that I can set up spacing, =
but this doesnt work for the top and bottom margins ?=20



------=_NextPart_000_0116_01C48E8D.4DEAC160
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1458" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>First: Let's say you have two figures =
in a column=20
(vertical flowlayout), one twice the width of the other.&nbsp; If you =
set=20
minorAlignment to center, the two figures will be aligned such that =
their=20
centers lie on the same y coordinate.&nbsp; If you set the =
majorAlignment to=20
center, the column containing those two figures will be placed in such a =
way=20
that any empty space in that column will be distributed evenly at the =
top and=20
bottom.&nbsp; FlowLayout does not reposition columns along the x axis or =
rows=20
along the y axis.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Second: You can set a MarginBorder on =
the figure to=20
do that.</FONT></DIV>
<BLOCKQUOTE=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>&lt;<A =
href=3D"mailto:smoser@de.ibm.com">smoser@de.ibm.com</A>&gt; wrote in=20
message <A=20
=
href=3D"news:cgvefg$a51$1@eclipse.org">news:cgvefg$a51$1@eclipse.org</A>.=
...</DIV>
<DIV><BR><FONT face=3Dsans-serif size=3D1>Hi </FONT><BR><BR><FONT =
face=3Dsans-serif=20
size=3D1>I have two layout related questions: </FONT><BR><BR><FONT=20
face=3Dsans-serif size=3D1>First, When I have an GEF Editor, and I =
have a=20
CanvasEditPart as "contents", and in create Figure() I do the =
following:=20
</FONT><BR><BR><FONT face=3Dsans-serif size=3D1>public class =
CanvasEditPart=20
extends CommonEditPart </FONT><BR><FONT face=3Dsans-serif =
size=3D1>{</FONT>=20
<BR><FONT face=3Dsans-serif size=3D1>&nbsp; &nbsp; &nbsp; &nbsp; =
protected IFigure=20
createFigure()&nbsp;</FONT><BR><FONT face=3Dsans-serif=20
size=3D1> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; {</FONT> <BR><FONT =

face=3Dsans-serif size=3D1>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp;=20
FreeformLayer layer =3D new FreeformLayer();</FONT> <BR><FONT =
face=3Dsans-serif=20
size=3D1>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;=20
</FONT><BR><FONT face=3Dsans-serif size=3D1>&nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp;=20
&nbsp; &nbsp; &nbsp; //define flow layout</FONT> <BR><FONT =
face=3Dsans-serif=20
size=3D1>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
FlowLayout=20
layout =3D new FlowLayout(false);</FONT> <BR><FONT face=3Dsans-serif =
size=3D1>&nbsp;=20
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </FONT><BR><FONT=20
face=3Dsans-serif size=3D1>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp;=20
layout.setMinorAlignment(FlowLayout.ALIGN_CENTER);</FONT> <BR><FONT=20
face=3Dsans-serif size=3D1>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp;=20
layout.setMajorAlignment(FlowLayout.ALIGN_CENTER);</FONT> <BR><FONT=20
face=3Dsans-serif size=3D1>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp;=20
</FONT><BR><FONT face=3Dsans-serif size=3D1>&nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp;=20
&nbsp; &nbsp; &nbsp; layer.setLayoutManager(layout);</FONT> <BR><FONT=20
face=3Dsans-serif size=3D1>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp;=20
</FONT><BR><FONT face=3Dsans-serif size=3D1>&nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp;=20
&nbsp; &nbsp; &nbsp; return layer;</FONT> <BR><FONT face=3Dsans-serif=20
size=3D1>&nbsp; &nbsp; &nbsp; &nbsp; }</FONT> <BR><BR><BR><FONT =
face=3Dsans-serif=20
size=3D1>I would expect that the figure gets placed in the middle of =
the Canvas,=20
both in X and Y direction. However, it only gets centered in Y =
direction. Any=20
ideas, anyone ?</FONT> <BR><BR><BR><FONT face=3Dsans-serif =
size=3D1>Second: When I=20
use an layout Manager, like i.e. FlowLayout or ToolbarLayout, is there =
a way=20
to tell the layout that it should keep a margin at the top =
</FONT><BR><FONT=20
face=3Dsans-serif size=3D1>WITHOUT inserting a dummy figure ? I Know =
that I can=20
set up spacing, but this doesnt work for the top and bottom margins =
?</FONT>=20
<BR><BR><BR></DIV></BLOCKQUOTE></BODY></HTML>

------=_NextPart_000_0116_01C48E8D.4DEAC160--
Re: Two layout realted questions [message #149189 is a reply to message #149012] Tue, 31 August 2004 13:33 Go to previous messageGo to next message
Simon Moser is currently offline Simon MoserFriend
Messages: 21
Registered: July 2009
Junior Member
This is a multipart message in MIME format.
--=_alternative 004AEE4DC1256F01_=
Content-Type: text/plain; charset="US-ASCII"

Hi Pratik,

I see. Thanks for pointing this out. Continuing your example, given that I
have two figures in a column, (the lower one much wider and higher that
the first), what would be the best solution then to Center them in X AND
in Y Direction ? So I like to center it in the middle of the canvas, the
upper one (small) centered on top of the lower one ? How do I archive this
the easiest way ?
Simon


First: Let's say you have two figures in a column (vertical flowlayout),
one twice the width of the other. If you set minorAlignment to center,
the two figures will be aligned such that their centers lie on the same y
coordinate. If you set the majorAlignment to center, the column
containing those two figures will be placed in such a way that any empty
space in that column will be distributed evenly at the top and bottom.
FlowLayout does not reposition columns along the x axis or rows along the
y axis.

Second: You can set a MarginBorder on the figure to do that.
<smoser@de.ibm.com> wrote in message news:cgvefg$a51$1@eclipse.org....

Hi

I have two layout related questions:

First, When I have an GEF Editor, and I have a CanvasEditPart as
"contents", and in create Figure() I do the following:

public class CanvasEditPart extends CommonEditPart
{
protected IFigure createFigure()
{
FreeformLayer layer = new FreeformLayer();

//define flow layout
FlowLayout layout = new FlowLayout(false);

layout.setMinorAlignment(FlowLayout.ALIGN_CENTER);
layout.setMajorAlignment(FlowLayout.ALIGN_CENTER);

layer.setLayoutManager(layout);

return layer;
}


I would expect that the figure gets placed in the middle of the Canvas,
both in X and Y direction. However, it only gets centered in Y direction.
Any ideas, anyone ?


Second: When I use an layout Manager, like i.e. FlowLayout or
ToolbarLayout, is there a way to tell the layout that it should keep a
margin at the top
WITHOUT inserting a dummy figure ? I Know that I can set up spacing, but
this doesnt work for the top and bottom margins ?
--=_alternative 004AEE4DC1256F01_=
Content-Type: text/html; charset="US-ASCII"


<br><font size=1 face="sans-serif">Hi Pratik, </font>
<br>
<br><font size=1 face="sans-serif">I see. Thanks for pointing this out.
Continuing your example, given that I have two figures in a column, (the
lower one much wider and higher that the first), what would be the best
solution then to Center them in X AND in Y Direction ? So I like to center
it in the middle of the canvas, the upper one (small) centered on top of
the lower one ? How do I archive this the easiest way ? </font>
<br><font size=1 face="sans-serif">Simon </font>
<br>
<div>
<br>
<br><font size=2 face="Arial">First: Let's say you have two figures in
a column (vertical flowlayout), one twice the width of the other. &nbsp;If
you set minorAlignment to center, the two figures will be aligned such
that their centers lie on the same y coordinate. &nbsp;If you set the majorAlignment
to center, the column containing those two figures will be placed in such
a way that any empty space in that column will be distributed evenly at
the top and bottom. &nbsp;FlowLayout does not reposition columns along
the x axis or rows along the y axis.</font>
<br><font size=3>&nbsp;</font>
<br><font size=2 face="Arial">Second: You can set a MarginBorder on the
figure to do that.</font>
<br><font size=3>&lt;</font><a href=mailto:smoser@de.ibm.com><font size=3 color=blue><u>smoser@de.ibm.com</u></font></a><font size=3>&gt;
wrote in message </font><a href=news:cgvefg$a51$1@eclipse.org><font size=3 color=blue><u>news:cgvefg$a51$1@eclipse.org</u></font></a><font size=3>....</font>
<br><font size=1 face="sans-serif"><br>
Hi </font><font size=3><br>
</font><font size=1 face="sans-serif"><br>
I have two layout related questions: </font><font size=3><br>
</font><font size=1 face="sans-serif"><br>
First, When I have an GEF Editor, and I have a CanvasEditPart as &quot;contents&quot;,
and in create Figure() I do the following: </font><font size=3><br>
</font><font size=1 face="sans-serif"><br>
public class CanvasEditPart extends CommonEditPart <br>
{</font><font size=3> </font><font size=1 face="sans-serif"><br>
&nbsp; &nbsp; &nbsp; &nbsp;protected IFigure createFigure() <br>
&nbsp; &nbsp; &nbsp; &nbsp;{</font><font size=3> </font><font size=1 face="sans-serif"><br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;FreeformLayer layer
= new FreeformLayer();</font><font size=3> </font><font size=1 face="sans-serif"><br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//define flow layout</font><font size=3>
</font><font size=1 face="sans-serif"><br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;FlowLayout layout
= new FlowLayout(false);</font><font size=3> </font><font size=1 face="sans-serif"><br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;layout.setMinorAlignment(FlowLayout.ALIGN_CENTER); </font><font size=3>
</font><font size=1 face="sans-serif"><br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;layout.setMajorAlignment(FlowLayout.ALIGN_CENTER); </font><font size=3>
</font><font size=1 face="sans-serif"><br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;layer.setLayoutManager(layout);</font><font size=3>
</font><font size=1 face="sans-serif"><br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return layer;</font><font size=3>
</font><font size=1 face="sans-serif"><br>
&nbsp; &nbsp; &nbsp; &nbsp;}</font><font size=3> <br>
<br>
</font><font size=1 face="sans-serif"><br>
I would expect that the figure gets placed in the middle of the Canvas,
both in X and Y direction. However, it only gets centered in Y direction.
Any ideas, anyone ?</font><font size=3> <br>
<br>
</font><font size=1 face="sans-serif"><br>
Second: When I use an layout Manager, like i.e. FlowLayout or ToolbarLayout,
is there a way to tell the layout that it should keep a margin at the top
<br>
WITHOUT inserting a dummy figure ? I Know that I can set up spacing, but
this doesnt work for the top and bottom margins ?</font><font size=3> </font></div>
--=_alternative 004AEE4DC1256F01_=--
Re: Two layout realted questions [message #149206 is a reply to message #149189] Tue, 31 August 2004 14:51 Go to previous message
Pratik Shah is currently offline Pratik ShahFriend
Messages: 1077
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.

------=_NextPart_000_00DC_01C48F48.6DF7A520
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Try putting the column in the center of a border layout. I don't think =
that'll work (i think border layout doesn't center the centerpiece along =
the x axis), but you can test it out. If it doesn't work, you can =
modify BorderLayout to your needs or, perhaps better, write a new =
CenteredLayout or something (and contribute it to Draw2d!).

BTW, can you use a smaller font? This one's taking up too much real =
estate on my screen. ;-)
<smoser@de.ibm.com> wrote in message news:ch1une$ags$1@eclipse.org...

Hi Pratik,=20

I see. Thanks for pointing this out. Continuing your example, given =
that I have two figures in a column, (the lower one much wider and =
higher that the first), what would be the best solution then to Center =
them in X AND in Y Direction ? So I like to center it in the middle of =
the canvas, the upper one (small) centered on top of the lower one ? How =
do I archive this the easiest way ?=20
Simon=20



First: Let's say you have two figures in a column (vertical =
flowlayout), one twice the width of the other. If you set =
minorAlignment to center, the two figures will be aligned such that =
their centers lie on the same y coordinate. If you set the =
majorAlignment to center, the column containing those two figures will =
be placed in such a way that any empty space in that column will be =
distributed evenly at the top and bottom. FlowLayout does not =
reposition columns along the x axis or rows along the y axis.=20
=20
Second: You can set a MarginBorder on the figure to do that.=20
<smoser@de.ibm.com> wrote in message news:cgvefg$a51$1@eclipse.org.... =


Hi=20

I have two layout related questions:=20

First, When I have an GEF Editor, and I have a CanvasEditPart as =
"contents", and in create Figure() I do the following:=20

public class CanvasEditPart extends CommonEditPart=20
{=20
protected IFigure createFigure()=20
{=20
FreeformLayer layer =3D new FreeformLayer();=20
=20
//define flow layout=20
FlowLayout layout =3D new FlowLayout(false);=20
=20
layout.setMinorAlignment(FlowLayout.ALIGN_CENTER);=20
layout.setMajorAlignment(FlowLayout.ALIGN_CENTER);=20
=20
layer.setLayoutManager(layout);=20
=20
return layer;=20
}=20


I would expect that the figure gets placed in the middle of the =
Canvas, both in X and Y direction. However, it only gets centered in Y =
direction. Any ideas, anyone ?=20


Second: When I use an layout Manager, like i.e. FlowLayout or =
ToolbarLayout, is there a way to tell the layout that it should keep a =
margin at the top=20
WITHOUT inserting a dummy figure ? I Know that I can set up spacing, =
but this doesnt work for the top and bottom margins ?
------=_NextPart_000_00DC_01C48F48.6DF7A520
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1458" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Try putting&nbsp;the column in the =
center of a=20
border layout.&nbsp; I don't think that'll work (i think&nbsp;border =
layout=20
doesn't center the centerpiece along the x axis), but you can test it =
out.&nbsp;=20
If it doesn't work, you can modify BorderLayout to your needs or, =
perhaps=20
better, write a new CenteredLayout or something (and contribute it to=20
Draw2d!).</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>BTW, can you use a smaller font?&nbsp; =
This one's=20
taking up too much real estate on my screen. ;-)</FONT></DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>&lt;<A =
href=3D"mailto:smoser@de.ibm.com">smoser@de.ibm.com</A>&gt; wrote in=20
message <A=20
=
href=3D"news:ch1une$ags$1@eclipse.org">news:ch1une$ags$1@eclipse.org</A>.=
...</DIV><BR><FONT=20
face=3Dsans-serif size=3D1>Hi Pratik, </FONT><BR><BR><FONT =
face=3Dsans-serif=20
size=3D1>I see. Thanks for pointing this out. Continuing your example, =
given=20
that I have two figures in a column, (the lower one much wider and =
higher that=20
the first), what would be the best solution then to Center them in X =
AND in Y=20
Direction ? So I like to center it in the middle of the canvas, the =
upper one=20
(small) centered on top of the lower one ? How do I archive this the =
easiest=20
way ? </FONT><BR><FONT face=3Dsans-serif size=3D1>Simon </FONT><BR>
<DIV><BR><BR><FONT face=3DArial size=3D2>First: Let's say you have two =
figures in=20
a column (vertical flowlayout), one twice the width of the other. =
&nbsp;If you=20
set minorAlignment to center, the two figures will be aligned such =
that their=20
centers lie on the same y coordinate. &nbsp;If you set the =
majorAlignment to=20
center, the column containing those two figures will be placed in such =
a way=20
that any empty space in that column will be distributed evenly at the =
top and=20
bottom. &nbsp;FlowLayout does not reposition columns along the x axis =
or rows=20
along the y axis.</FONT> <BR><FONT size=3D3>&nbsp;</FONT> <BR><FONT =
face=3DArial=20
size=3D2>Second: You can set a MarginBorder on the figure to do =
that.</FONT>=20
<BR><FONT size=3D3>&lt;</FONT><A =
href=3D"mailto:smoser@de.ibm.com"><FONT=20
color=3Dblue size=3D3><U>smoser@de.ibm.com</U></FONT></A><FONT =
size=3D3>&gt; wrote=20
in message </FONT><A href=3D"news:cgvefg$a51$1@eclipse.org"><FONT =
color=3Dblue=20
size=3D3><U>news:cgvefg$a51$1@eclipse.org</U></FONT></A><FONT =
size=3D3>....</FONT>=20
<BR><FONT face=3Dsans-serif size=3D1><BR>Hi </FONT><FONT =
size=3D3><BR></FONT><FONT=20
face=3Dsans-serif size=3D1><BR>I have two layout related questions: =
</FONT><FONT=20
size=3D3><BR></FONT><FONT face=3Dsans-serif size=3D1><BR>First, When I =
have an GEF=20
Editor, and I have a CanvasEditPart as "contents", and in create =
Figure() I do=20
the following: </FONT><FONT size=3D3><BR></FONT><FONT =
face=3Dsans-serif=20
size=3D1><BR>public class CanvasEditPart extends CommonEditPart=20
<BR>{</FONT><FONT size=3D3> </FONT><FONT face=3Dsans-serif =
size=3D1><BR>&nbsp;=20
&nbsp; &nbsp; &nbsp;protected IFigure createFigure() <BR>&nbsp; &nbsp; =
&nbsp;=20
&nbsp;{</FONT><FONT size=3D3> </FONT><FONT face=3Dsans-serif =
size=3D1><BR>&nbsp;=20
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;FreeformLayer layer =
=3D new=20
FreeformLayer();</FONT><FONT size=3D3> </FONT><FONT face=3Dsans-serif=20
size=3D1><BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp;<BR>&nbsp;=20
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//define flow=20
layout</FONT><FONT size=3D3> </FONT><FONT face=3Dsans-serif =
size=3D1><BR>&nbsp;=20
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;FlowLayout layout =3D =
new=20
FlowLayout(false);</FONT><FONT size=3D3> </FONT><FONT =
face=3Dsans-serif=20
size=3D1><BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp;<BR>&nbsp;=20
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;=20
&nbsp;layout.setMinorAlignment(FlowLayout.ALIGN_CENTER); </FONT><FONT =
size=3D3>=20
</FONT><FONT face=3Dsans-serif size=3D1><BR>&nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp;=20
&nbsp; &nbsp;=20
&nbsp;layout.setMajorAlignment(FlowLayout.ALIGN_CENTER); </FONT><FONT =
size=3D3>=20
</FONT><FONT face=3Dsans-serif size=3D1><BR>&nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp;=20
&nbsp; &nbsp; &nbsp;<BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp;=20
&nbsp;layer.setLayoutManager(layout);</FONT><FONT size=3D3> =
</FONT><FONT=20
face=3Dsans-serif size=3D1><BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp;=20
&nbsp;<BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp;return=20
layer;</FONT><FONT size=3D3> </FONT><FONT face=3Dsans-serif =
size=3D1><BR>&nbsp;=20
&nbsp; &nbsp; &nbsp;}</FONT><FONT size=3D3> <BR><BR></FONT><FONT =
face=3Dsans-serif=20
size=3D1><BR>I would expect that the figure gets placed in the middle =
of the=20
Canvas, both in X and Y direction. However, it only gets centered in Y =

direction. Any ideas, anyone ?</FONT><FONT size=3D3> =
<BR><BR></FONT><FONT=20
face=3Dsans-serif size=3D1><BR>Second: When I use an layout Manager, =
like i.e.=20
FlowLayout or ToolbarLayout, is there a way to tell the layout that it =
should=20
keep a margin at the top <BR>WITHOUT inserting a dummy figure ? I Know =
that I=20
can set up spacing, but this doesnt work for the top and bottom =
margins=20
?</FONT><FONT size=3D3> </FONT></DIV></BLOCKQUOTE></BODY></HTML>

------=_NextPart_000_00DC_01C48F48.6DF7A520--
Previous Topic:dependences between property pages
Next Topic:Connector selection problems with Marquee Selection Tool
Goto Forum:
  


Current Time: Thu Mar 28 21:12:02 GMT 2024

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

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

Back to the top