64
A FRESH LOOK AT GRAPHICAL EDITING Dr. Jan Köhnlein Mittwoch, 28. März 12

A fresh look at graphical editing

Embed Size (px)

DESCRIPTION

Ta

Citation preview

Page 1: A fresh look at graphical editing

A FRESH LOOK AT

GRAPHICAL EDITING

Dr. Jan Köhnlein

Mittwoch, 28. März 12

Page 2: A fresh look at graphical editing

一畫勝千言

Mittwoch, 28. März 12

Page 3: A fresh look at graphical editing

A PICTURESAYS

MORE THANA THOUSAND

WORDS

一畫勝千言

Mittwoch, 28. März 12

Page 4: A fresh look at graphical editing

A PICTURESAYS

MORE THANA THOUSAND

WORDS

一畫勝千言

Myth

Mittwoch, 28. März 12

Page 5: A fresh look at graphical editing

Mittwoch, 28. März 12

Page 6: A fresh look at graphical editing

package ecore

abstract class EModelElement extends EObject { op EAnnotation getEAnnotation(String source) contains EAnnotation[] eAnnotation opposite eModelElement }

class EAnnotation extends EObject { container EModelElement eModelElement opposite eAnnotation}

abstract class ENamedElement extends EModelElement{ String name}

class EFactory extends EObject { op EObject ^create(EClass eClass) op EJavaObject createFromString(EDataType eDataType, String literalValue) op String createFromString(EDataType eDataType, EJavaObject instanceValue) refers EPackage ePackage opposite eFactoryInstance}

abstract class ETypedElement extends ENamedElement { boolean ordered = "true" boolean ^unique = "true" int lowerBound int upperBound = "1" boolean many refers EClassifier eType}

abstract class EClassifier extends ENamedElement { String instanceClassName EJavaClass instanceClass EJavaObject defaultValue op boolean isInstance(EJavaObject object) op int getClassifierID() container EPackage ePackage opposite eClassifiers}

class EPackage extends ENamedElement { String nsURI String nsPrefix op EClassifier getEClassifier(String name) refers EFactory eFactoryInstance opposite ePackage contains EPackage[] eSubPackages opposite eSuperPackage container EPackage eSuperPackage opposite eSubPackages contains EClassifier[] eClassifiers opposite ePackage}

class EOperation extends ETypedElement { contains EParameter[] eParameters opposite eOperation container EClass eContainingClass opposite eOperations refers EClassifier[] eExceptions}

class EClass extends EClassifier { boolean ^abstract boolean ^interface op boolean isSuperTypeOf(EClass someClass) op EStructuralFeature getEStructuralFeature(int featureID) op EStructuralFeature getEStructuralFeature(String featureName) contains EOperation[] eOperations opposite eContainingClass refers EOperation[] eAllOperations contains EStructuralFeature[] eStructuralFeatures opposite eContainingClass refers EStructuralFeature[] eAllStructuralFeatures refers EReference[] eAllContainments refers EReference[] eAllReferences refers EReference[] eReferences refers EAttribute[] eAllAtrributes refers EAttribute[] eAtrributes refers EAttribute eIDAtrributes refers EClass[] eAllSuperTypes refers EClass[] eSuperTypes}

class EDataType extends EClassifier { boolean serializable = "true"}

abstract class EStructuralFeature extends ETypedElement { boolean changeable = "true" boolean ^volatile boolean ^transient String defaultValueLiteral EJavaObject defaultValue boolean ^unsettable boolean ^derived op int getFeatureID() op EJavaClass getContainerClass() container EClass eContainingClass opposite eStructuralFeatures}

class EReference extends EStructuralFeature { boolean containment boolean ^container boolean resolveProxies = "true" refers EReference eOpposite opposite eOpposite}

class EParameter extends ETypedElement { container EOperation eOperation opposite eParameters }

class EAttribute extends EStructuralFeature { boolean iD refers EDataType eAttributeType}

class EEnumLiteral extends ENamedElement { int value EEnumerator instance container EEnum eEnum opposite eLiterals}

