Layout information? [message #152868] |
Tue, 05 October 2004 16:09  |
Eclipse User |
|
|
|
Originally posted by: brett.bock.embarcadero.com
I'm looking for some information about layout, are there any totorials out
there or explainations of all the different types of layouts?
My sepecific problem is that I would like to have a layout that supports a
several figures similar to the ToolbarLayout. Each of the child figures
being labels, except for the last child. The last child I would like to use
the XYLayout and support its own children.
The problem I am seeing is that the parent ToobarLayout is setting the last
child's height to zero. I would prefer the layout to set the height of the
last child to the height of the rest of the parent figure.
Any thoughts would be appreciated. Thank you.
|
|
|
|
|
|
Re: Layout information? [message #152946 is a reply to message #152929] |
Tue, 05 October 2004 18:20   |
Eclipse User |
|
|
|
Originally posted by: brett.bock.embarcadero.com
Right, my first inclination was to override the behavior of the child
figure's getPreferredSize(). In getPreferredSize() I should set the
preferred height to the difference of the current to of the child figure,
and the bottom of the parent figure. However, this did not seem like the
correct place to be make this decision.
Isn't it more correct to have a layout manager perform this calculation?
Should I derive a new layout manager from the ToolbarLayout, and override
the layout() operation?
"Randy Hudson" <none@us.ibm.com> wrote in message
news:cjv3nv$fu$1@eclipse.org...
> I think the default orientation is vertical, right? So the width would be
> stretched in that case. If the continer with XYLayout has no children,
its
> preferred size will be 0,0 unless you make it otherwise. You might try
> calling setMinimumSize, but I don't think it is called in this case, so
> you'll have to set the preferredSize to a fixed value, or override it to
> make sure it is at least some dimension.
>
> "Brett Bock" <brett.bock@embarcadero.com> wrote in message
> news:cjv27k$tjo$1@eclipse.org...
> > The height is still zero.
> >
> > The parent constructor now contains the following layout manager code:
> > ToolbarLayout layout = new ToolbarLayout();
> > layout.setStretchMinorAxis( true );
> > setLayoutManager( layout );
> >
> > The child constructor contains the following layout manager code:
> > XYLayout layout = new XYLayout();
> > setLayoutManager( layout );
> >
> > I am using the child figure's getClientArea() to obtain the rectangle
for
> > the child figure in a createAddCommand in my LayouEditPolicy derived
> class.
> > The goal is to make sure the node being dragged into this child is fully
> > contained by this child before allowing the user to drop the node.
> >
> >
> > "Randy Hudson" <none@us.ibm.com> wrote in message
> > news:cjv0fe$q4o$1@eclipse.org...
> > > use setStretchMinorAxis(true) to stretch all children to be the same
> > hieght
> > > in a horizontal toolbar layout.
> > > "Brett Bock" <brett.bock@embarcadero.com> wrote in message
> > > news:cjuup1$n1g$1@eclipse.org...
> > > > I'm looking for some information about layout, are there any
totorials
> > out
> > > > there or explainations of all the different types of layouts?
> > > >
> > > > My sepecific problem is that I would like to have a layout that
> supports
> > a
> > > > several figures similar to the ToolbarLayout. Each of the child
> figures
> > > > being labels, except for the last child. The last child I would
like
> to
> > > use
> > > > the XYLayout and support its own children.
> > > >
> > > > The problem I am seeing is that the parent ToobarLayout is setting
the
> > > last
> > > > child's height to zero. I would prefer the layout to set the height
> of
> > > the
> > > > last child to the height of the rest of the parent figure.
> > > >
> > > > Any thoughts would be appreciated. Thank you.
> > > >
> > > >
> > >
> > >
> >
> >
>
>
|
|
|
Re: Layout information? [message #153032 is a reply to message #152946] |
Wed, 06 October 2004 10:41  |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
"Brett Bock" <brett.bock@embarcadero.com> wrote in message
news:cjv6e2$4df$1@eclipse.org...
> Right, my first inclination was to override the behavior of the child
> figure's getPreferredSize(). In getPreferredSize() I should set the
> preferred height to the difference of the current to of the child figure,
> and the bottom of the parent figure. However, this did not seem like the
> correct place to be make this decision.
>
> Isn't it more correct to have a layout manager perform this calculation?
> Should I derive a new layout manager from the ToolbarLayout, and override
> the layout() operation?
It seems like more work than just:
class MyFigure {
static Dimension MIN_SIZE = new Dimension(100,100);
public Dimension getPreferredSize() {
return super.getPreferredSize().getUnioned(MIN_SIZE);
}
}
|
|
|
Powered by
FUDForum. Page generated in 0.07941 seconds