Skip to main content



      Home
Home » Eclipse Projects » GEF » CenteringLayout
CenteringLayout [message #97324] Sun, 05 October 2003 17:50 Go to next message
Eclipse UserFriend
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 #97356 is a reply to message #97324] Mon, 06 October 2003 04:14 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: g.wagenknecht.intershop.de

CL [dnoyeB] Gilbert wrote:

> 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.

Don't know if the Freeform Layer is capable of handling other layouts than a
FreeformLayout. The regular way is that a parent layouts its children. You
can look into StackLayout of implementation hints. StackLayout is a
"centering" layout. Probably you need to implement your custom layout into
the FreeformLayer.

Cu, Gunnar
Re: CenteringLayout [message #97416 is a reply to message #97356] Mon, 06 October 2003 03:18 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ThisisFake.Fakeness.xyz

On Mon, 06 Oct 2003 10:14:32 +0200, Gunnar Wagenknecht wrote:

> CL [dnoyeB] Gilbert wrote:
>
>> 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.
>
> Don't know if the Freeform Layer is capable of handling other layouts
> than a FreeformLayout. The regular way is that a parent layouts its
> children. You can look into StackLayout of implementation hints.
> StackLayout is a "centering" layout. Probably you need to implement your
> custom layout into the FreeformLayer.
>
> Cu, Gunnar


I figured it out. I did look at StackLayout, but its not a centering
layout, its a "blow you up to full size" layout :)

but as you hinted, the key was to not use a FreeForm figure, but a
different one such as a Scalable Figure. Once I did that, it all worked
out fine. Their should be some mechanism or exception thrown when
improper layout matching to figures happens. Heck the figure should test
the type of layout and dump a warning if its not proper. at least during
the debug phase...


Thanks again!



CL
Re: CenteringLayout [message #97430 is a reply to message #97324] Sun, 05 October 2003 23:26 Go to previous messageGo to next message
Eclipse UserFriend
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 #97445 is a reply to message #97430] Mon, 06 October 2003 06:12 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ThisisFake.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
Re: CenteringLayout [message #97468 is a reply to message #97445] Mon, 06 October 2003 10:53 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: CenteringLayout [message #104343 is a reply to message #97324] Mon, 10 November 2003 02:23 Go to previous message
Eclipse UserFriend
Hi,

I think it can be done by using BorderLayout and set the constraint to
BorderLayout.CENTER .

If you want to specify the size of the child figure. You can copy the source
of BorderLayout and write your own.

Hope it helps.
Simon

"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.
Previous Topic:architecture struggle with actions vs commands
Next Topic:Does GEF Editor require a physical file as an input for opening???
Goto Forum:
  


Current Time: Sat Jul 19 17:21:34 EDT 2025

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

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

Back to the top