Add ImageFigure to custom layer [message #242142] |
Wed, 02 April 2008 12:43 |
Eclipse User |
|
|
|
Originally posted by: robert.moestl.joanneum.at
Hello folks!
I maintain code which uses GEF. My former collegue wrote a class
(RotatableScalableImageFigure) which extends ImageFigure and basically
shows an image. This class is only used once for showing a picture which
represents the axes of a coordinate system. This figure is added to a
custom layer. This is done by the following code:
[CODE]
public class RootEditPart extends ScalableFreeformRootEditPart {
public static final String LEGEND_LAYER = "Legend Layer";
@Override
protected void createLayers(LayeredPane layeredPane) {
final FreeformLayer legendLayer = new FreeformLayer();
final RotatableScalableImageFigure imageFigure = new
RotatableScalableImageFigure(ExhibitionDesignerPlugin.getIma ge(ExhibitionDesignerIcons.COORDINATE_SYSTEM));
legendLayer.add(imageFigure);
layeredPane.add(legendLayer, LEGEND_LAYER);
super.createLayers(layeredPane);
}
....
[CODE]
This works fine. As I said before RotatableScalableImageFigure only
shows a picture. Therefore I thought I can use ImageFigure instead. But
it doesn't work, the figure just don't show up. Therefore I used this code:
[CODE]
public class RootEditPart extends ScalableFreeformRootEditPart {
public static final String LEGEND_LAYER = "Legend Layer";
@Override
protected void createLayers(LayeredPane layeredPane) {
final FreeformLayer legendLayer = new FreeformLayer();
final ImageFigure imageFigure = new
ImageFigure(ExhibitionDesignerPlugin.getImage(ExhibitionDesi gnerIcons.COORDINATE_SYSTEM))
legendLayer.add(imageFigure);
layeredPane.add(legendLayer, LEGEND_LAYER);
super.createLayers(layeredPane);
}
....
[CODE]
Besides I use ImageFigure for some EditParts and it works fine. So my
question is if it is possible at all to add a ImageFigure to a custom
layer? Or how can I achieve that an ImageFigure is drawn on a custom layer?
Kind regards
Robert
|
|
|
Re: Add ImageFigure to custom layer [message #242147 is a reply to message #242142] |
Wed, 02 April 2008 14:34 |
Eclipse User |
|
|
|
Originally posted by: robert.moestl.joanneum.at
Sorry, I forgot to call #setBounds on imageFigure. I already tried that
out but seemingly I used too little width and height.
Robert Möstl wrote:
> Hello folks!
>
> I maintain code which uses GEF. My former collegue wrote a class
> (RotatableScalableImageFigure) which extends ImageFigure and basically
> shows an image. This class is only used once for showing a picture which
> represents the axes of a coordinate system. This figure is added to a
> custom layer. This is done by the following code:
>
>
> [CODE]
>
> public class RootEditPart extends ScalableFreeformRootEditPart {
>
> public static final String LEGEND_LAYER = "Legend Layer";
>
> @Override
> protected void createLayers(LayeredPane layeredPane) {
> final FreeformLayer legendLayer = new FreeformLayer();
> final RotatableScalableImageFigure imageFigure = new
> RotatableScalableImageFigure(ExhibitionDesignerPlugin.getIma ge(ExhibitionDesignerIcons.COORDINATE_SYSTEM));
>
> legendLayer.add(imageFigure);
> layeredPane.add(legendLayer, LEGEND_LAYER);
> super.createLayers(layeredPane);
> }
> ...
> [CODE]
>
> This works fine. As I said before RotatableScalableImageFigure only
> shows a picture. Therefore I thought I can use ImageFigure instead. But
> it doesn't work, the figure just don't show up. Therefore I used this code:
>
> [CODE]
>
> public class RootEditPart extends ScalableFreeformRootEditPart {
>
> public static final String LEGEND_LAYER = "Legend Layer";
>
> @Override
> protected void createLayers(LayeredPane layeredPane) {
> final FreeformLayer legendLayer = new FreeformLayer();
> final ImageFigure imageFigure = new
> ImageFigure(ExhibitionDesignerPlugin.getImage(ExhibitionDesi gnerIcons.COORDINATE_SYSTEM))
>
> legendLayer.add(imageFigure);
> layeredPane.add(legendLayer, LEGEND_LAYER);
> super.createLayers(layeredPane);
> }
> ...
> [CODE]
>
>
>
>
> Besides I use ImageFigure for some EditParts and it works fine. So my
> question is if it is possible at all to add a ImageFigure to a custom
> layer? Or how can I achieve that an ImageFigure is drawn on a custom layer?
>
> Kind regards
> Robert
|
|
|
Powered by
FUDForum. Page generated in 0.03160 seconds