Class DocumentSessionLoader

java.lang.Object
lu.kbra.modelizer_next.ui.frame.DocumentSessionLoader

public final class DocumentSessionLoader extends Object
Loads, imports, and creates document sessions for the main frame.
  • Method Details

    • confirmModernDocumentVersion

      public static boolean confirmModernDocumentVersion(Component parent, ModelDocument loadedDocument)
      Confirms whether the document should be loaded even if it has been written in a newer version of the software.
      Parameters:
      parent - parent component used for dialog ownership
      loadedDocument - loaded document value used by the operation
      Returns:
      true if it is an older version or a newer one and the user acknowledged; otherwise false
    • confirmModernDocumentVersion

      public static boolean confirmModernDocumentVersion(ModelDocument loadedDocument, DocumentLoadHandler handler)
      Confirms whether the document should be loaded even if it has been written in a newer version of the software, using the given DocumentLoadHandler.
      Parameters:
      loadedDocument - loaded document value used by the operation
      handler - handler value used by the operation
      Returns:
      true when the condition is met; otherwise false
    • createDocument

      public static Optional<DocumentSession> createDocument(Component parent, File selectedFile)
      Loads a document from a files, supports mod, mdlz, mn file extensions. Uses the SwingDocumentLoadHandler by default.
      Parameters:
      parent - parent component used for dialog ownership
      selectedFile - file to read or write
      Returns:
      the created document
    • createDocument

      public static Optional<DocumentSession> createDocument(File selectedFile, DocumentLoadHandler handler)
      Loads a document from a files, supports mod, mdlz, mn file extensions.
      Parameters:
      selectedFile - file to read or write
      handler - handler value used by the operation
      Returns:
      the created document