Class MainFrame

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, RootPaneContainer, WindowConstants, MainFrameDocumentController, MainFrameStyleController, MainFrameWindowController

Main Swing window for editing Modelizer Next documents.
See Also:
  • Field Details

    • CTRL_MODIFIER

      public static final int CTRL_MODIFIER
    • ICON

      public static final Image ICON
    • IMAGE_ICON

      public static final ImageIcon IMAGE_ICON
    • ICON_IMAGES

      public static final List<Image> ICON_IMAGES
  • Constructor Details

  • Method Details

    • confirmModernDocumentVersion

      public static boolean confirmModernDocumentVersion(Component parent, ModelDocument loadedDocument)
      Confirms whether the modern document version should continue.
      Parameters:
      parent - parent component used for dialog ownership
      loadedDocument - loaded document value used by the operation
      Returns:
      true when the condition is met; otherwise false
    • confirmModernDocumentVersion

      public static boolean confirmModernDocumentVersion(ModelDocument loadedDocument, DocumentLoadHandler handler)
      Confirms whether the modern document version should continue.
      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)
      Creates a document.
      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)
      Creates a document.
      Parameters:
      selectedFile - file to read or write
      handler - handler value used by the operation
      Returns:
      the created document
    • applyDefaultPaletteToCanvases

      public void applyDefaultPaletteToCanvases()
      Applies the default palette to all canvases.
    • getActiveCanvas

      public DiagramCanvas getActiveCanvas()
      Returns the active canvas, defaults to the conceptual one.
      Returns:
      the active canvas
    • getCanvases

      public List<DiagramCanvas> getCanvases()
      Returns the canvases.
      Returns:
      the canvases
    • getCanvasesByPanelType

      public Map<PanelType,DiagramCanvas> getCanvasesByPanelType()
      Returns the canvases by panel type.
      Returns:
      the canvases by panel type
    • getDocument

      public ModelDocument getDocument()
      Description copied from interface: MainFrameDocumentController
      Returns the document.
      Specified by:
      getDocument in interface MainFrameDocumentController
      Returns:
      the document
    • getSession

      public DocumentSession getSession()
      Description copied from interface: MainFrameDocumentController
      Returns the session.
      Specified by:
      getSession in interface MainFrameDocumentController
      Returns:
      the session
    • loadDocument

      public boolean loadDocument(File selectedFile)
      Loads the document from a file.
      Parameters:
      selectedFile - file to read or write
      Returns:
      true if the document was successfully loaded; otherwise false
    • openInFrame

      public void openInFrame(DocumentSession session)
      Overwrites the frame content with the new document session.
      Specified by:
      openInFrame in interface MainFrameDocumentController
      Parameters:
      session - document session to read or modify
    • refreshFrameTitle

      public void refreshFrameTitle()
      Refreshes the frame title from the current state.
      Specified by:
      refreshFrameTitle in interface MainFrameDocumentController
    • updateUndoRedoMenuItems

      public void updateUndoRedoMenuItems()
      Updates the undo redo menu items.
      Specified by:
      updateUndoRedoMenuItems in interface MainFrameDocumentController
    • setContent

      protected void setContent(DocumentSession session)
      Clears the frame state and rebuilds everything for the new document session. This is a replacement to disposing of the JFrame and recreating it.
      Parameters:
      session - document session to read or modify
    • getPalettes

      public List<StylePalette> getPalettes()
      Returns the palettes loaded from the config.
      Returns:
      the palettes