Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[gef-dev] EditPart and AbstractEditPart API simplification


These changes should not affect most clients if they were using the old API correctly.

Currently AbstractEditPart checks in several places to see when it should "initialize", meaning build its children, connections, etc., by calling refresh().  Also, it registers itself in setParent() if the parent is not null, but it does not unregister itself in the same place.  This is not very symmetric.

EditPart currently has a dipose() method which is used to mean that "the EditPart is being removed from the Viewer".  This method is *only* called when the EditPart is removed from the Viewer, and is *not* called when the Viewer is not longer being used.  So dispose is probably a misleading name.

The API is changing in the following ways.  AbstractEditPart will not repeatedly check when it should initialize, it will be told using the new method addNotify().
addNotify() is called by the parent at the proper time.
dispose() is renamed to removeNotify().

The result is that we now have two methods that are clearly inverses and are symnetric.  Also, their names are consistent with other frameworks, like draw2d and AWT, and the names do not suggest some other meaning.
AbstractEditPart loses "shouldInitialize()" and "initialize()", and the old "doInitialize()" becomes "addNotify()".  "register()" is called in addNotify(), and unregister() is called in removeNotify().

-Randy

Back to the top