I created a simple dsl, and connected it with theia and Sprotty Server.(sprotty in Theia) What I did not understand is, trace of Attribute.
Change from text to graphic works good, but if I change text of a label (which is a STRING in DSL) it doesn't affect to text.
sprotty version is 0.8.0
dsl -->
Point:
'point' name=ID
'{'
('description:' description=STRING)?
'abbreviation:' abbreviation=STRING
'}'
;
theia -->
export class RuleLabel extends SLabel implements EditableLabel {
hasFeature(feature: symbol): boolean {
return feature === editLabelFeature || super.hasFeature(feature);
}
}
@injectable()
export class RuleLabelView implements SLabelView {
render(label: Readonly<RuleLabel>, context: RenderingContext): VNode {
const vnode =
<text class-sprotty-label={true}>
{label.text}
</text>;
const subType = getSubType(label);
if (subType)
setAttr(vnode, 'class', subType);
return vnode;
}
}
register in theia
configureModelElement(context, 'label:rule', RuleLabel, RuleLabelView);
Sprotty graphic generator -->
def SModelElement createPoint(Point point, extension Context context){
val theId = idCache.uniqueId('point_' + point.name)
(new SNode[
id = theId
children = #[
(new SLabel[
id= theId + '.description'
type = 'label:rule'
text = point.description
layoutOptions = new LayoutOptions [
VGap = 1.0
]
]).trace(point, RulePackage.Literals.POINT__DESCRIPTION, -1)
]
layout = 'vbox'
layoutOptions = new LayoutOptions [
paddingTop = 10.0
paddingBottom = 10.0
paddingLeft = 10.0
paddingRight = 10.0
]
]).traceAndMark(point,context)
}
Can somebody help to me please ? what am I doing wrong ?
[Updated on: Thu, 17 September 2020 13:30]
Report message to a moderator