Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [gef-dev] How to redraw a Connection

Hi,

I guess you can try out the following if you haven't already given it a shot.
In the propertyChange method of transition edit part depending upon the property change call the refreshVisuals method. Override the method refreshVisuals in transition edit part and make whatever viewer level changes you wish to make, It should work out.

On a very high level you can take a leaf out of how bendpoints are reflected on the UI wherein setting the Routing Constraint in refresh Visuals with the latest list of bendpoints reflects the newly added/ deleted bendpoints.

Thanks and Regards,
Siddharth
On 9/21/06, Alessandro Negri <negri@xxxxxxxxxxx> wrote:
Hi all,
i'm developing a multipage Editor using GEF.
I have some blocks connected through standard Connection objects, in
particular I have a TransitionEditPart that extends
AbstractConnectionEditPart.
The TransitionEditPart draws a Polyline connection as follows:

PolylineConnection c = new PolylineConnection();
setLineAppearence(c);
c.setConnectionRouter(new ManhattanConnectionRouter());
// Creates a tooltip with the transition ID
tooltip = new Label("  "+host.getID()+"  ");
tooltip.setOpaque(true);
c.setToolTip(tooltip);
c.setTargetDecoration(new PolylineDecoration());
return c;

The problem is that I have 5 types of transitions and everyone has its own
color and appearence (I set this with the setLineAppearence method). The
TransitionEditPart is associated to a PropertySheet that shows its type.
When I change the type in the Property View, I update the model and then
fire a property change event, caught by the propertyChange method of my
TransitionEditPart.
So...the question: how can I force the Connection to be redrawn? I tried all
the repaint, revalidate, refresh methods, but the visual aspect of the edit
part never changes according to the the modified property. I think that a
solution could be to delete the Connection and then redraw it, but I'm not
able to do that...

Any suggestion?

In general which is the best way to do a graphical refresh of an Edit Part
after a property change event? My solution in other cases was to
delete/add/refresh the part...

Thanks in advance,
        Alessandro

_______________________________________________
gef-dev mailing list
gef-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/gef-dev



--
Thanks,
Siddharth

Back to the top