question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Class Diagram top/bottom example

See original GitHub issue

Hi,

I’m a new engineer for the OpenCAESAR project at NASA’s JPL. I’ve been trying to learn how sprotty works and admittedly it’s been difficult since there doesn’t appear to be a lot of documentation.

How exactly should we add labels similar to the top/bottom labels in the Class Diagram example? I looked at the source and it seems like they’re implemented directly in some sort of schema, but why is it done this way?

<SLabelSchema> {
    id: 'edge1_label_bottom',
    type: 'label:text',
    text: 'bottom',
    edgePlacement:  {
        position: 0,
        side: 'bottom',
    }
},

What if we want different text to render based on certain conditions? Should I be extending the SLabelView?

We created our own LSP with Xtext. Below is a piece of our DiagramGenerator, and the subtext child for the edge below is what I’m trying to render right next to the origin of the edge.

	protected dispatch def void addToDiagram(ReifiedRelationship relationship, SGraph diagram) {
		if (relationship.source === null || relationship.target === null) {
			return
		}
		
		postProcesses.add([
			var source = semantic2diagram.get(relationship.source)
			if (source === null) {
				relationship.source.addToDiagram(diagram)
				source = semantic2diagram.get(relationship.source)
			}
			
			var target = semantic2diagram.get(relationship.target)
			if (target === null) {
				relationship.target.addToDiagram(diagram)
				target = semantic2diagram.get(relationship.target)
			}

			val id = relationship.getLocalName(resource)
			val edge = newEdge(source, target, id, "augments") => [
				children += newSElement(SLabel, id + '-label', 'text') => [
					text = id
				]
				if (relationship.inverseFunctional) {
					children += newSElement(SLabel, 'oml-invFunc', 'subtext') => [
						text = "[0,1]"
					]
				}
			]
			semantic2diagram.get(resource.contents.head).children += edge
			trace(edge, relationship)
		])
	}

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:32 (14 by maintainers)

github_iconTop GitHub Comments

1reaction
DamianRivascommented, Jul 27, 2019

Sorry for the accidental close/reopen.

I’m happy to report that the upgrades were successful. We are now on sprotty and theia next. Though I am still wondering about my question above.

Next, I’ll try to add the filter widget as we discussed before.

0reactions
spoenemanncommented, Sep 18, 2019

To continue the discussion:

Read more comments on GitHub >

github_iconTop Results From Across the Web

UML Class Diagram Tutorial - Visual Paradigm
A Comprehensive UML Class Diagram tutorial written for everyone who want to learn about Class Diagram. Read this UML guide and learn UML...
Read more >
General and common command to handle graphic layout in ...
Appendix: Examples on all diagram with style. DONE. FYI: all is only good for Sequence diagram; title , caption and ...
Read more >
The UML 2 class diagram - IBM Developer
Explore the UML 2.0 class diagram, a tool that can be used to help you understand the static structure of classifiers in a...
Read more >
transform-origin - CSS: Cascading Style Sheets | MDN
This example shows the effect of choosing different transform-origin values for a variety of transformation functions.
Read more >
UML Class Diagram Tutorial | Lucidchart
The Ultimate Guide to Class Diagrams in UML - Includes an overview of class diagrams in UML, benefits for using them, their basic...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found