blob: c49a765596ce15f58dae16619924a065e6d093ca [file] [log] [blame]
@namespace(uri="http://www.eclipse.org/gmf/2006/GraphicalDefinition", prefix="gmfgraph")
package gmfgraph; // TODO rename to graphdef. Sic!
class Canvas extends Identity {
@genmodel(documentation="containment here doesn't restrict nodes/connection from using figure galeries defined elsewhere. No assumption should be made whether or not node/connection figure is defined in the galery beloning to this canvas")
val FigureGallery[*] figures;
val Node[*] nodes;
val Connection[*] connections;
val Compartment[*] compartments;
val DiagramLabel[*] labels;
}
@genmodel(documentation="Kind of explicit figure library notion. Bundle of figures. Allows to specify plugin id (allows importing it later from gmfgen code) in addition to figures")
class FigureGallery extends Identity {
val RealFigure[*] figures;
val FigureDescriptor[*] descriptors;
@genmodel(documentation="Borders for reuse")
val Border[*] borders;
@genmodel(documentation="Layouts for reuse")
val Layout[*] layouts;
attr String implementationBundle;
}
@genmodel(documentation="Easy and readable way to reference element of the model from another one")
abstract interface Identity {
id attr String[1] name;
}
abstract class DiagramElement extends Identity {
ref FigureDescriptor[1] figure;
@genmodel(documentation="anything to further specify constraint or any other aspect of the element")
val VisualFacet[*] facets;
}
abstract class AbstractNode extends DiagramElement {
}
class Node extends AbstractNode {
attr Direction resizeConstraint = "NSEW"; // #114061. As a facet, perhaps?
attr Direction affixedParentSide = "NONE";
// TODO map connection-anchor
//
ref ChildAccess[?] contentPane; // constaint: accessors.contain(contentPane)
}
class Connection extends DiagramElement {
// constraint: super.figure instanceof ConnectionFigure
// boolean bendable?
}
class Compartment extends DiagramElement { // XXX AbstractNode?
attr boolean collapsible;
attr boolean needsTitle;
ref ChildAccess[?] accessor; // move to AbstractNode to share with DiagramLabel?
}
class DiagramLabel extends Node { // XXX still Node as it's a distinct endeavour to get gmfmap fixed
attr boolean elementIcon = true;
ref ChildAccess[?] accessor; // can do 2 choices here: either require super.figure to be not set or to treat this as accessor to exact label within super.figure?
ref ChildAccess[?] container;
transient volatile derived readonly attr boolean external;
}
abstract interface VisualFacet {
}
@genmodel(documentation="provide means to attach arbitrary data to your diagram element definition. It's up to you (template author) to process it somehow.")
class GeneralFacet extends VisualFacet {
id attr String[?] identifier;
attr String data;
}
@genmodel(documentation="Makes sense for DiagramLabels of Links only (now). Constants from {@link org.eclipse.draw2d.ConnectionLocator} are: MIDDLE = Alignment.CENTER, TARGET = Alignment.END, SOURCE = Alignment.BEGINNING")
class AlignmentFacet extends VisualFacet {
attr Alignment alignment;
}
class GradientFacet extends VisualFacet {
attr Direction direction;
}
class LabelOffsetFacet extends VisualFacet {
attr int x;
attr int y;
}
class DefaultSizeFacet extends VisualFacet {
val Dimension defaultSize;
}
// LayoutConstraint as VisualFacet?
// TODO placeholders
@genmodel(documentation="Anything you could combine visual representation from. Ordinary GEF figures, custom-defined or references to defined elsewhere. org.eclipse.draw2d.Figure")
abstract interface Figure extends Layoutable {
readonly transient volatile derived !resolve ref FigureDescriptor[?] descriptor;
val Color foregroundColor;
val Color backgroundColor;
val Dimension maximumSize;
val Dimension minimumSize;
val Dimension preferredSize;
val Font font;
val Insets insets;
val Border border;
val Point[?] location; // relative to parent figure
val Point[?] size;
}
@genmodel(documentation="This is merely an implementation artifact to get only one base implementation of Figure attributes")
abstract class AbstractFigure extends Figure {
}
@genmodel(documentation="The thing describes structure of a figure")
class FigureDescriptor extends Identity {
val Figure[1] actualFigure; // could be figureRef as well
val ChildAccess[*]#owner accessors;
}
class ChildAccess {
readonly !resolve ref FigureDescriptor[1]#accessors owner;
// XXX add getter and setter, use accessor as field name
attr String[?] accessor;
@genmodel(documentation="This may also point to RealFigure from FigureAccessor#typedFigure")
ref Figure[1] figure; // constraint owner.actualFigure.collectAllChildren().contains(this.figure)
// XXX perhaps, RealFigure, not just Figure?
}
@genmodel(documentation="This is exact/specific/concrete figure, unlike proxy/reference-nature FigureRef")
abstract class RealFigure extends AbstractFigure, PinOwner, CustomAttributeOwner {
attr String[?] name; // unlike identity, do not require this attribute (and not necessarily unique)
ordered val Figure[*] children;
}
@genmodel(documentation="Need this to facilitate reuse of figures while keeping (so nice looking) containment relationship in the Figure class")
class FigureRef extends AbstractFigure {
@genmodel(documentation="not just Figure because don't want to reference figure references.")
ref RealFigure[1] figure;
}
// ShapeRef extends FigureRef implements Shape?
abstract interface ConnectionFigure extends RealFigure {
// typedef connectionRouter?
}
abstract interface DecorationFigure extends RealFigure {
}
@genmodel(documentation="org.eclipse.draw2d.Shape")
abstract class Shape extends RealFigure {
attr boolean outline = true;
attr boolean fill = true;
attr int lineWidth = 1;
attr LineKind lineKind;
attr boolean xorFill;
attr boolean xorOutline;
@genmodel(documentation="Same as children, but resolves child FigureRefs, if any, to Figures")
readonly derived transient volatile ref Figure[*] resolvedChildren;
}
// well-known, predefined Figures
@genmodel(documentation="org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel")
class Label extends RealFigure {
attr String text;
}
@genmodel(documentation="org.eclipse.draw2d.LabeledContainer")
class LabeledContainer extends RealFigure {
}
// ImageFigure?
// Layer?
// Panel?
// ScrollPane?
@genmodel(documentation="org.eclipse.gmf.tooling.runtime.draw2d.labels.VerticalLabel")
class VerticalLabel extends RealFigure {
attr String text;
}
// well-known, predefined shapes
@genmodel(documentation="org.eclipse.draw2d.RectangleFigure")
class Rectangle extends Shape {
}
@genmodel(documentation="org.eclipse.draw2d.RectangleFigure #opaque=false, #outline=false, #fill=false")
class InvisibleRectangle extends RealFigure {
//
}
@genmodel(documentation="org.eclipse.draw2d.RoundedRectangle")
class RoundedRectangle extends Shape {
// FIXME dimension instead of two separate ints?
attr int cornerWidth = 8; // defaults from implementation code
attr int cornerHeight = 8;
}
@genmodel(documentation="org.eclipse.draw2d.Ellipse")
class Ellipse extends Shape {
}
@genmodel(documentation="org.eclipse.draw2d.Polyline")
class Polyline extends Shape {
val Point[*] template;
}
@genmodel(documentation="org.eclipse.draw2d.Polygon")
class Polygon extends Polyline {
}
@genmodel(documentation="Marker interface to denote polygons with ability to autoscale to fit all available bounds. Separate class is needed instead of property in the Polygon class because of generalization PolygonDecoration extends Polygon")
class ScalablePolygon extends Polygon {
}
// predefined connections
// DOES IT MAKE SENSE to extend Polyline - is there usecase for Polyline.template (i.e. predefined connection shape?)?
@genmodel(documentation="org.eclipse.draw2d.PolylineConnection")
class PolylineConnection extends Polyline, ConnectionFigure {
ref DecorationFigure sourceDecoration;
ref DecorationFigure targetDecoration;
}
// predefined decorations
@genmodel(documentation="org.eclipse.draw2d.PolylineDecoration")
class PolylineDecoration extends Polyline, DecorationFigure {
// val Point scale?;
}
@genmodel(documentation="org.eclipse.draw2d.PolygonDecoration")
class PolygonDecoration extends Polygon, DecorationFigure {
// val Point scale?;
}
// custom figures
abstract interface CustomAttributeOwner {
val CustomAttribute[*] attributes;
}
abstract interface CustomClass extends CustomAttributeOwner {
attr String qualifiedClassName;
}
class CustomAttribute {
attr String[1] name;
attr String[1] value = "null";
attr boolean[1] directAccess = false;
attr boolean[1] multiStatementValue = false;
}
class FigureAccessor {
attr String[1] accessor;
// val, not ref as Accessor is supposed to describe some part of CustomFigure, which part doesn't seem worth being described separately
// RealFigure, not CustomFigure because we might want to use predefined figures to specify type
val RealFigure[1] typedFigure;
}
@genmodel(documentation="Any figure class provided by some bundle")
class CustomFigure extends RealFigure, CustomClass {
@genmodel(documentation="Childrent enumerated with this feature are mere 'access points' to actual structure of the CustomFigure. They are not created, unlike those contained in regular Figure#children")
val FigureAccessor[*] customChildren;
}
// XXX CustomShape extends Shape, CustomClass?
@genmodel(documentation="Same as CustomFigure, but for Decorations")
class CustomDecoration extends CustomFigure, DecorationFigure {
}
@genmodel(documentation="Same as CustomFigure, but for Connections")
class CustomConnection extends CustomFigure, ConnectionFigure {
}
// Misc
abstract interface Color {
}
class RGBColor extends Color {
attr int[1] red;
attr int[1] green;
attr int[1] blue;
}
class ConstantColor extends Color {
attr ColorConstants[1] value;
}
enum ColorConstants {
// TODO capitalize and use mixed-case values as literals
white;
black;
lightGray;
gray;
darkGray;
red;
orange;
yellow;
green;
lightGreen;
darkGreen;
cyan;
lightBlue;
blue;
darkBlue;
}
abstract interface Font {
}
class BasicFont extends Font {
attr String faceName;
attr int height = 9;
attr FontStyle style = "NORMAL";
}
enum FontStyle {
NORMAL;
BOLD;
ITALIC;
// UNDERLINE;
}
class Point {
attr int x;
attr int y;
}
class Dimension {
attr int dx;
attr int dy;
}
class Insets {
attr int top;
attr int left;
attr int bottom;
attr int right;
}
abstract interface Border {
}
// XXX perhaps, makes sense to have common Ref marker interface to easily tell use of [Figure|Border|Layout]Ref?
@genmodel(documentation="Border reuse mechanism")
class BorderRef extends Border {
@genmodel(documentation="constraint: actual should not be another BorderRef")
ref Border[1] actual;
}
class LineBorder extends Border {
val Color color;
attr int width = 1;
}
class MarginBorder extends Border {
val Insets insets;
}
class CompoundBorder extends Border {
val Border outer;
val Border inner;
}
class CustomBorder extends Border, CustomClass {
}
@genmodel(documentation="Geographical bit constants from org.eclipse.draw2d.PositionConstants")
enum Direction {
NONE = 0; // host can't be resized; see 'directions' attribute in ResizableEditPolicy
NORTH = 1;
SOUTH = 4;
WEST = 8;
EAST = 16;
NORTH_EAST = 17;
NORTH_WEST = 9;
SOUTH_EAST = 20;
SOUTH_WEST = 12;
NORTH_SOUTH = 5;
EAST_WEST = 24;
NSEW = 29;
}
@genmodel(documentation="org.eclipse.draw2d.Graphics.LINE_* (== org.eclipse.swt.SWT.LINE_*. Values are same as SWT constants")
enum LineKind {
LINE_SOLID = 1;
LINE_DASH = 2;
LINE_DOT = 3;
LINE_DASHDOT = 4;
LINE_DASHDOTDOT = 5;
LINE_CUSTOM = 6;
}
abstract interface LayoutData {
ref Layoutable[1]#layoutData owner;
}
class CustomLayoutData extends LayoutData, CustomClass {
}
class GridLayoutData extends LayoutData {
attr boolean[1] grabExcessHorizontalSpace = false;
attr boolean[1] grabExcessVerticalSpace = false;
attr Alignment[1] verticalAlignment = "CENTER";
attr Alignment[1] horizontalAlignment = "CENTER";
attr int[1] verticalSpan = 1;
attr int[1] horizontalSpan = 1;
attr int[1] horizontalIndent;
val Dimension[?] sizeHint;
}
class BorderLayoutData extends LayoutData {
attr Alignment[1] alignment = "CENTER";
attr boolean[?] vertical = false;
}
enum Alignment {
BEGINNING = 0;
CENTER = 1;
END = 2;
FILL = 3;
}
abstract interface Layoutable {
val LayoutData#owner layoutData;
val Layout layout;
}
abstract interface Layout {
}
@genmodel(documentation="Layout reuse mechanism")
class LayoutRef extends Layout {
@genmodel(documentation="constraint: actual should not be another LayoutRef")
ref Layout[1] actual;
}
class CustomLayout extends Layout, CustomClass {
}
class GridLayout extends Layout {
attr int[1] numColumns = 1;
attr boolean[1] equalWidth = true;
val Dimension[?] margins;
val Dimension[?] spacing;
}
class BorderLayout extends Layout {
val Dimension spacing;
}
class FlowLayout extends Layout {
attr boolean vertical = false;
attr boolean matchMinorSize = false;
attr boolean forceSingleLine = false;
attr Alignment majorAlignment = "BEGINNING";
attr Alignment minorAlignment = "BEGINNING";
attr int majorSpacing = 5;
attr int minorSpacing = 5;
}
class XYLayout extends Layout {
}
class XYLayoutData extends LayoutData {
val Point[1] topLeft;
val Dimension[1] size;
}
class StackLayout extends Layout {
}
class CenterLayout extends Layout {
}
class SVGFigure extends RealFigure {
attr String documentURI;
val SVGProperty[*] properties;
val Rectangle2D[?] areaOfInterest;
attr boolean noCanvasWidth;
attr boolean noCanvasHeight;
}
class SVGProperty {
attr String query;
attr String attribute;
attr SVGPropertyType type;
attr String getter;
attr String setter;
attr boolean callSuper;
}
enum SVGPropertyType {
STRING = 0;
COLOR = 1;
FLOAT = 2;
}
class Rectangle2D {
attr float x;
attr float y;
attr float width;
attr float height;
}
abstract interface Pin extends Identity {
op String getOperationName();
op String getOperationType();
}
class CustomPin extends Pin {
attr String customOperationName;
attr String customOperationType;
}
class ColorPin extends Pin {
attr boolean backgroundNotForeground;
}
class VisiblePin extends Pin {
}
abstract interface PinOwner {
val Pin[*] pins;
}