Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Add ImageFigure to custom layer
Add ImageFigure to custom layer [message #242142] Wed, 02 April 2008 12:43 Go to next message
Eclipse UserFriend
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 Go to previous message
Eclipse UserFriend
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
Previous Topic:select a different edit part when selecting a figure
Next Topic:Drag/drop java file into GEF
Goto Forum:
  


Current Time: Thu Sep 19 14:23:57 GMT 2024

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

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

Back to the top