Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Problems with costumized ToolBarLayoutManager
Problems with costumized ToolBarLayoutManager [message #179725] Fri, 29 April 2005 15:51 Go to next message
Andreas Holtz is currently offline Andreas HoltzFriend
Messages: 53
Registered: July 2009
Member
This is a multi-part message in MIME format.
--------------010903050104010601000105
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit

Hi,

I have some problems with the ToolbarLayoutManager.
I need a layoutmanager, who handles three figures, alinged in a row or
column (configurable).
I explain the problem now with horizontal alignment:

The left and the right figure have to have the height of the center
figure, which serves as a
container for the childFigures.
The left and right figures just paint some lines, which depends from the
size of the figure (i.e. drawLine from top to bottom)
The problem is, that when i use a normal ToolbarLayout (or
BorderLayout), the outer figures have the standard size of (64,36) and
are smaller than the center figure. But they should have the same height
as the centerFigure (width of 64 is ok).
So i overwrote the layout()-method of the toolbarLayout like this:

Rectangle badBoundsLeft =((IFigure) children.get(0)).getBounds();
Rectangle badBoundsRight =((IFigure) children.get(2)).getBounds();
Rectangle centerBounds ==((IFigure) children.get(1)).getBounds();
((Figure) children.get(0)).setBounds(new Rectangle(badBoundsLeft.x,
badBoundsLeft.y, badBoundsLeft.width, centerBounds.height));
((Figure) children.get(2)).setBounds(new Rectangle(badBoundsRight.x,
badBoundsRight.y, badBoundsRight.width, centerBounds.height));

and (another try) like this

badBoundsLeft.height = centerBounds.height;
badBoundsRight.height = centerBounds.height;

Now everything is drawn fine. But the child figures can be collapsed and
expanded (works fine). The problem is, that with collapsing the height
and the width changes. With the above changed layoutManger, the height
isn
Re: Problems with costumized ToolBarLayoutManager [message #179847 is a reply to message #179725] Sun, 01 May 2005 22:24 Go to previous messageGo to next message
Pratik Shah is currently offline Pratik ShahFriend
Messages: 1077
Registered: July 2009
Senior Member
Without looking at what your post is really about, it seems you missed the
method ToolbarLayout#setStretchMinorAxis

"Andreas Holtz" <A.Holtz@gmx.net> wrote in message
news:d4tld7$n3t$1@news.eclipse.org...
> Hi,
>
> I have some problems with the ToolbarLayoutManager.
> I need a layoutmanager, who handles three figures, alinged in a row or
> column (configurable).
> I explain the problem now with horizontal alignment:
>
> The left and the right figure have to have the height of the center
> figure, which serves as a
> container for the childFigures.
> The left and right figures just paint some lines, which depends from the
> size of the figure (i.e. drawLine from top to bottom)
> The problem is, that when i use a normal ToolbarLayout (or
> BorderLayout), the outer figures have the standard size of (64,36) and
> are smaller than the center figure. But they should have the same height
> as the centerFigure (width of 64 is ok).
> So i overwrote the layout()-method of the toolbarLayout like this:
>
> Rectangle badBoundsLeft =((IFigure) children.get(0)).getBounds();
> Rectangle badBoundsRight =((IFigure) children.get(2)).getBounds();
> Rectangle centerBounds ==((IFigure) children.get(1)).getBounds();
> ((Figure) children.get(0)).setBounds(new Rectangle(badBoundsLeft.x,
> badBoundsLeft.y, badBoundsLeft.width, centerBounds.height));
> ((Figure) children.get(2)).setBounds(new Rectangle(badBoundsRight.x,
> badBoundsRight.y, badBoundsRight.width, centerBounds.height));
>
> and (another try) like this
>
> badBoundsLeft.height = centerBounds.height;
> badBoundsRight.height = centerBounds.height;
>
> Now everything is drawn fine. But the child figures can be collapsed and
> expanded (works fine). The problem is, that with collapsing the height
> and the width changes. With the above changed layoutManger, the height
> isn
Re: Problems with costumized ToolBarLayoutManager [message #179932 is a reply to message #179847] Mon, 02 May 2005 10:12 Go to previous messageGo to next message
Andreas Holtz is currently offline Andreas HoltzFriend
Messages: 53
Registered: July 2009
Member
Pratik Shah schrieb:
> Without looking at what your post is really about, it seems you missed the
> method ToolbarLayout#setStretchMinorAxis
>

No, i didn´t. I don´t want to let the height of the middle figure grow,
i want the other figures be shrinked to the height of the middle figure.

Andreas
Re: Problems with costumized ToolBarLayoutManager [message #179962 is a reply to message #179932] Mon, 02 May 2005 11:45 Go to previous messageGo to next message
Pratik Shah is currently offline Pratik ShahFriend
Messages: 1077
Registered: July 2009
Senior Member
In that case, if those figures returned a preferred height of 1 pixel, they
would be stretched vertically to the central figure's height.

"Andreas Holtz" <A.Holtz@gmx.net> wrote in message
news:d54unk$6ng$1@news.eclipse.org...
> Pratik Shah schrieb:
> > Without looking at what your post is really about, it seems you missed
the
> > method ToolbarLayout#setStretchMinorAxis
> >
>
> No, i didn
Re: Problems with costumized ToolBarLayoutManager [message #179984 is a reply to message #179962] Mon, 02 May 2005 13:12 Go to previous messageGo to next message
Andreas Holtz is currently offline Andreas HoltzFriend
Messages: 53
Registered: July 2009
Member
Pratik Shah schrieb:
> In that case, if those figures returned a preferred height of 1 pixel, they
> would be stretched vertically to the central figure's height.

That nearly works (it was 50% of the solution). But because the
layoutmanager touches and calculates the figure heights from the left to
right figure (normal iteration), the left figure has the old height of
the center figure. So the whole figure is too tall, but the center
figure will be arranged correctly.

My solution is to overwrite the ToolbarLayout#layout(IFigure) method,
and at first store the new calculated bounds in a variable, changing the
heights to the center figure´s height and then setting the bounds to the
figures.

Now everything is shown correctly...
Thank you VERY much... :-)

Andreas

PS: I´m still interested why setting the bounds manually does not work
properly...?
Re: Problems with costumized ToolBarLayoutManager [message #180020 is a reply to message #179725] Mon, 02 May 2005 17:37 Go to previous message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

You should be using a Border perhaps.

> I have some problems with the ToolbarLayoutManager.
> I need a layoutmanager, who handles three figures, alinged in a row or
> column (configurable).
> I explain the problem now with horizontal alignment:
>
> The left and the right figure have to have the height of the center
> figure, which serves as a
> container for the childFigures.
> The left and right figures just paint some lines, which depends from the
> size of the figure (i.e. drawLine from top to bottom)
> The problem is, that when i use a normal ToolbarLayout (or
> BorderLayout), the outer figures have the standard size of (64,36) and
> are smaller than the center figure. But they should have the same height
> as the centerFigure (width of 64 is ok).
> So i overwrote the layout()-method of the toolbarLayout like this:
>
> Rectangle badBoundsLeft =((IFigure) children.get(0)).getBounds();
> Rectangle badBoundsRight =((IFigure) children.get(2)).getBounds();
> Rectangle centerBounds ==((IFigure) children.get(1)).getBounds();
> ((Figure) children.get(0)).setBounds(new Rectangle(badBoundsLeft.x,
> badBoundsLeft.y, badBoundsLeft.width, centerBounds.height));
> ((Figure) children.get(2)).setBounds(new Rectangle(badBoundsRight.x,
> badBoundsRight.y, badBoundsRight.width, centerBounds.height));
>
> and (another try) like this
>
> badBoundsLeft.height = centerBounds.height;
> badBoundsRight.height = centerBounds.height;
>
> Now everything is drawn fine. But the child figures can be collapsed and
> expanded (works fine). The problem is, that with collapsing the height
> and the width changes. With the above changed layoutManger, the height
> isn
Previous Topic:FlowLayoutEditPolicy & children
Next Topic:Context menu shortcut not working the first time
Goto Forum:
  


Current Time: Fri Mar 29 15:11:39 GMT 2024

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

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

Back to the top