Skip to main content

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

Thanks Siddharth, all works fine as you say...but not the last point.
In refreshVisuals I call getFigure().repaint() (the TransitionEditPart), but
nothing happens to the view. How can I "update" it?

Sorry, but I tried every method with any result...

-----Messaggio originale-----
Da: gef-dev-bounces@xxxxxxxxxxx [mailto:gef-dev-bounces@xxxxxxxxxxx] Per
conto di Siddharth Shankar
Inviato: giovedì 21 settembre 2006 15.30
A: GEF development
Oggetto: Re: R: [gef-dev] How to redraw a Connection

Hi,
Well some how i cant comprehend why making the changes in refreshVisuals is
not working out for you. Try one other way out though I am not sure if that
is the best possible way but this would work.
Whenever you make change in the model, make a call to
firePropertyChange(propname, oldValue, newValue) [Here I am assuming your
model has a PropertyChangeSupport attached to it]. Now in your edit part's
propertyChange method when the designated prop name is fired, conditionally
call refreshVisuals and this should work. In refreshVisuals do a getFigure
and update whichever view level components u have. It definitely works for
me and hope it does for you too.:-) 

Thanks,
Siddharth


On 9/21/06, Alessandro Negri <negri@xxxxxxxxxxx> wrote:

	I'm just doing like this: in my refreshVisuals method I change the
aspect of
	the PolylineConnection associated to the EditPart, but this doesn't
reflect
	in a visual change of the line. I need to force a redraw of the
view, but I 
	don't know how. I tried getFigure().repaint or
getFigure().revalidate(), but
	nothing changes.
	So, the model is updated, the line associated to the Edit Part is
updated,
	but the line doesn't change its aspect. I think I need to
delete/add/refresh 
	the part but I don't know how!?!?
	
	Regards,
	        Alessandro
	
	-----Messaggio originale-----
	Da: gef-dev-bounces@xxxxxxxxxxx [mailto: gef-dev-bounces@xxxxxxxxxxx
<mailto:gef-dev-bounces@xxxxxxxxxxx> ] Per
	conto di Siddharth Shankar
	Inviato: giovedì 21 settembre 2006 10.27
	A: GEF development
	Oggetto: 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 <mailto:gef-dev@xxxxxxxxxxx> 
	        https://dev.eclipse.org/mailman/listinfo/gef-dev
	
	
	
	
	
	--
	Thanks,
	Siddharth
	
	_______________________________________________ 
	gef-dev mailing list
	gef-dev@xxxxxxxxxxx
	https://dev.eclipse.org/mailman/listinfo/gef-dev
	




-- 
Thanks,
Siddharth 



Back to the top