Skip to main content



      Home
Home » Eclipse Projects » GEF » Adding captions for a flow(continue)
Adding captions for a flow(continue) [message #13819] Wed, 17 July 2002 21:23 Go to next message
Eclipse UserFriend
I am sorry by pressing the wrong to post it, and here I continues,

But the problems is that this method sometime works. While for sometime,
the child figure is not completely drawn. First I thought the reason might
be a child figure's bounds cannot exceeds its parent's bounds, but the
caption after cut is not in the parent(Flow figure)'s bounds area either.
And whenever I select the flow in the canvas, the caption get painted
completely without any problem.

So my question is ?
Is this a problem of Draw2d? And is there any other convienent way of
adding caption for a flow, and the caption should be able to exceed the
flow's bound area ?

Thank you.
Re: Adding captions for a flow(continue) [message #13835 is a reply to message #13819] Wed, 17 July 2002 22:05 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.ibm.com

"Joe" <zhujun@cn.ibm.com> wrote in message
news:ah55aq$2t4$1@rogue.oti.com...
> I am sorry by pressing the wrong to post it, and here I continues,
>
> But the problems is that this method sometime works. While for sometime,
> the child figure is not completely drawn. First I thought the reason might
> be a child figure's bounds cannot exceeds its parent's bounds, but the
> caption after cut is not in the parent(Flow figure)'s bounds area either.
> And whenever I select the flow in the canvas, the caption get painted
> completely without any problem.
>
> So my question is ?
> Is this a problem of Draw2d? And is there any other convienent way of
> adding caption for a flow, and the caption should be able to exceed the
> flow's bound area ?

What is a flow? Are you using an additional framework with GEF?

> 2) In the paintFigure method, set the position of the Label with the
> following code,

*nothing* should change during a paint operation. You should not be moving
figures or changing anything about the figure from within the various paint
methods.
Re: Adding captions for a flow(continue) [message #13959 is a reply to message #13835] Wed, 17 July 2002 23:27 Go to previous messageGo to next message
Eclipse UserFriend
Here \"flow\" means a Connection (PolylineConnection) Figure, and I set a
Label as the child of this Connection by calling connection.add(label).
The function I want to have now is that the label should always be at the
center of the connecton\'s bound area, so I need to change the bounds of
the label whenever the

So I am just moving the child figure of a connection figure within the
paintFigure method of this connection figure, I don\'t know if it is
allowed. Because I noticed the paintChildren() is called after the
paintFigure method and I set the caption\'s bound at the very beginning of
the paintFigure method, so I don\'t know whehter it would work.

I tried to set the bounds in the ConnectionEditPart\'s refreshVisual
method, only to find the method never get called before the paint() method
of the figure is called, so maybe the painting of figures are controlled
by the ConnectionLayer.

Randy Hudson wrote:


> \"Joe\" <zhujun@cn.ibm.com> wrote in message
> news:ah55aq$2t4$1@rogue.oti.com...
> > I am sorry by pressing the wrong to post it, and here I continues,
> >
> > But the problems is that this method sometime works. While for sometime,
> > the child figure is not completely drawn. First I thought the reason might
> > be a child figure\'s bounds cannot exceeds its parent\'s bounds, but the
> > caption after cut is not in the parent(Flow figure)\'s bounds area either.
> > And whenever I select the flow in the canvas, the caption get painted
> > completely without any problem.
> >
> > So my question is ?
> > Is this a problem of Draw2d? And is there any other convienent way of
> > adding caption for a flow, and the caption should be able to exceed the
> > flow\'s bound area ?

> What is a flow? Are you using an additional framework with GEF?

> > 2) In the paintFigure method, set the position of the Label with the
> > following code,

> *nothing* should change during a paint operation. You should not be moving
> figures or changing anything about the figure from within the various paint
> methods.
Re: Adding captions for a flow(continue) [message #13961 is a reply to message #13959] Thu, 18 July 2002 00:23 Go to previous messageGo to next message
Eclipse UserFriend
Joe,

You should use a ConnectionLocator, specifically the MidpointLocator, when you
add the Label to the connection.

connection.add(label, new MidpointLocator(connection, 0));

This will keep the label in the center of the connection. The 0 in the
MidpointLocator constructor above is the index of the first of the two points
that the label will be centered between. In other words, if you have a
connection with no bendpoints, this will place the label in the center of the
connection. If the connection does have bendpoints, you can center the label on
any of the line segments.

Eric


"Joe" <zhujun@cn.ibm.com> wrote in message news:ah5cis$5m2$1@rogue.oti.com...
> Here \"flow\" means a Connection (PolylineConnection) Figure, and I set a
> Label as the child of this Connection by calling connection.add(label).
> The function I want to have now is that the label should always be at the
> center of the connecton\'s bound area, so I need to change the bounds of
> the label whenever the
>
> So I am just moving the child figure of a connection figure within the
> paintFigure method of this connection figure, I don\'t know if it is
> allowed. Because I noticed the paintChildren() is called after the
> paintFigure method and I set the caption\'s bound at the very beginning of
> the paintFigure method, so I don\'t know whehter it would work.
>
> I tried to set the bounds in the ConnectionEditPart\'s refreshVisual
> method, only to find the method never get called before the paint() method
> of the figure is called, so maybe the painting of figures are controlled
> by the ConnectionLayer.
>
> Randy Hudson wrote:
>
>
> > \"Joe\" <zhujun@cn.ibm.com> wrote in message
> > news:ah55aq$2t4$1@rogue.oti.com...
> > > I am sorry by pressing the wrong to post it, and here I continues,
> > >
> > > But the problems is that this method sometime works. While for sometime,
> > > the child figure is not completely drawn. First I thought the reason might
> > > be a child figure\'s bounds cannot exceeds its parent\'s bounds, but the
> > > caption after cut is not in the parent(Flow figure)\'s bounds area either.
> > > And whenever I select the flow in the canvas, the caption get painted
> > > completely without any problem.
> > >
> > > So my question is ?
> > > Is this a problem of Draw2d? And is there any other convienent way of
> > > adding caption for a flow, and the caption should be able to exceed the
> > > flow\'s bound area ?
>
> > What is a flow? Are you using an additional framework with GEF?
>
> > > 2) In the paintFigure method, set the position of the Label with the
> > > following code,
>
> > *nothing* should change during a paint operation. You should not be moving
> > figures or changing anything about the figure from within the various paint
> > methods.
>
>
>
>
>
Re: Adding captions for a flow(continue) [message #13974 is a reply to message #13959] Thu, 18 July 2002 09:26 Go to previous message
Eclipse UserFriend
Originally posted by: none.ibm.com

When a Figure is painted, the GC is clipped to the figures bounds by its
parent (the connection layer). So obviously it is too late to move the
figure during the paint call, and update your bounds. That is why we have
validate() which is called first on all figures to make sure they are happy
with their locations, and then everything gets painted.

I believe the Locator Eric mentions is demonstrated in one of the demos in
the Draw2d Reference plugin.

"Joe" <zhujun@cn.ibm.com> wrote in message
news:ah5cis$5m2$1@rogue.oti.com...
> Here \"flow\" means a Connection (PolylineConnection) Figure, and I set a
> Label as the child of this Connection by calling connection.add(label).
> The function I want to have now is that the label should always be at the
> center of the connecton\'s bound area, so I need to change the bounds of
> the label whenever the
>
> So I am just moving the child figure of a connection figure within the
> paintFigure method of this connection figure, I don\'t know if it is
> allowed. Because I noticed the paintChildren() is called after the
> paintFigure method and I set the caption\'s bound at the very beginning of
> the paintFigure method, so I don\'t know whehter it would work.
>
> I tried to set the bounds in the ConnectionEditPart\'s refreshVisual
> method, only to find the method never get called before the paint() method
> of the figure is called, so maybe the painting of figures are controlled
> by the ConnectionLayer.
>
> Randy Hudson wrote:
>
>
> > \"Joe\" <zhujun@cn.ibm.com> wrote in message
> > news:ah55aq$2t4$1@rogue.oti.com...
> > > I am sorry by pressing the wrong to post it, and here I continues,
> > >
> > > But the problems is that this method sometime works. While for
sometime,
> > > the child figure is not completely drawn. First I thought the reason
might
> > > be a child figure\'s bounds cannot exceeds its parent\'s bounds, but
the
> > > caption after cut is not in the parent(Flow figure)\'s bounds area
either.
> > > And whenever I select the flow in the canvas, the caption get painted
> > > completely without any problem.
> > >
> > > So my question is ?
> > > Is this a problem of Draw2d? And is there any other convienent way of
> > > adding caption for a flow, and the caption should be able to exceed
the
> > > flow\'s bound area ?
>
> > What is a flow? Are you using an additional framework with GEF?
>
> > > 2) In the paintFigure method, set the position of the Label with the
> > > following code,
>
> > *nothing* should change during a paint operation. You should not be
moving
> > figures or changing anything about the figure from within the various
paint
> > methods.
>
>
>
>
>
Previous Topic:Adding captions for a flow
Next Topic:dynamic actions
Goto Forum:
  


Current Time: Fri May 09 16:41:19 EDT 2025

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

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

Back to the top