Class DocumentSession

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

public final class DocumentSession extends Object
Open document session containing the document, its file path, and dirty state.
  • Constructor Details

    • DocumentSession

      public DocumentSession(ModelDocument document)
      Creates a document session instance.
      Parameters:
      document - document to read or modify
    • DocumentSession

      public DocumentSession(ModelDocument document, File currentFile)
      Creates a document session instance.
      Parameters:
      document - document to read or modify
      currentFile - file to read or write
  • Method Details

    • canRedo

      public boolean canRedo()
      Checks whether this object can redo.
      Returns:
      true if the operation is allowed; otherwise false
    • canUndo

      public boolean canUndo()
      Checks whether this object can undo.
      Returns:
      true if the operation is allowed; otherwise false
    • getCurrentFile

      public File getCurrentFile()
      Returns the current file.
      Returns:
      the current file
    • getDocument

      public ModelDocument getDocument()
      Returns the document.
      Returns:
      the document
    • isDirty

      public boolean isDirty()
      Checks whether dirty is enabled or applies.
      Returns:
      true if dirty is enabled or applies; otherwise false
    • markChanged

      public void markChanged()
      Marks the current document session as changed.
    • markSaved

      public void markSaved(File file)
      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:
      true when the condition is met; otherwise false
    • toString

      public String toString()
      Builds a debug string for this document session.
      Overrides:
      toString in class Object
      Returns:
      a debug string for this object
    • undo

      public boolean undo()
      Restores the previous snapshot in the undo history.
      Returns:
      true when the condition is met; otherwise false