class EEnum extends EDataType { op EEnumLiteral getEEnumLiteral(String name) op EEnumLiteral getEEnumLiteral(int value) contains EEnumLiteral[] eLiterals opposite eEnum}

class EObject {}type EJavaClass wraps Classtype EJavaObject wraps Objecttype EEnumerator wraps java.util.Enumeration

Mittwoch, 28. März 12

Page 7: A fresh look at graphical editing

package ecore

abstract class EModelElement extends EObject { op EAnnotation getEAnnotation(String source) contains EAnnotation[] eAnnotation opposite eModelElement }

class EAnnotation extends EObject { container EModelElement eModelElement opposite eAnnotation}

abstract class ENamedElement extends EModelElement{ String name}

class EFactory extends EObject { op EObject ^create(EClass eClass) op EJavaObject createFromString(EDataType eDataType, String literalValue) op String createFromString(EDataType eDataType, EJavaObject instanceValue) refers EPackage ePackage opposite eFactoryInstance}

abstract class ETypedElement extends ENamedElement { boolean ordered = "true" boolean ^unique = "true" int lowerBound int upperBound = "1" boolean many refers EClassifier eType}

abstract class EClassifier extends ENamedElement { String instanceClassName EJavaClass instanceClass EJavaObject defaultValue op boolean isInstance(EJavaObject object) op int getClassifierID() container EPackage ePackage opposite eClassifiers}

class EPackage extends ENamedElement { String nsURI String nsPrefix op EClassifier getEClassifier(String name) refers EFactory eFactoryInstance opposite ePackage contains EPackage[] eSubPackages opposite eSuperPackage container EPackage eSuperPackage opposite eSubPackages contains EClassifier[] eClassifiers opposite ePackage}

class EOperation extends ETypedElement { contains EParameter[] eParameters opposite eOperation container EClass eContainingClass opposite eOperations refers EClassifier[] eExceptions}

class EClass extends EClassifier { boolean ^abstract boolean ^interface op boolean isSuperTypeOf(EClass someClass) op EStructuralFeature getEStructuralFeature(int featureID) op EStructuralFeature getEStructuralFeature(String featureName) contains EOperation[] eOperations opposite eContainingClass refers EOperation[] eAllOperations contains EStructuralFeature[] eStructuralFeatures opposite eContainingClass refers EStructuralFeature[] eAllStructuralFeatures refers EReference[] eAllContainments refers EReference[] eAllReferences refers EReference[] eReferences refers EAttribute[] eAllAtrributes refers EAttribute[] eAtrributes refers EAttribute eIDAtrributes refers EClass[] eAllSuperTypes refers EClass[] eSuperTypes}

class EDataType extends EClassifier { boolean serializable = "true"}

abstract class EStructuralFeature extends ETypedElement { boolean changeable = "true" boolean ^volatile boolean ^transient String defaultValueLiteral EJavaObject defaultValue boolean ^unsettable boolean ^derived op int getFeatureID() op EJavaClass getContainerClass() container EClass eContainingClass opposite eStructuralFeatures}

class EReference extends EStructuralFeature { boolean containment boolean ^container boolean resolveProxies = "true" refers EReference eOpposite opposite eOpposite}

class EParameter extends ETypedElement { container EOperation eOperation opposite eParameters }

class EAttribute extends EStructuralFeature { boolean iD refers EDataType eAttributeType}

class EEnumLiteral extends ENamedElement { int value EEnumerator instance container EEnum eEnum opposite eLiterals}

class EEnum extends EDataType { op EEnumLiteral getEEnumLiteral(String name) op EEnumLiteral getEEnumLiteral(int value) contains EEnumLiteral[] eLiterals opposite eEnum}

class EObject {}type EJavaClass wraps Classtype EJavaObject wraps Objecttype EEnumerator wraps java.util.Enumeration

368 Words

Mittwoch, 28. März 12

Page 8: A fresh look at graphical editing

Mittwoch, 28. März 12

Page 9: A fresh look at graphical editing

ENTIRE ECORE ~500 WORDS

Mittwoch, 28. März 12

Page 10: A fresh look at graphical editing

Mittwoch, 28. März 12

