Home » Eclipse Projects » GEF » How to refresh/redraw the whole of the container edit part
How to refresh/redraw the whole of the container edit part [message #170696] |
Sun, 06 March 2005 07:13  |
Eclipse User |
|
|
|
Hi all
I draw a line on the container editpart, and place right besides it another
edit part (this line marks the margin of the editing area). If i move the
edit part right or left, the line should be re-drawn accordingly, and remain
attached to left to the edit part. So far, if i move the edit part, only the
portion of the line that actually touched the edit part is re-drawn, this
results in a broken line. Is there a way to refresh the whole of the
appearance of the container editpart so that the all of the line would be
re-drawn?
thanks
Yoav
|
|
|
Re: How to refresh/redraw the whole of the container edit part [message #170743 is a reply to message #170696] |
Mon, 07 March 2005 03:09   |
Eclipse User |
|
|
|
Originally posted by: no.mail.please
You should refresh the whole container in its refreshVisuals() method.
There, you can redraw the line at the exact position. This should work,
I use it in a gef editor to draw a blue rectangle at an exact position
of the container editpart.
--
Arnaud
PS :
I notice I use this piece of code in my refreshVisuals() (at the
beginning of it), which is taken from the ShapesDiagram example :
// notify parent container of changed position & location
// if this line is removed, the XYLayoutManager used by the parent
container
// (the Figure of the ShapesDiagramEditPart), will not know the bounds
of this figure
// and will not draw it correctly.
Rectangle bounds = new Rectangle(getCastedModel().getLocation(),
getCastedModel().getSize());
Maybe you should have a look at this if you encounter strange problems
with my solution.
Yoav Rubin a écrit :
> Hi all
> I draw a line on the container editpart, and place right besides it another
> edit part (this line marks the margin of the editing area). If i move the
> edit part right or left, the line should be re-drawn accordingly, and remain
> attached to left to the edit part. So far, if i move the edit part, only the
> portion of the line that actually touched the edit part is re-drawn, this
> results in a broken line. Is there a way to refresh the whole of the
> appearance of the container editpart so that the all of the line would be
> re-drawn?
> thanks
> Yoav
>
>
|
|
| | |
Re: How to refresh/redraw the whole of the container edit part [message #178785 is a reply to message #178719] |
Thu, 21 April 2005 17:19   |
Eclipse User |
|
|
|
Hmm, I didn't even know there was an erase() method on Figure....
It seems that that method will erase the child from the old location, but
still not draw it in the new one.
Also, the best way to do what Rubin mentioned in this thread is to have the
line editpart's model be updated (either by the command, or the line model
can listen to the other model for bounds changes). Then, it's business as
usual: line model notifies line editpart of the change, and line editpart
updates the constraint which would cause it to be repainted.
"Kevin" <kevinlouisnospam@hotmail.com> wrote in message
news:d48tnt$2us$1@news.eclipse.org...
> Can it call child.erase()? It causes the parent to repaint.
>
> "Pratik Shah" <ppshah@us.ibm.com> wrote in message
> news:d0j909$803$1@www.eclipse.org...
> > Have the child edit part, when it is moved or resized, call repaint() on
> the
> > parent container's figure. Or the parent can listen for this change on
> the
> > child and do that itself.
> >
> > "Yoav Rubin" <yoav@il.ibm.com> wrote in message
> > news:d0es5t$ku7$1@www.eclipse.org...
> > > Hi all
> > > I draw a line on the container editpart, and place right besides it
> > another
> > > edit part (this line marks the margin of the editing area). If i move
> the
> > > edit part right or left, the line should be re-drawn accordingly, and
> > remain
> > > attached to left to the edit part. So far, if i move the edit part,
only
> > the
> > > portion of the line that actually touched the edit part is re-drawn,
> this
> > > results in a broken line. Is there a way to refresh the whole of the
> > > appearance of the container editpart so that the all of the line would
> be
> > > re-drawn?
> > > thanks
> > > Yoav
> > >
> > >
> >
> >
>
>
|
|
|
Re: How to refresh/redraw the whole of the container edit part [message #179036 is a reply to message #170696] |
Mon, 25 April 2005 10:06  |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
> I draw a line on the container editpart,
I read the thread and still don't understand this part. Are you adding a
Polyline, painting inside the figure's paint method, or painting on the
canvas itself?
If you are using a Polyline, call setPoints(), don't just get the points and
modify them.
|
|
|
Goto Forum:
Current Time: Wed Jul 16 17:02:50 EDT 2025
Powered by FUDForum. Page generated in 0.04564 seconds
|