Skip to main content
Jump to: navigation, search

Papyrus/Papyrus Developer Guide/How To GMF Diagram Editor

Introduction

Papyrus relies on the GMF framework for the graphical editors. This GMF framework relies on the MVC design pattern (Model-View-Controller). In Papyrus,

  • Model is the notation model (the representation model, which refers to the semantic model elements)
  • View are draw2D figures
  • Controllers are the editParts. They create commands in response to requests

Figures in Papyrus

Figures in Papyrus are draw2D figures. When developping new figures for Papyrus editors, several conditions should be filled:

  • Figures should not know anything about their controller. They should never have reference to their edit part
  • method #paint(Graphics) should never modify the layout. Layout will be handled by the LayoutManager associated to the figure.
  • No inner class in the figures!

Layout

main method to implement here is the layout() method, which will place the children figures. Layout should only work for direct children figure, not the children of the children.

  • Compartment automatic layout
    • stakeholders
      • forced: there is a fixed dimension
      • default layout: we will use a default one
      • others corresponds to the labels in the figure to be layouted
      • invisible: all the invisible figures are stacked at the bottom of the container, with a 0 size
    • initialbounds
      • several invalidates => to flush caches
      • first: asks for the preferred size with no constraints => even if very long label, will give the full size
      • second: constraints from the parent. -40 to give more space at the end of the chapter

Figure developemnt

A specific view is accessible for Papyrus developers. This view describes the hierarchy of figures in a diagram for a selected element. To access this view, Window > Show View > Other... > Papyrus > Figure Hierarchy View

Miscelaneous

Comments there should be formatted

  • a test is working for the layout locally, not on the server
  • method Figure#paint(Graphics):
    • graphics is the pen

Back to the top