Page 11: A fresh look at graphical editing

DIAGRAMS ARE TALKING TO

YOU NOT TO YOUR COMPUTER

Mittwoch, 28. März 12

Page 12: A fresh look at graphical editing

REQUIREMENTSModel(Computer)

Diagram(User)

Mittwoch, 28. März 12

Page 13: A fresh look at graphical editing

REQUIREMENTSModel(Computer)

Diagram(User)

Completeness

Conciseness

Consistency

Containment

Mittwoch, 28. März 12

Page 14: A fresh look at graphical editing

Explain Model to Humans

Projection, arbitrary focus

Verbosity and sloppiness

Slick visual design

Usability of a drawing tool

REQUIREMENTSModel(Computer)

Diagram(User)

Completeness

Conciseness

Consistency

Containment

Mittwoch, 28. März 12

Page 15: A fresh look at graphical editing

Semantic model Diagram

1-to-1Mapping

MODEL EDITING SOLUTION

Mittwoch, 28. März 12

Page 16: A fresh look at graphical editing

Semantic model Diagram

1-to-1Mapping

MODEL EDITING SOLUTION

Mittwoch, 28. März 12

Page 17: A fresh look at graphical editing

MISMATCH IS THE RULE

TreeNode*

childrenDiagram

Node Edge

edgesnodes * *

Mittwoch, 28. März 12

Page 18: A fresh look at graphical editing

MISMATCH IS THE RULE

TreeNode*

childrenDiagram

Node Edge

edgesnodes * *

Mittwoch, 28. März 12

Page 19: A fresh look at graphical editing

MISMATCH IS THE RULE

TreeNode*

childrenDiagram

Node Edge

edgesnodes * *

TreeNode A > TreeNode B

Mittwoch, 28. März 12

Page 20: A fresh look at graphical editing

MISMATCH IS THE RULE

TreeNode*

childrenDiagram

Node Edge

edgesnodes * *

TreeNode A > TreeNode B

Mittwoch, 28. März 12

Page 21: A fresh look at graphical editing

MISMATCH IS THE RULE

TreeNode*

childrenDiagram

Node Edge

edgesnodes * *

TreeNode A > TreeNode B

Diagram > Node A> Node B> Edge (A,B)

Mittwoch, 28. März 12

Page 22: A fresh look at graphical editing

DIAGRAM ASSIMILATION

Mittwoch, 28. März 12

Page 23: A fresh look at graphical editing

USER SURPRISE

Mittwoch, 28. März 12

Page 24: A fresh look at graphical editing

USER SURPRISE

Delete

Cut / Copy / Paste

Drag & Drop

Mittwoch, 28. März 12

Page 25: A fresh look at graphical editing

GHOST ELEMENTS

Mittwoch, 28. März 12

Page 26: A fresh look at graphical editing

GHOST ELEMENTS

Remnants of failed Cut/Copy/Paste/Deleteor Drag & Drop actions

Breaking model integrity

Not shown in any diagram

Mittwoch, 28. März 12

Page 27: A fresh look at graphical editing

NON-GRAPHICAL EDITING

Mittwoch, 28. März 12

Page 28: A fresh look at graphical editing

NON-GRAPHICAL EDITING

Mittwoch, 28. März 12

Page 29: A fresh look at graphical editing

NON-GRAPHICAL EDITING

Mittwoch, 28. März 12

Page 30: A fresh look at graphical editing

INSUFFICIENT DESIGN

Mittwoch, 28. März 12

Page 31: A fresh look at graphical editing

INSUFFICIENT DESIGN

Mittwoch, 28. März 12

Page 32: A fresh look at graphical editing

YOUR EDITOR DEGRADES

WHEN YOU FOCUS ON MODEL EDITING

Mittwoch, 28. März 12

Page 33: A fresh look at graphical editing

Enforce 1-to-1-mapping

•Assimilate diagram

• Loss of expressiveness

• Loss of usability

•Add non-graphical tools

WHAT IS YOUR FOCUSModelEditing

Diagram Editing

Dynamic one-way mapping

Full graphical flexibility

