CenteringLayout [message #97324] |
Sun, 05 October 2003 17:50  |
Eclipse User |
|
|
|
Originally posted by: ThisisFake.Fakeness.xyz
Any ideas on how to make a centering layout.
now I use the parent figure, get its size, and use the child size to
modify the bounds and put the child in the center of the parent. Sounds
simple enough, but appeareantly the parent's size is somehow based on the
childs position. So the parent gets resized, and I am locked in a endless
loop. but even when I was not, it still was not exactly in the center.
The parent figure is a FreeformLayer. This is because the parent
RootEditPart is a FreeformGraphicalRootEditPart. Is this figure somehow
auto resizing? it seems to lack a definite size notion. Im lost on how to
get this centering layout working.
I need tips! :)
Thanks,
CL
|
|
|
|
|
Re: CenteringLayout [message #97430 is a reply to message #97324] |
Sun, 05 October 2003 23:26   |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
I wouldn't recomment fighting with the freeform layouts. As you found out,
they work backwards. The children are positioned first, which determines
where the parent needs to be. Think of it as a rubber-band behavior. So
placing the children based on the parent's location isn't well defined
because it is cyclic.
If you want centering, try doing it without "freeform" classes. Use just
the ScalableGraphicalEditPart, which uses simpler stacklayouts to layout the
contents.
"CL [dnoyeB] Gilbert" <ThisisFake@Fakeness.xyz> wrote in message
news:pan.2003.10.05.21.50.30.596754@Fakeness.xyz...
> Any ideas on how to make a centering layout.
>
> now I use the parent figure, get its size, and use the child size to
> modify the bounds and put the child in the center of the parent. Sounds
> simple enough, but appeareantly the parent's size is somehow based on the
> childs position. So the parent gets resized, and I am locked in a endless
> loop. but even when I was not, it still was not exactly in the center.
>
> The parent figure is a FreeformLayer. This is because the parent
> RootEditPart is a FreeformGraphicalRootEditPart. Is this figure somehow
> auto resizing? it seems to lack a definite size notion. Im lost on how to
> get this centering layout working.
>
> I need tips! :)
>
>
> Thanks,
>
>
> CL.
|
|
|
|
Re: CenteringLayout [message #97468 is a reply to message #97445] |
Mon, 06 October 2003 10:53   |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
If you ONLY need to center horizontally, and not vertically, you can use
ToolbarLayout in vertical orientation, with setMinorAxisAligment(CENTER)
"CL [dnoyeB] Gilbert" <ThisisFake@Fakeness.xyz> wrote in message
news:pan.2003.10.06.10.12.50.286327@Fakeness.xyz...
> On Sun, 05 Oct 2003 23:26:55 -0400, Randy Hudson wrote:
>
> > I wouldn't recomment fighting with the freeform layouts. As you found
> > out, they work backwards. The children are positioned first, which
> > determines where the parent needs to be. Think of it as a rubber-band
> > behavior. So placing the children based on the parent's location isn't
> > well defined because it is cyclic.
> >
> > If you want centering, try doing it without "freeform" classes. Use
> > just the ScalableGraphicalEditPart, which uses simpler stacklayouts to
> > layout the contents.
> >
> >
> This is the approach I have taken and it has worked. Though its not a
> stack layout because the size of my components are actually in constraints
> that I need to retrieve. stack layout does not respect (child) component
> size. So I extended XYLayout. Its really not a proper extent of XYLayout
> since its overriding the main funciton and actually only seeks to use the
> MAP that holds the constraint. I will probably change it to extend
> AbstractLayout or some such.
>
> I briefly though about makinga class that could center on a freeform
> parent as well, but I figure I have enough battles to fight..
>
> CL
|
|
|
|
Powered by
FUDForum. Page generated in 0.28882 seconds