Skip to main content

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

Hi,

You don't ned to have your own repaint method. I'll try to give you a step by step account of how can you go ahead and make the changes in the connection model reflect on to the connection figure (say a polyline connection)

Make the change in the Model (typically change the model in a Command)
The model method having this change should have its own fire property change method
now this property change event should be caught in Connection Edit part
In Connection Edit Part depending on the property change do a getFigure and make whatever view level changes u want to make. Don't do anything else

example
say your model fires a event CHANGE_CONN_COLOR
In your edit part propertyChange method do a
getFigure.setForegroundColor(fg) where "fg" is the changed color
when the property name is CHANGE_CONN_COLOR

Does the above steps work differenly for you?

Thanks,
Siddharth

On 9/22/06, Alessandro Negri <negri@xxxxxxxxxxx> wrote:
Thank you so much for your help...I call the superclass repaint method by
this way: getFigure().repaint()!
Do you think I need to do my own repaint method? What I need to do in my
repaint method to correctly redraw my PolyLineConnection?

Thanks in advance, this is very important for me :-)

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

What exactly are you doing in your repaint method which u say is not getting
updated?
I'll try that stuff for a model change in one of my own PolyLineConnection
and let you know if I was able to do it successfully but any more replies
from me only tomorrow now:-)


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

        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
<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
<mailto: 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
<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
<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
< https://dev.eclipse.org/mailman/listinfo/gef-dev>





        --
        Thanks,
        Siddharth

        _______________________________________________
        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