Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » Control stereotype compartments using CSS
Control stereotype compartments using CSS [message #1839547] Tue, 23 March 2021 17:01 Go to next message
Patrik Nandorf is currently offline Patrik NandorfFriend
Messages: 195
Registered: January 2013
Location: Sweden
Senior Member
When adding a stereotype to a class a new compartment for that stereotype is added. How do I control this (primarily visibility) using CSS?

See the attached image to understand which compartment I mean.

I was trying something like this but it didn't work.

Class[appliedStereotypes~="Subsystem"]>Compartment[kind="Subsystem"] {
    visible:true;
}


/Patrik
Re: Control stereotype compartments using CSS [message #1839583 is a reply to message #1839547] Wed, 24 March 2021 07:49 Go to previous messageGo to next message
Camille Letavernier is currently offline Camille LetavernierFriend
Messages: 952
Registered: February 2011
Senior Member
Hi Patrik,

The main selector property for Compartments (And other "pure notation" elements) is "type", which corresponds to the type attribute in the Notation model (XMI). "Kind" has been added to provide a more human-readable value (and to be used in CSS), mostly because at this time, Notation Type attributes were integers. Anyhow; the "kind" attribute only exists if it has been specified with the appropriate extension point, so it won't know anything about your Stereotypes.

You can either populate this extension point for your Stereotypes: org.eclipse.papyrus.infra.gmfdiag.common.notationTypesMapping, or you can use the raw "type" attribute instead (Which may use a different value than the Stereotype name).

HTH,
Camille


Camille Letavernier

[Updated on: Wed, 24 March 2021 07:49]

Report message to a moderator

Re: Control stereotype compartments using CSS [message #1839607 is a reply to message #1839583] Wed, 24 March 2021 15:01 Go to previous messageGo to next message
Patrik Nandorf is currently offline Patrik NandorfFriend
Messages: 195
Registered: January 2013
Location: Sweden
Senior Member
Thanks Camille,

In the notation model (of my model, not profile) I have the following related to the stereotype:

  <children xsi:type="notation:Shape" xmi:id="_OQIc1YyuEeubD-0eUfeH6A" type="StereotypeComment">
    <styles xsi:type="notation:TitleStyle" xmi:id="_OQJD4IyuEeubD-0eUfeH6A"/>
    <styles xsi:type="notation:EObjectValueStyle" xmi:id="_OQJD4oyuEeubD-0eUfeH6A" name="BASE_ELEMENT">
      <eObjectValue href="Arvstest.uml#_x9KxwIewEeupXtlnIYWmqg"/>
    </styles>
    <element xsi:nil="true"/>
    <layoutConstraint xsi:type="notation:Bounds" xmi:id="_OQJD4YyuEeubD-0eUfeH6A" x="300" y="120"/>
  </children>


I assume the type you are referring to is
type="StereotypeComment"
?

(However this child element is not part of the class shape as the other compartment nodes are.)


Should the style be like this? Becasue I can't get it to work?

Class[appliedStereotypes~="Subsystem"]>Compartment[type="StereotypeComment"] {
    visible:true;
}




Re: Control stereotype compartments using CSS [message #1839611 is a reply to message #1839607] Wed, 24 March 2021 15:11 Go to previous messageGo to next message
Camille Letavernier is currently offline Camille LetavernierFriend
Messages: 952
Registered: February 2011
Senior Member
Hi Patrik,

I think the Stereotype Compartments you're talking about are dynamically generated by Papyrus, and not persisted in the Notation model by default; so most of my previous answer can be ignored. There is actually a specific CSS syntax for these dynamic Stereotype compartments, as described here: https://wiki.eclipse.org/MDT/Papyrus/UserGuide/CSS#Stereotype_Display

So in your case, this would be something like this:

Compartment[stereotype="YourProfile::Subsystem"]{ /* Note that the full Stereotype qualified name is required */
	visible: true;
}


Then you may also need to select the Stereotype properties you want to display in this compartment:

Compartment[type=StereotypeCompartment]>[property="allocatedTo"]{ /* Here you just need the property's simple name */
	visible:true;
}


The "StereotypeCompartment" type is generic and will match the Stereotype Compartment for any applied stereotype. The [stereotype="Stereotype::Qualified::Name"] selector can be used to refine the rule. And the [property="propertyName"] selector can be used to match child list items of these compartments.

HTH,
Camille


Camille Letavernier
Re: Control stereotype compartments using CSS [message #1839612 is a reply to message #1839611] Wed, 24 March 2021 15:20 Go to previous message
Patrik Nandorf is currently offline Patrik NandorfFriend
Messages: 195
Registered: January 2013
Location: Sweden
Senior Member
Great! Works!

I was reading the ordinary Papyrus Toolsmith help on CSS/Styles.
Previous Topic:Papyrus not working with SymML 1.6 plugin
Next Topic:Papyrus Designer does not generate code for a template bound class
Goto Forum:
  


Current Time: Thu Apr 25 04:54:27 GMT 2024

Powered by FUDForum. Page generated in 0.02822 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top