Style for understandability

Choose projection easily

• Find another way to edit

Mittwoch, 28. März 12

Page 34: A fresh look at graphical editing

Semantic model Diagram

One-wayMapping

MODEL VIEW SOLUTION

Mittwoch, 28. März 12

Page 35: A fresh look at graphical editing

Semantic model Diagram

One-wayMapping

MODEL VIEW SOLUTION

Mittwoch, 28. März 12

Page 36: A fresh look at graphical editing

MODELEDITING

Mittwoch, 28. März 12

Page 37: A fresh look at graphical editing

DIAGRAMEDITING

Mittwoch, 28. März 12

Page 38: A fresh look at graphical editing

• Reads mapping and stylesheet

• Capture snapshots of any live model

• Render GEF diagram with shape library

• Selection / navigation adapter for

• EMF, Xtext, JDT

RUNTIME

Mittwoch, 28. März 12

Page 39: A fresh look at graphical editing

• Xtext-based with Xbase expressions

• Uni-directional transformation

• Interpreted

MAPPING DSL

Mittwoch, 28. März 12

Page 40: A fresh look at graphical editing

• Xtext-based with Xbase expressions

• Directly modifies Draw2d figures

• Interpreted

STYLING DSL

Mittwoch, 28. März 12

Page 41: A fresh look at graphical editing

MyClass

SuperClass

Mittwoch, 28. März 12

Page 42: A fresh look at graphical editing

MyClass

SuperClass

this

Mittwoch, 28. März 12

Page 43: A fresh look at graphical editing

