getPrintableLayers() [message #68108] |
Tue, 04 March 2003 04:11  |
Eclipse User |
|
|
|
Hello,
I have a special ScalableFreeformRootEditPart to get my nodes painted on my
connections, so I do something like this:
protected ScalableFreeformLayeredPane createScaledLayers()
{
ScalableFreeformLayeredPane layers = new ScalableFreeformLayeredPane();
layers.add(new ConnectionLayer(), CONNECTION_LAYER);
FreeformLayer tmpPrimary = new FreeformLayer();
tmpPrimary.setOpaque(false);
layers.add(tmpPrimary, PRIMARY_LAYER);
layers.add(getPrintableLayers(), PRINTABLE_LAYERS);
return layers;
}
getPrintableLayers() calls createPrintableLayers(), where _new_ layer
objects are added to a pane that is finally returned. As this seems to make
sense for the method call sequence of a FreeformGraphicalRootEditPart object
it makes no sense for the initialization of a ScalableFreeformRootEditPart
object and subclasses of it. What happens is that in my createScaledLayers
method new layer objects are added under the PRINTABLE_LAYERS key that have
of course none of my displayed figures on, so when I print always a white
paper appears :)
Is this a GEF bug or must I use the framework differently? Will there be a
more stable API by Eclipse 2.1 ?
Thanks,
Chris
|
|
|
Re: getPrintableLayers() [message #68244 is a reply to message #68108] |
Tue, 04 March 2003 10:59  |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
> I have a special ScalableFreeformRootEditPart to get my nodes painted on
my
> connections, so I do something like this:
> protected ScalableFreeformLayeredPane createScaledLayers()
My first question would be why do you need to do this? If I understand you
correctly, you have labels that are probably in the middle of your
connection. If this is true, they can just be a child of the connection
which they label.
> {
> ScalableFreeformLayeredPane layers = new ScalableFreeformLayeredPane();
> layers.add(new ConnectionLayer(), CONNECTION_LAYER);
> FreeformLayer tmpPrimary = new FreeformLayer();
> tmpPrimary.setOpaque(false);
> layers.add(tmpPrimary, PRIMARY_LAYER);
> layers.add(getPrintableLayers(), PRINTABLE_LAYERS);
> return layers;
> }
>
Your primary layer must be a child of the printable layers. By looking at
your code, I can't tell what you are trying to do differently. You want the
connections under the primary layer? If so, you would override only:
protected LayeredPane createPrintableLayers() {
FreeformLayeredPane layeredPane = new FreeformLayeredPane();
layeredPane.add(new ConnectionLayer(), CONNECTION_LAYER);
layeredPane.add(new FreeformLayer(), PRIMARY_LAYER);
return layeredPane;
}
... swapping the order of the layers. I believe the primary layer is already
transparent. In the logic example, I think the contents (i.e. the diagram
editpart) is opaque.
> getPrintableLayers() calls createPrintableLayers(), where _new_ layer
> objects are added to a pane that is finally returned. As this seems to
make
> sense for the method call sequence of a FreeformGraphicalRootEditPart
object
> it makes no sense for the initialization of a ScalableFreeformRootEditPart
> object and subclasses of it. What happens is that in my createScaledLayers
> method new layer objects are added under the PRINTABLE_LAYERS key that
have
> of course none of my displayed figures on, so when I print always a white
> paper appears :)
If you print a figure that is scaled, its print size will be dependant on
the current zoom setting. That's why ScalableFreeformRootEditpart
introduces a new layered pane (for zooming) that is above the printable
layers, but within the outermost set of layers.
|
|
|
Powered by
FUDForum. Page generated in 0.02992 seconds