Package lu.kbra.modelizer_next.ui.frame
Class DocumentSession
java.lang.Object
lu.kbra.modelizer_next.ui.frame.DocumentSession
Open document session containing the document, its file path, and dirty state.
-
Constructor Summary
ConstructorsConstructorDescriptionDocumentSession(ModelDocument document) Creates a document session instance.DocumentSession(ModelDocument document, File currentFile) Creates a document session instance. -
Method Summary
Modifier and TypeMethodDescriptionbooleancanRedo()Checks whether this object can redo.booleancanUndo()Checks whether this object can undo.Returns the current file.Returns the document.booleanisDirty()Checks whether dirty is enabled or applies.voidMarks the current document session as changed.voidMarks the current document session as saved.booleanredo()Restores the next snapshot in the redo history.toString()Builds a debug string for this document session.booleanundo()Restores the previous snapshot in the undo history.
-
Constructor Details
-
DocumentSession
Creates a document session instance.- Parameters:
document- document to read or modify
-
DocumentSession
Creates a document session instance.- Parameters:
document- document to read or modifycurrentFile- file to read or write
-
-
Method Details
-
canRedo
public boolean canRedo()Checks whether this object can redo.- Returns:
trueif the operation is allowed; otherwisefalse
-
canUndo
public boolean canUndo()Checks whether this object can undo.- Returns:
trueif the operation is allowed; otherwisefalse
-
getCurrentFile
Returns the current file.- Returns:
- the current file
-
getDocument
Returns the document.- Returns:
- the document
-
isDirty
public boolean isDirty()Checks whether dirty is enabled or applies.- Returns:
trueif dirty is enabled or applies; otherwisefalse
-
markChanged
public void markChanged()Marks the current document session as changed. -
markSaved
Marks the current document session as saved.- Parameters:
file- file to read or write
-
redo
public boolean redo()Restores the next snapshot in the redo history.- Returns:
truewhen the condition is met; otherwisefalse
-
toString
Builds a debug string for this document session. -
undo
public boolean undo()Restores the previous snapshot in the undo history.- Returns:
truewhen the condition is met; otherwisefalse
-