diagram EClassHierarchy type EClass {

MyClass

SuperClass

this

Mittwoch, 28. März 12

Page 44: A fresh look at graphical editing

diagram EClassHierarchy type EClass {

MyClass

SuperClass

this

Mittwoch, 28. März 12

Page 45: A fresh look at graphical editing

diagram EClassHierarchy type EClass { node EClassNode for this {

MyClass

SuperClass

this

Mittwoch, 28. März 12

Page 46: A fresh look at graphical editing

diagram EClassHierarchy type EClass { node EClassNode for this {

MyClass

SuperClass

this

Mittwoch, 28. März 12

Page 47: A fresh look at graphical editing

diagram EClassHierarchy type EClass { node EClassNode for this { label Name for this

MyClass

SuperClass

this

Mittwoch, 28. März 12

Page 48: A fresh look at graphical editing

diagram EClassHierarchy type EClass { node EClassNode for this { label Name for this

MyClass

SuperClass

this MyClass

Mittwoch, 28. März 12

Page 49: A fresh look at graphical editing

diagram EClassHierarchy type EClass { node EClassNode for this { label Name for this edge SuperType for each this.getESuperTypes() {

MyClass

SuperClass

this MyClass

Mittwoch, 28. März 12

Page 50: A fresh look at graphical editing

diagram EClassHierarchy type EClass { node EClassNode for this { label Name for this edge SuperType for each this.getESuperTypes() {

MyClass

SuperClass this

MyClass

Mittwoch, 28. März 12

Page 51: A fresh look at graphical editing

diagram EClassHierarchy type EClass { node EClassNode for this { label Name for this edge SuperType for each this.getESuperTypes() { => call EClassNode for this

MyClass

SuperClass this

MyClass

Mittwoch, 28. März 12

Page 52: A fresh look at graphical editing

diagram EClassHierarchy type EClass { node EClassNode for this { label Name for this edge SuperType for each this.getESuperTypes() { => call EClassNode for this

MyClass

SuperClass this

MyClass

Mittwoch, 28. März 12

Page 53: A fresh look at graphical editing

diagram EClassHierarchy type EClass { node EClassNode for this { label Name for this edge SuperType for each this.getESuperTypes() { => call EClassNode for this

MyClass

SuperClass this SuperClass

MyClass

Mittwoch, 28. März 12

Page 54: A fresh look at graphical editing

diagram EClassHierarchy type EClass { node EClassNode for this { label Name for this edge SuperType for each this.getESuperTypes() { => call EClassNode for this

MyClass

SuperClass

this

SuperClass

MyClass

Mittwoch, 28. März 12

Page 55: A fresh look at graphical editing

diagram EClassHierarchy type EClass { node EClassNode for this { label Name for this edge SuperType for each this.getESuperTypes() { => call EClassNode for this

MyClass

SuperClass

this

SuperClass

MyClass

Mittwoch, 28. März 12

Page 56: A fresh look at graphical editing

diagram EClassHierarchy type EClass { node EClassNode for this { label Name for this edge SuperType for each this.getESuperTypes() { => call EClassNode for this } }}

MyClass

SuperClass

this

SuperClass

MyClass

Mittwoch, 28. März 12

Page 57: A fresh look at graphical editing

stylesheet EClassHierarchy for EClassHierarchy

style EClassNode.SuperType { var arrow = new PolygonDecoration() arrow.setScale(10,10) arrow.backgroundColor = color(#ffffff) arrow.lineWidth = 2 this.targetDecoration = arrow }

style EClassNode.Name { font = font("Helvetica", 13,

if (element.abstract) 3 else 1)}

Mittwoch, 28. März 12

Page 58: A fresh look at graphical editing

refs to mappings

stylesheet EClassHierarchy for EClassHierarchy

style EClassNode.SuperType { var arrow = new PolygonDecoration() arrow.setScale(10,10) arrow.backgroundColor = color(#ffffff) arrow.lineWidth = 2 this.targetDecoration = arrow }

style EClassNode.Name { font = font("Helvetica", 13,

if (element.abstract) 3 else 1)}

Mittwoch, 28. März 12

Page 59: A fresh look at graphical editing

Xbase body

stylesheet EClassHierarchy for EClassHierarchy

style EClassNode.SuperType { var arrow = new PolygonDecoration() arrow.setScale(10,10) arrow.backgroundColor = color(#ffffff) arrow.lineWidth = 2 this.targetDecoration = arrow }

style EClassNode.Name { font = font("Helvetica", 13,

if (element.abstract) 3 else 1)}

Mittwoch, 28. März 12

Page 60: A fresh look at graphical editing

this variable

stylesheet EClassHierarchy for EClassHierarchy

style EClassNode.SuperType { var arrow = new PolygonDecoration() arrow.setScale(10,10) arrow.backgroundColor = color(#ffffff) arrow.lineWidth = 2 this.targetDecoration = arrow }

style EClassNode.Name { font = font("Helvetica", 13,

if (element.abstract) 3 else 1)}

Mittwoch, 28. März 12

Page 61: A fresh look at graphical editing

color literals

stylesheet EClassHierarchy for EClassHierarchy

style EClassNode.SuperType { var arrow = new PolygonDecoration() arrow.setScale(10,10) arrow.backgroundColor = color(#ffffff) arrow.lineWidth = 2 this.targetDecoration = arrow }

style EClassNode.Name { font = font("Helvetica", 13,

if (element.abstract) 3 else 1)}

Mittwoch, 28. März 12

Page 62: A fresh look at graphical editing

extensions

stylesheet EClassHierarchy for EClassHierarchy

style EClassNode.SuperType { var arrow = new PolygonDecoration() arrow.setScale(10,10) arrow.backgroundColor = color(#ffffff) arrow.lineWidth = 2 this.targetDecoration = arrow }

style EClassNode.Name { font = font("Helvetica", 13,

if (element.abstract) 3 else 1)}

Mittwoch, 28. März 12

Page 63: A fresh look at graphical editing

semantic styling

stylesheet EClassHierarchy for EClassHierarchy

style EClassNode.SuperType { var arrow = new PolygonDecoration() arrow.setScale(10,10) arrow.backgroundColor = color(#ffffff) arrow.lineWidth = 2 this.targetDecoration = arrow }

style EClassNode.Name { font = font("Helvetica", 13,

if (element.abstract) 3 else 1)}

Mittwoch, 28. März 12

Page 64: A fresh look at graphical editing

https://github.com/JanKoehnlein/Generic-Graph-View

The code is at

But remember:

IT‘S A PROTOTYPE

Mittwoch, 28. März 12