ConnectionLayer [message #142198] |
Fri, 09 July 2004 06:08  |
Eclipse User |
|
|
|
Originally posted by: sergeyv.offshorecreations.com
Hello
I need to draw figures on front layer and connections on back layer. The
default order of printable layers of ScalableFreeformRootEditPart is
PRIMARY_LAYER and then CONNECTION_LAYER. I changed the order of the layers
(see code below) but now my connections are invisible. Why?
public class MyRootEditPart extends ScalableFreeformRootEditPart {
protected LayeredPane createPrintableLayers() {
FreeformLayeredPane layeredPane = new FreeformLayeredPane();
layeredPane.add(new ConnectionLayer(), CONNECTION_LAYER);
layeredPane.add(new FreeformLayer(), PRIMARY_LAYER);
return layeredPane;
} //createPrintableLayers
} //class MyRootEditPart
--
With Best Regards
Vyunnikov Sergey
Offshore Creations, Inc.
www.OffshoreCreations.com
|
|
|
|
|
|
|
Re: ConnectionLayer [message #170176 is a reply to message #142643] |
Wed, 02 March 2005 07:53  |
Eclipse User |
|
|
|
Hello!
I ran into the same problem as Sergey did, unfortunately I still cannot see
my connections after having changed
primary and connection layer and I cannot see which layer or edit part is
still opaque.
In my ScalableRootEditPart extension, I overrode the following and changed
the layer order.
protected LayeredPane createPrintableLayers() {
LayeredPane pane = new LayeredPane();
Layer layer = new ConnectionLayer();
layer.setPreferredSize(new Dimension(5, 5));
layer.setBackgroundColor(MyColorConstants.COLOR_ORANGE);
pane.add(layer, CONNECTION_LAYER);
layer = new Layer();
layer.setOpaque(false);
layer.setBackgroundColor(MyColorConstants.COLOR_GREEN);
layer.setLayoutManager(new StackLayout());
pane.add(layer, PRIMARY_LAYER);
return pane;
}
Additionally, I added some System.out.println in the ScalableRootEditPart's
methods
getContents() and getContentPane() in order to get an output in case one of
the figures returned here are opaque.
public EditPart getContents() {
if (contents instanceof GraphicalEditPart) {
if (((GraphicalEditPart)contents).getFigure().isOpaque())
System.out.println("contents-figure is opaque");
}
return contents;
}
/* (non-Javadoc)
* @see org.eclipse.gef.GraphicalEditPart#getContentPane()
*/
public IFigure getContentPane() {
IFigure l = getLayer(PRIMARY_LAYER);
if(l.isOpaque())
System.out.println("layer is opaque");
return l;
}
None of these figures turn out to be opaque, so, something goes wrong with
my layer order ?
In my editor, things look like the following layer/edit parts order
(see also attached screenshots)
- gef_ng1.gif: I colored the layers - connection_layer: orange,
primary_layer:green (connections hidden)
(from top to bottom)
---
1) the model root element's children edit parts (except for the connections,
of course)
---
2) My Model Root Edit Part (which has no BGCOLOR and is not opaque) -
returned by ScalableRootEditPart#getContents()
----
3) PRIMARY_LAYER - what's returned by ScalableRootEditPart#getContentPane()
----
4) CONNECTION_LAYER (orange)
---
in gef_ng2.gif is the initial state with default order - bottom:
primary_layer, above: connection_layer -> connections above child edit
parts, I try to get them below th child edit parts...
I wonder, how I can get the primary layer (3) opaque (isn't it opaque when
my System.outs coding is never reached?).
Actually, I want the connections between 1) and 2)
Or did I misunderstand sth. and 2) is equals 3) ? Anyway, does anyone of you
see where's my problem?
Thanks a lot and best regards,
Marion
"Pratik Shah" <ppshah@us.ibm.com> wrote in message
news:cd1ds9$s7e$1@eclipse.org...
> On what figure did you invoke setOpaque(false)? The figure returned by
your
> base EditPart needs to be transparent as well, not just the layer.
>
> "Sergey Vyunnikov" <sergeyv@offshorecreations.com> wrote in message
> news:ccm4og$o32$1@eclipse.org...
> > The function setOpaque(false) does not solve this problem.
> > --
> > With Best Regards
> > Vyunnikov Sergey
> >
> > Offshore Creations, Inc.
> > www.OffshoreCreations.com
> >
> >
> > <rlemaigr@ulb.ac.be> wrote in message
> > news:opsavdqqkoxn9g2u@xn--pcrgis-dva.mshome.net...
> > Hello,
> >
> > Maybe the background figure of the primary layer was opaque and when you
> > switch the layers it hides the connection layer ?
> > I looks to simple to be true but who knows...
> >
> > r
Attachment: gef_ng2.gif
(Size: 4.27KB, Downloaded 98 times)
Attachment: gef_ng1.gif
(Size: 3.07KB, Downloaded 104 times)
|
|
|
Powered by
FUDForum. Page generated in 0.23754 seconds