Interface EditableSModel

  • All Superinterfaces:
    SModel

    public interface EditableSModel
    extends SModel
    Model deemed for editing. Dispatches change events.
    See Also:
    evgeny, 2/14/13
    • Method Detail

      • isChanged

        boolean isChanged()
      • setChanged

        void setChanged​(boolean changed)
      • save

        default CompletionStage<SaveResult> save​(@NotNull
                                                 SaveOptions options)
        Parameters:
        options - describe how to behave in case of conflict where 'conflict' is the scenario when we save a changed model ({isChanged()} is true) and it happens that {needsReloading()} is true.
        Returns:
        a CompletionStage with the result inside. yes, the save might not happen right away after the invocation, for example if there is a conflict with data source ({needsReloading() returned true} and the implementor might overwrite the data coming from the data source which is not good (losing data is never good). Realistically in 2020.3 this is the only case when the result is async, but still. Perhaps, the api could be more solid with all the {needsReloading()} logic happening outside of EditableSModel implementations (@see EditableSModelBase#areThereAnyConflictsOnSave). But as always I doubt that changing the semantics of such a popular method is the right way
      • rename

        void rename​(@NotNull
                    String newModelName,
                    boolean changeFile)
        fixme ! I do not understand this API, why can we rename model here but other kind of changes we do not see (like #addRootNode for example)
        Parameters:
        changeFile - I do not like either it must be generalized or moved to a lower level (where files data sources are in place)
      • needsReloading

        boolean needsReloading()
      • reloadFromSource

        void reloadFromSource()
        reloads the model from the storage SModel.getSource() the current model changes (isChanged()) might be lost as a result fixme why it is so not symmetric to save()?