Class SModelListenerBase

    • Constructor Detail

      • SModelListenerBase

        public SModelListenerBase()
    • Method Detail

      • conflictDetected

        public void conflictDetected​(SModel model)
        Description copied from interface: SModelListener
        This event is fired when the storage-memory conflict is detected (== isChanged() && needsReloading()). An IDE can listen to it and give user a way to resolve the conflict by invoking either updateTimestamp(), or reloadFromSource().
        Specified by:
        conflictDetected in interface SModelListener
      • modelAttached

        public void modelAttached​(SModel model,
                                  SRepository repository)
        Description copied from interface: SModelListener
        Fired when a model becomes visible in a repository.

        IMPORTANT: it's unspecified whether the model is part of a module the moment this event is fired or not. Do not expect SModel.getModule() to give meaningful value. This contract may change (i.e. become stricter) in future.

        NOTE: This is not an event most clients could make use of, as it's technically tricky to attach a listener to a model not yet visible inside a repository, and thus it's more of internal mechanism (i.e. code that instantiates a model may attach a listener to not yet published model and thus get notified). Besides, detached models do not get their listeners automatically discarded, and the listeners get a chance to react to model detach/re-attach sequence with this event.

        Specified by:
        modelAttached in interface SModelListener
        Parameters:
        model - affected model, never null
        repository - repository the model become available at, never null
      • modelDetached

        public void modelDetached​(SModel model,
                                  SRepository repository)
        Description copied from interface: SModelListener
        Fired when a model is no longer part of a repository, e.g. due to removal from module. This event is intended to clean-up listener caches associated with the model and to gracefully unregister other listeners.

        IMPORTANT: it's unspecified whether the model is part of a module the moment this event is fired or not. Do not expect SModel.getModule() to give meaningful value. This contract may change (i.e. become stricter) in future.

        Primary drive force for this event is desire to add model listener only, without a need to listen to module events to find out when the model is no longer available.

        Note, listeners not unregistered from the model would get notified with SModelListener.modelAttached(SModel, SRepository) in case detached model is brought back (perhaps, in completely different module and repository).

        Specified by:
        modelDetached in interface SModelListener
        Parameters:
        model - affected model, never null
        repository - repository the model become available at, never null