dvdkruk / spray

Automatically exported from code.google.com/p/spray
0 stars 0 forks source link

Styles defined at shape's top-level are not working #292

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
It seems that the "inheritance" (non-inline) style definition in the .shape 
model is not working if defined at the top-level of a Shape.

I defined the following styles:

style MyModelDefaultStyle {
    description = "The default style of the model diagram type."
    background-color = transparent
}

style MyElementStyle {
    description = "The style for element representation."
    background-color = light-green
}

And I defined the following shape:

shape MyElementShape style MyElementStyle
{
    <...>
}

When I draw the element in the editor, it uses "MyModelDefaultStyle" (the 
element has a transparent background). I think the error is located in the 
generation of the Add feature. It looks like this:

public PictogramElement add(final IAddContext context) {
    // ...
    final ISprayStyle style = new MyModelDefaultStyle();
    final ISprayShape shape = new MyElementShape(getFeatureProvider());
    // ...
}

but it should be

public PictogramElement add(final IAddContext context) {
    // ...
    final ISprayStyle style = new MyElementStyle();
    final ISprayShape shape = new MyElementShape(getFeatureProvider());
    // ...
}

As workaround I currently don't define styles for my shapes at toplevel, but 
for their graphical childs (rectangles etc.), which works fine:

shape MyElementShape
{
    ...
    rectangle style MyElementStyle {
       ...
    }
}

Original issue reported on code.google.com by t.fische...@gmail.com on 31 Jul 2013 at 2:57

GoogleCodeExporter commented 8 years ago
This issue was closed by revision 47cd40577e12.

Original comment by de.abg.r...@gmail.com on 31 Jul 2013 at 8:12