Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [tools-dev] [GEF] I am missing an addListener-Method...

The figure should not know about the EditPart nor the model.  Think of the
Figure as a TreeItem.

In activate(), your EditPart should add listener(s) to the model.  When the
model changes, it should call refreshSourceConnections based on the type of
change.  I don't think you will need to override refreshSourceConnections,
just getModelSourceConnections().

If you have the slightly more complex case where your connection is
displaying information that is not part of its model, or there is no real
model object for the connection itself, then the ConnectionEditPart should
be listening to the model nodes at its ends.

see:
LogicEditPart.activate()
LogicEditPart.getModelSourceConnections()
LogicSubpart.connectInput(Wire)
ConnectionCommand

Note that the command only knows about the model, and that a plain
PolylineConnection is used as the figure.



                                                                                                                                                    
                      "Thilo                                                                                                                        
                      Schwidurski"             To:       <tools-dev@xxxxxxxxxxx>                                                                    
                      <thilo.s@xxxxxx>         cc:                                                                                                  
                      Sent by:                 Subject:  Re: [tools-dev] [GEF] I am missing an addListener-Method...                                
                      tools-dev-admin@e                                                                                                             
                      clipse.org                                                                                                                    
                                                                                                                                                    
                                                                                                                                                    
                      05/14/2002 10:50                                                                                                              
                      AM                                                                                                                            
                      Please respond to                                                                                                             
                      tools-dev                                                                                                                     
                                                                                                                                                    
                                                                                                                                                    




----- Original Message -----
From: "Randy Hudson" <hudsonr@xxxxxxxxxx>
To: <tools-dev@xxxxxxxxxxx>
Sent: Tuesday, May 14, 2002 3:47 PM
Subject: Re: [tools-dev] [GEF] I am missing an addListener-Method...


> I don't see why the EditPart needs to notify anything about its
> nodes/anchors.
> Generally the EditPart should *listen*, and the model
> should notify about its properties changing.

Sure, the question here is only how this changes are propagated further to
the view (figure).

Should I better overwrite
AbstractGraphicalEditPart#refreshSourceConnections
and don't use the (imo convenient) event-notification mechanism that is
implemented in the subsequently called methods?

Or directly attach the figure (view) as Propertychange-Listener to the
model
("in parallel" to the EditPart)? (I dont think so).

Regards, Thilo.


_______________________________________________
tools-dev mailing list
tools-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/tools-dev





Back to the top