/** * Adds dependency of the presenter on one that is registered on a specified component under a specified presenter class. * The presenter instance is resolved dynamically. Therefore when a component changes its presenter instances, * this dependency is still working. * <p/> * Note: This method could be called from notifyAttached method only. * @param component the component * @param presenterClass the presenter class */ protected final void addDependency (DesignComponent component, Class<? extends Presenter> presenterClass) { assert state == State.ADDING_DEPENDENCIES; if (listener == null) listener = new Listener (); component.getDocument ().getListenerManager ().addPresenterListener (component, presenterClass, listener); }