Layout managers [message #166993] |
Fri, 04 February 2005 07:35  |
Eclipse User |
|
|
|
Originally posted by: bartgolsteijn.hotmail.com
I am creating an editor in which areas can be drawn in which widgets or
other areas can be placed. Each area should have its own layout manager.
At the moment, these sub areas are Figures. I want an item in the
Properties view that allows me to choose a layout manager for each area.
Now I have 2 questions:
(1) Is their a way to query GEF / Draw2D for all installed layoutmanagers
and use the result as input for a property editor?
(2) How can I change the layout manager of an Figure that accepts
components to be placed in it and supports dragging of its children? (Only
calling setLayoutManager(...) is not enough. I have looked at the Shapes
example, but that approach seems only to work for Freeform/XY layout).
Any help is appreciated.
Bart Golsteijn
|
|
|
Re: Layout managers [message #167145 is a reply to message #166993] |
Sun, 06 February 2005 02:05  |
Eclipse User |
|
|
|
"Bart Golsteijn" <bartgolsteijn@hotmail.com> wrote in message
news:ctvq6d$mm8$1@www.eclipse.org...
> I am creating an editor in which areas can be drawn in which widgets or
> other areas can be placed. Each area should have its own layout manager.
> At the moment, these sub areas are Figures. I want an item in the
> Properties view that allows me to choose a layout manager for each area.
> Now I have 2 questions:
>
> (1) Is their a way to query GEF / Draw2D for all installed layoutmanagers
> and use the result as input for a property editor?
Sure. JDT does it for its heirarchy view. Just look for concrete
implementors of the LayoutManager interface. Of course, this will also find
layouts that are anonymouse inner classes, or specific to certain things
(scrollbar layout, ruler layout, etc.). So, you'll have to do some
filtering. Maybe you can just restrict the search to the org.eclipse.draw2d
package. Or perhaps you can just pre-define the list of generic layouts -
stack, toolbar, border, flow, etc.
> (2) How can I change the layout manager of an Figure that accepts
> components to be placed in it and supports dragging of its children? (Only
> calling setLayoutManager(...) is not enough. I have looked at the Shapes
> example, but that approach seems only to work for Freeform/XY layout).
You'll have to update the child constraints, if there are any, to be
meaningful for the new layout. You might have to switch (or add/remove) an
editpolicy too, or just use the state pattern for the edit policy that shows
the drag target feedback. Take a look at the feedback that a FlowContainer
in the logic example shows when you drags its children. Of course, dragging
doesn't make sense for all layouts (such as stack), so you'll have to act
accordingly.
>
> Any help is appreciated.
>
> Bart Golsteijn
>
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.02653 seconds