Package lu.kbra.modelizer_next.ui.frame
Class DocumentSessionLoader
java.lang.Object
lu.kbra.modelizer_next.ui.frame.DocumentSessionLoader
Loads, imports, and creates document sessions for the main frame.
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanconfirmModernDocumentVersion(Component parent, ModelDocument loadedDocument) Confirms whether the document should be loaded even if it has been written in a newer version of the software.static booleanconfirmModernDocumentVersion(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 givenDocumentLoadHandler.static Optional<DocumentSession> createDocument(Component parent, File selectedFile) Loads a document from a files, supportsmod,mdlz,mnfile extensions.static Optional<DocumentSession> createDocument(File selectedFile, DocumentLoadHandler handler) Loads a document from a files, supportsmod,mdlz,mnfile extensions.
-
Method Details
-
confirmModernDocumentVersion
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 ownershiploadedDocument- loaded document value used by the operation- Returns:
trueif it is an older version or a newer one and the user acknowledged; otherwisefalse
-
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 givenDocumentLoadHandler.- Parameters:
loadedDocument- loaded document value used by the operationhandler- handler value used by the operation- Returns:
truewhen the condition is met; otherwisefalse
-
createDocument
Loads a document from a files, supportsmod,mdlz,mnfile extensions. Uses theSwingDocumentLoadHandlerby default.- Parameters:
parent- parent component used for dialog ownershipselectedFile- 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, supportsmod,mdlz,mnfile extensions.- Parameters:
selectedFile- file to read or writehandler- handler value used by the operation- Returns:
- the created document
-