Custom auto-layout [message #689942] |
Tue, 28 June 2011 12:07  |
Eclipse User |
|
|
|
Originally posted by: Torsten Keil
Hi
i have a problem implementing an own layout provider for auto-layout for
the case of figures that have compartments (with XYLayout) where the
figures inside the compartments can have compartments themself and so on.
The auto-layout should layout the figures inside the compartments and
the diagram in a kind of GridLayout (also done inside auto-layout) and
set the auto-size of each figure (by setting bounds width and height to
-1). Everything is done inside CompoundCommands via SetBoundsCommands
and ChangeBoundsCommands from
ChangeBoundsRequest(RequestConstants.REQ_AUTOSIZE).
The problem i have is to get the correct size of the containers.
Let's assume the following structure
Figure A
-> Figure B1 (inside compartment of A)
-> Figure C (inside compartment of B1)
-> Figure D (inside compartment of B1)
-> Figure E (inside compartment of B1)
-> Figure B2 (inside compartment of A)
-> Figure F (inside compartment of B2)
-> Figure G (inside compartment of B2)
-> Figure H (inside compartment of B2)
and also
Figure X
The auto-layout changes size and position from the most inner figure to
the top figures:
- C,D,E are positioned inside B1
- F,G,H are positioned inside B2
- B1 and B2 inside A
- and A and X inside the diagram
But after changing size and position of the elements how can i get the
"real" size of the elements because i always set width and height to -1
to force autosize.
Any calculation is based on the prefered sizes ... this may change after
re-layout of the inner figures.
The effect: When figure A shrinks during the layout - figure X is placed
far right. When figure A grows during layout - figure X is hidden from A.
The user may trigger auto-layout multiple times and with every layout
the positions are updated until the correct layout is reached, but
that's only a workaround.
How can I achieve the correct layout within a single layout step?
Any ideas?
Thanks,
Torsten
|
|
|
Re: Custom auto-layout [message #692303 is a reply to message #689942] |
Mon, 04 July 2011 03:01  |
Eclipse User |
|
|
|
Originally posted by: Torsten Keil
[full quote of the problem below - no short version available ;-) ]
The solution is to create a custom command for the auto-layout that will
execute each single resize or move command directly. And every time you
changed an edit part and need the changes for further calculations you
have to call #refresh() on the edit part. This triggers an internal
update of the "graphical state" and after that the new size and position
are "available".
I hope this helps if someone runs into the same issue.
Torsten
Am 28.06.2011 18:07, schrieb Torsten Keil:
> Hi
>
> i have a problem implementing an own layout provider for auto-layout for
> the case of figures that have compartments (with XYLayout) where the
> figures inside the compartments can have compartments themself and so on.
>
> The auto-layout should layout the figures inside the compartments and
> the diagram in a kind of GridLayout (also done inside auto-layout) and
> set the auto-size of each figure (by setting bounds width and height to
> -1). Everything is done inside CompoundCommands via SetBoundsCommands
> and ChangeBoundsCommands from
> ChangeBoundsRequest(RequestConstants.REQ_AUTOSIZE).
>
> The problem i have is to get the correct size of the containers.
>
> Let's assume the following structure
>
> Figure A
> -> Figure B1 (inside compartment of A)
> -> Figure C (inside compartment of B1)
> -> Figure D (inside compartment of B1)
> -> Figure E (inside compartment of B1)
> -> Figure B2 (inside compartment of A)
> -> Figure F (inside compartment of B2)
> -> Figure G (inside compartment of B2)
> -> Figure H (inside compartment of B2)
>
> and also
>
> Figure X
>
> The auto-layout changes size and position from the most inner figure to
> the top figures:
> - C,D,E are positioned inside B1
> - F,G,H are positioned inside B2
> - B1 and B2 inside A
> - and A and X inside the diagram
>
> But after changing size and position of the elements how can i get the
> "real" size of the elements because i always set width and height to -1
> to force autosize.
> Any calculation is based on the prefered sizes ... this may change after
> re-layout of the inner figures.
>
> The effect: When figure A shrinks during the layout - figure X is placed
> far right. When figure A grows during layout - figure X is hidden from A.
>
> The user may trigger auto-layout multiple times and with every layout
> the positions are updated until the correct layout is reached, but
> that's only a workaround.
>
> How can I achieve the correct layout within a single layout step?
>
> Any ideas?
>
> Thanks,
> Torsten
|
|
|
Powered by
FUDForum. Page generated in 0.04775 seconds