Class DiagramWindow

java.lang.Object
com.nomagic.magicdraw.ui.editorwindows.EditorWindow<AbstractDiagramPresentationElement>
com.nomagic.magicdraw.ui.DiagramWindow
All Implemented Interfaces:
com.jidesoft.document.DocumentComponentListener, com.nomagic.magicdraw.ui.Activatable, DiagramPresentationElementGetter, com.nomagic.ui.CursorOwner, HiDPIScalableComponent, FocusListener, WindowListener, EventListener

@OpenApi public class DiagramWindow extends com.nomagic.magicdraw.ui.editorwindows.EditorWindow<AbstractDiagramPresentationElement> implements DiagramPresentationElementGetter
This class is base class for diagram-specific windows.
  • Field Details

  • Constructor Details

    • DiagramWindow

      public DiagramWindow(com.nomagic.magicdraw.ui.DiagramWindowPanel panel)
      Constructs window with a specified panel.
      Parameters:
      panel - the panel to set.
  • Method Details

    • getTitle

      public String getTitle()
      Specified by:
      getTitle in class com.nomagic.magicdraw.ui.editorwindows.EditorWindow<AbstractDiagramPresentationElement>
    • updateRepresentation

      public void updateRepresentation()
      Specified by:
      updateRepresentation in class com.nomagic.magicdraw.ui.editorwindows.EditorWindow<AbstractDiagramPresentationElement>
    • enabledDisabledToolbar

      public void enabledDisabledToolbar()
      Disable or enable the toolbar according to the checkout state of the diagram.
      Specified by:
      enabledDisabledToolbar in class com.nomagic.magicdraw.ui.editorwindows.EditorWindow<AbstractDiagramPresentationElement>
    • setDocument

      public void setDocument(@CheckForNull AbstractDiagramPresentationElement diagram)
      Specified by:
      setDocument in class com.nomagic.magicdraw.ui.editorwindows.EditorWindow<AbstractDiagramPresentationElement>
    • setVisible

      public void setVisible(boolean visible)
      Specified by:
      setVisible in class com.nomagic.magicdraw.ui.editorwindows.EditorWindow<AbstractDiagramPresentationElement>
    • getContainer

      @CheckForNull public com.nomagic.magicdraw.ui.DiagramFrame getContainer()
      Specified by:
      getContainer in class com.nomagic.magicdraw.ui.editorwindows.EditorWindow<AbstractDiagramPresentationElement>
    • setContainer

      public void setContainer(JPanel container)
      Specified by:
      setContainer in class com.nomagic.magicdraw.ui.editorwindows.EditorWindow<AbstractDiagramPresentationElement>
    • dropContainer

      public void dropContainer()
      Overrides:
      dropContainer in class com.nomagic.magicdraw.ui.editorwindows.EditorWindow<AbstractDiagramPresentationElement>
    • windowActivated

      public void windowActivated(WindowEvent e)
      handles window activation event
      Specified by:
      windowActivated in interface WindowListener
      Parameters:
      e - Window event to handle
      See Also:
    • windowClosed

      public void windowClosed(WindowEvent e)
      handles event invoked after window closing
      Specified by:
      windowClosed in interface WindowListener
      Parameters:
      e - Window event to handle
      See Also:
    • closeWindow

      public void closeWindow()
      Closes the window
      Overrides:
      closeWindow in class com.nomagic.magicdraw.ui.editorwindows.EditorWindow<AbstractDiagramPresentationElement>
    • windowDeactivated

      public void windowDeactivated(WindowEvent e)
      Specified by:
      windowDeactivated in interface WindowListener
    • windowDeiconified

      public void windowDeiconified(WindowEvent e)
      Specified by:
      windowDeiconified in interface WindowListener
    • windowIconified

      public void windowIconified(WindowEvent e)
      Specified by:
      windowIconified in interface WindowListener
    • windowOpened

      public void windowOpened(WindowEvent e)
      Specified by:
      windowOpened in interface WindowListener
    • toFront

      public void toFront()
      Specified by:
      toFront in class com.nomagic.magicdraw.ui.editorwindows.EditorWindow<AbstractDiagramPresentationElement>
    • getFocusableComponent

      @CheckForNull public JComponent getFocusableComponent()
      Specified by:
      getFocusableComponent in class com.nomagic.magicdraw.ui.editorwindows.EditorWindow<AbstractDiagramPresentationElement>
    • setBounds

      public void setBounds(Rectangle r)
      Specified by:
      setBounds in class com.nomagic.magicdraw.ui.editorwindows.EditorWindow<AbstractDiagramPresentationElement>
    • getBounds

      @CheckForNull public Rectangle getBounds()
      Specified by:
      getBounds in class com.nomagic.magicdraw.ui.editorwindows.EditorWindow<AbstractDiagramPresentationElement>
    • hideWindow

      public void hideWindow()
      Specified by:
      hideWindow in class com.nomagic.magicdraw.ui.editorwindows.EditorWindow<AbstractDiagramPresentationElement>
    • getClassType

      public String getClassType()
      Gets the type of the class.
      Returns:
      the type of the class - a String
    • getDrawArea

      @CheckForNull public com.nomagic.magicdraw.ui.DrawArea getDrawArea()
      Get draw area of the window. This method returns the draw area panel from DiagramWindowPanel.
      Returns:
      current draw area
    • getDiagramPresentationElement

      @CheckForNull @OpenApi @Deprecated public DiagramPresentationElement getDiagramPresentationElement()
      Returns the diagram view of this window. This method returns the diagram view from DiagramWindowPanel.
      Specified by:
      getDiagramPresentationElement in interface DiagramPresentationElementGetter
      Returns:
      current diagram view.
    • getAbstractDiagramPresentationElement

      @OpenApi @CheckForNull public AbstractDiagramPresentationElement getAbstractDiagramPresentationElement()
      Returns the diagram of this window. This method returns the diagram from DiagramWindowPanel.
      Returns:
      diagram
    • getPanel

      public com.nomagic.magicdraw.ui.DiagramWindowPanel getPanel()
      Returns the panel on which diagram is drawn.
      Returns:
      the diagram drawing panel.
    • getSpecificCursor

      public Cursor getSpecificCursor()
      Returns cursor of the tree
      Specified by:
      getSpecificCursor in interface com.nomagic.ui.CursorOwner
    • setSpecificCursor

      public void setSpecificCursor(Cursor c)
      Sets cursor for documentation and tree
      Specified by:
      setSpecificCursor in interface com.nomagic.ui.CursorOwner
    • getCurrentCursor

      @CheckForNull public Cursor getCurrentCursor()
      Specified by:
      getCurrentCursor in interface com.nomagic.ui.CursorOwner
    • isVisible

      public boolean isVisible()
      Specified by:
      isVisible in class com.nomagic.magicdraw.ui.editorwindows.EditorWindow<AbstractDiagramPresentationElement>
    • createToolbars

      public void createToolbars(Map<String,Object> options)
      Description copied from class: com.nomagic.magicdraw.ui.editorwindows.EditorWindow
      Created some toolbars using given options
      Specified by:
      createToolbars in class com.nomagic.magicdraw.ui.editorwindows.EditorWindow<AbstractDiagramPresentationElement>
      Parameters:
      options - toolbar options
    • isEnableLoadOnActivation

      public boolean isEnableLoadOnActivation()
      Specified by:
      isEnableLoadOnActivation in class com.nomagic.magicdraw.ui.editorwindows.EditorWindow<AbstractDiagramPresentationElement>
      Returns:
      true if diagram should load content on activation
    • setEnableLoadOnActivation

      public void setEnableLoadOnActivation(boolean enableLoadOnActivation)
      Set load content on activation state
      Specified by:
      setEnableLoadOnActivation in class com.nomagic.magicdraw.ui.editorwindows.EditorWindow<AbstractDiagramPresentationElement>
      Parameters:
      enableLoadOnActivation - true if diagram should load content on activation
    • activate

      public void activate()
      Activate window - load diagram content if needed.
      Specified by:
      activate in interface com.nomagic.magicdraw.ui.Activatable
    • storeOptions

      public void storeOptions()
      Remembers all view options/parameters upon close, so it's state could be restored when the diagram is opened again.
      Specified by:
      storeOptions in class com.nomagic.magicdraw.ui.editorwindows.EditorWindow<AbstractDiagramPresentationElement>
    • restoreOptions

      public void restoreOptions()
      Restore window state from diagram view options
      Specified by:
      restoreOptions in class com.nomagic.magicdraw.ui.editorwindows.EditorWindow<AbstractDiagramPresentationElement>
    • getProject

      @CheckForNull public Project getProject()
      Description copied from interface: com.nomagic.magicdraw.ui.Activatable
      Project of activatable component
      Specified by:
      getProject in interface com.nomagic.magicdraw.ui.Activatable
      Returns:
      project
    • scaleForHiDPI

      public void scaleForHiDPI()
      Specified by:
      scaleForHiDPI in interface HiDPIScalableComponent
    • executeWithLockedRepaint

      public static void executeWithLockedRepaint(Runnable run, @CheckForNull com.nomagic.magicdraw.ui.DiagramWindowPanel diagramWindowPanel)
      Executes given runnable while not repainting a diagram window panel.
      Parameters:
      run - runnable to execute
      diagramWindowPanel - diagram window panel which must be repainted after this runnable completing
    • openDocument

      public void openDocument()
      Specified by:
      openDocument in class com.nomagic.magicdraw.ui.editorwindows.EditorWindow<AbstractDiagramPresentationElement>
    • getDocument

      @CheckForNull public AbstractDiagramPresentationElement getDocument()
      Specified by:
      getDocument in class com.nomagic.magicdraw.ui.editorwindows.EditorWindow<AbstractDiagramPresentationElement>
    • getDocumentComponent

      public com.jidesoft.document.DocumentComponent getDocumentComponent()
      Specified by:
      getDocumentComponent in class com.nomagic.magicdraw.ui.editorwindows.EditorWindow<AbstractDiagramPresentationElement>
    • activateDocument

      public void activateDocument(@CheckForNull com.nomagic.magicdraw.ui.editorwindows.EditorWindow old, boolean activationTrackingEnabled)
      Specified by:
      activateDocument in class com.nomagic.magicdraw.ui.editorwindows.EditorWindow<AbstractDiagramPresentationElement>
    • deactivateDocument

      public void deactivateDocument()
      Specified by:
      deactivateDocument in class com.nomagic.magicdraw.ui.editorwindows.EditorWindow<AbstractDiagramPresentationElement>
    • getWindowActivationTime

      public long getWindowActivationTime()
      Specified by:
      getWindowActivationTime in class com.nomagic.magicdraw.ui.editorwindows.EditorWindow<AbstractDiagramPresentationElement>
    • repaintWindow

      public void repaintWindow()
      Specified by:
      repaintWindow in class com.nomagic.magicdraw.ui.editorwindows.EditorWindow<AbstractDiagramPresentationElement>
    • isUseBufferImage

      public boolean isUseBufferImage()
      Specified by:
      isUseBufferImage in class com.nomagic.magicdraw.ui.editorwindows.EditorWindow<AbstractDiagramPresentationElement>
    • useBufferImage

      public void useBufferImage(boolean use)
      Specified by:
      useBufferImage in class com.nomagic.magicdraw.ui.editorwindows.EditorWindow<AbstractDiagramPresentationElement>
    • getOptions

      public com.dassault_systemes.modeler.magic.ui.editorwindow.EditorWindowOptions getOptions()
      Specified by:
      getOptions in class com.nomagic.magicdraw.ui.editorwindows.EditorWindow<AbstractDiagramPresentationElement>
    • getID

      public String getID(@CheckForNull AbstractDiagramPresentationElement document)
      Specified by:
      getID in class com.nomagic.magicdraw.ui.editorwindows.EditorWindow<AbstractDiagramPresentationElement>
    • createContainer

      public void createContainer(com.jidesoft.document.DocumentPane documentPane, com.nomagic.magicdraw.ui.ProgressBarEditorWindowZoomToolbar zoomToolbar, com.nomagic.magicdraw.ui.presentationmode.ProgressBarEditorWindowPresentationModeToolbar presentationModeToolbar)
      Overrides:
      createContainer in class com.nomagic.magicdraw.ui.editorwindows.EditorWindow<AbstractDiagramPresentationElement>
    • setFireEvents

      public void setFireEvents(boolean fireEvents)
      Overrides:
      setFireEvents in class com.nomagic.magicdraw.ui.editorwindows.EditorWindow<AbstractDiagramPresentationElement>
    • customizePopupMenu

      public void customizePopupMenu(JPopupMenu popupMenu)
      Overrides:
      customizePopupMenu in class com.nomagic.magicdraw.ui.editorwindows.EditorWindow<AbstractDiagramPresentationElement>