Watermark [message #153914] |
Wed, 13 October 2004 18:26 ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: eproulx.ubiquity.net
Dear SWT experts,
I'm trying to add a watermark graphic into my diagram. I can load the
Image and add it to a diagram as an ImageFigure, but the figure selection
is wrong; new Figures show up "under" the watermark. I'd like to put this
"below" all other figures.
Image i = FlareImages.logo;
ImageFigure logo = new ImageFigure(i);
diagramFigure.add(logo,new Rectangle(5, 5,
i.getImageData().width,
i.getImageData().height);
I'm thinking the editor may paint the Image below the diagram, on a
different layer. But I don't know how to do it.
Can you give me a hint?
Emmanuel Proulx
|
|
|
Re: Watermark [message #154019 is a reply to message #153914] |
Thu, 14 October 2004 13:34 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: none.us.ibm.com
Do you want a graphic which scrolls or doesn't scroll? If it scrolls, just
paint it using the figure which is the digram.
"Emmanuel Proulx" <eproulx@ubiquity.net> wrote in message
news:ckjrn5$b0b$1@eclipse.org...
> Dear SWT experts,
>
> I'm trying to add a watermark graphic into my diagram. I can load the
> Image and add it to a diagram as an ImageFigure, but the figure selection
> is wrong; new Figures show up "under" the watermark. I'd like to put this
> "below" all other figures.
>
> Image i = FlareImages.logo;
> ImageFigure logo = new ImageFigure(i);
> diagramFigure.add(logo,new Rectangle(5, 5,
> i.getImageData().width,
> i.getImageData().height);
>
> I'm thinking the editor may paint the Image below the diagram, on a
> different layer. But I don't know how to do it.
>
> Can you give me a hint?
>
> Emmanuel Proulx
>
>
|
|
|
Re: Watermark [message #154065 is a reply to message #153914] |
Thu, 14 October 2004 16:06 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: eproulx.ubiquity.net
Answering my own question:
public class WatermarkRootEditPart extends FreeformGraphicalRootEditPart {
private static final String WATERMARK_LAYER = "Watermark layer";
protected void createLayers(LayeredPane layeredPane) {
Image i = new Image(null ,
getClass().getResourceAsStream("watermark.gif"));
ImageFigure logo = new ImageFigure(i);
logo.setEnabled(false);
logo.setOpaque(false);
logo.setFocusTraversable(false);
logo.setRequestFocusEnabled(false);
logo.setValid(false);
FreeformLayer watermarkLayer = new FreeformLayer();
layeredPane.addLayerBefore(watermarkLayer, WATERMARK_LAYER,
null);
watermarkLayer.setLayoutManager(new XYLayout());
watermarkLayer.add(logo, new Rectangle(5, 5,
i.getImageData().width,
i.getImageData().height));
super.createLayers(layeredPane);
}
}
Now in the editor class:
public class MyEditor extends GraphicalEditorWithPalette {
...
protected void configureGraphicalViewer() {
super.configureGraphicalViewer();
getGraphicalViewer().setRootEditPart(new
WatermarkRootEditPart());
...
}
...
}
If this helps let me know.
Emmanuel
"Emmanuel Proulx" <eproulx@ubiquity.net> wrote in message
news:<ckjrn5$b0b$1@eclipse.org>...
> Dear SWT experts,
>
> I'm trying to add a watermark graphic into my diagram. I can load the
> Image and add it to a diagram as an ImageFigure, but the figure selection
> is wrong; new Figures show up "under" the watermark. I'd like to put this
> "below" all other figures.
|
|
|
Re: Watermark [message #154349 is a reply to message #154065] |
Sun, 17 October 2004 14:28 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: paolino125.hotmail.com
Hi! Yes it's very useful and I need such as example but...for me doesn't
work...I run your code in my editor and nothing appears. If I comment last
line (super.createLayers(layeredPane)) the image appears, but obviously all
other layer disappears...You can mind why? If yes tanks a lot!
Funky79
|
|
|
Re: Watermark [message #164057 is a reply to message #154349] |
Mon, 17 January 2005 11:57 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: mdj.hotmail.com
Maybe your app topEditPart's figure is Opaque.
rootFigure.setOpaque(false);
|
|
|
Powered by
FUDForum. Page generated in 0.03704 seconds