how to modify over the component dependencies sample

Hello All,

Currently, I am trying to include a sub component (AKA, Element) inside a component in following the component dependencies guidelines, and want the diagram editor to be to understand that and draw a box inside the component box with the relevant information regarding the sub component. but I am facing the following exception

concept LinkArgument --> DISMISS TOP RULE error : LinkArgument instance not allowed here 

inheritors false
condition <always>

And here is my changes over the component dependencies project, the rest of the project is practically the same like the sample, what I want is to pass a concept node (AkA Element concept)  as a property  to the CustomeNamedBoxFigure and then get the node properties to create the box inside the main component diagram.

But when I try to do that I get the above error as mentioned.

concept Component extends BaseConcept                                                                                                                                                         
implements INamedConcept

instance can be root: false
alias: <no alias>
short description: <no short description>

properties:
x : integer
y : integer
width : integer
height : integer
color : string
red : integer
green : integer
blue : integer
subsystem : string


children:
dep : Dependency[0..n]
in : InPort[0..n]
out : OutPort[0..n]
element : Element[0..1]

references:
<< ... >>

 

concept Element extends BaseConcept 
implements INamedConcept

instance can be root: false
alias: element
short description: <no short description>

properties:
x : integer
y : integer
red : integer
green : integer
blue : integer
width : integer
height : integer
children:
<< ... >>

references:
<< ... >>

 

@Figure 
public class CustomNamedBoxFigure extends NamedBoxFigure {

private TextCell myCell = new TextCell();
private CustomElementBoxFigure group = new CustomElementBoxFigure();


public CustomNamedBoxFigure() {
this(new CustomerNamedBoxFigureMapperFactory());
background().set(Color.GRAY);
}


public CustomNamedBoxFigure(CustomerNamedBoxFigureMapperFactory factory) {
CellView cellView = new CellView();
myCell.textColor().set(Color.BLACK);
myCell.text().set("<<No Text Here>>");
cellView.cell.set(myCell);
children().add(cellView);
if (factory != null) {
factory.createMapper(this).attachRoot();
}
}

@FigureParameter
public ValueProperty<Color> color = new ValueProperty<Color>(Color.CYAN);

@FigureParameter
public Property<string> idText() {
myCell.text();
}

@FigureParameter
public ValueProperty<node<Element>> subelement = new ValueProperty<node<Element>>();


private static class CustomerNamedBoxFigureMapperFactory implements MapperFactory<CustomNamedBoxFigure, CustomNamedBoxFigure> {

@Override
public Mapper<? extends CustomNamedBoxFigure, ? extends CustomNamedBoxFigure> createMapper(final CustomNamedBoxFigure figure) {
return new NamedBoxFigure.NamedBoxFigureMapper<CustomNamedBoxFigure>(figure) {
@Override
protected void registerSynchronizers(Mapper.SynchronizersConfiguration configuration) {
super.registerSynchronizers(configuration);
CustomNamedBoxFigure source = getSource();
configuration.add(Synchronizers.forProperty(figure.parent(), {View parentView =>

while (parentView != null) {
if (parentView instanceof DiagramNodeView) {
((DiagramNodeView) parentView).setPortsDirection(GridDirection.DOWN);
}
parentView = parentView.parent().get();
}
}));
configuration.add(Synchronizers.forProperty(source.color, { => source.prop(BACKGROUND).set(source.color.get()); }));
configuration.add(Synchronizers.forProperty(source.subelement, { =>
node<Element> element = source.subelement.get();
if (element != null) {
CustomElementBoxFigure elementFigure = new CustomElementBoxFigure();
elementFigure.idText().set(element.name);
source.children().add(elementFigure);
}
}));

}
};

}
}

}
diagram editor for concept Component 
node cell layout:
^{ CustomNamedBoxFigure (nameText:subsystem, idText:name, POSITION_X:x, POSITION_Y:y, figureHeight:height, figureWidth:width, editable:#true, color:#new Color(this.red, this.green, this.blue), subelement:element) inputPorts: in outputPorts: out }

inspected cell layout:
[/
position
[> x: { x } <]
[> y: { y } <]
[> width: { width } <]
[> height: { height } <]
[> color: { color } <]
[> red: { red } <]
[> green: { green } <]
[> blue: { blue } <]
/]
<default> editor for concept Element
node cell layout:
[> Sub Element: { name } <]

inspected cell layout:
[/
position
[> x: { x } <]
[> y: { y } <]
[> width: { width } <]
[> height: { height } <]
[> red: { red } <]
[> green: { green } <]
[> blue: { blue } <]
/]
diagram editor for concept Element 
node cell layout:
{ CustomElementBoxFigure (nameText:name, POSITION_X:x, POSITION_Y:y, figureHeight:width, figureWidth:height) inputPorts: <no inputPort> outputPorts: <no outputPort> }

inspected cell layout:
[/
position
[> x: { x } <]
[> y: { y } <]
[> width: { width } <]
[> height: { height } <]
[> red: { red } <]
[> green: { green } <]
[> blue: { blue } <]
/]

Please sign in to leave a comment.