This service is archived, please use www.eclipse.org/forums


Home » Capella » Capella Studio » Link PC datas with customized viewpoint
Link PC datas with customized viewpoint [message #3144] Fri, 10 May 2019 05:06 Go to next message
jmorane is currently offline  jmorane
Messages: 63
Registered: May 2019
Member
Hello everyone,

Following that tutorial ( https://www.youtube.com/watch?v=lhNvmjHRa0o ), I was able to create a custom viewpoint.

In the tutorial, a class Cost is created, with the attribute 'objective'. Generating and using the viewpoint in Capella, it appear that I don't know whether I can define the value of that attribute with, for instance, a Literal Numeric Value defined in a data package in an other part of my project.

My guess is that I have to bring some modifications to the '.ui.vptext' file, but I'm quite a beginner in that subject, and some help would be really appreciated Smile

Regards,


Re: Link PC datas with customized viewpoint [message #3149 is a reply to message #3144] Mon, 13 May 2019 07:57 Go to previous messageGo to next message
Daniil200 is currently offline  Daniil200
Messages: 32
Registered: December 2018
Member
Hello,
I am not certain exactly what you are asking for, but it sounds like you would like to know how to type your attributes?

Your question actually decomposes into two seperate parts: the type of the attribute (string, int, float etc.) and the entry method of your attribute.

1. The type of your attribute is set in your data.vptext file. When you add attributes to your object class, you need to type them (EX: "currentMass type ecore.EInt", see Data.jpg). This sets what type the value associated with your attribute has to be. If within your viewpoint development you break this typing, the IDE will give you an error warning as usual in any coding language/IDE.
2. The entry method for your attribute is defined in the ui.vptext signaled by a "Field" classifier (EX: "Field currentMassField label: "Current Mass" type text , mapped-to MassPlus.data.Mass.currentMass", see UI.jpg). Here we set the field type to be "text", and map it to our existing attribute in our data file. Capella does a really nice thing here by automatically including fail-safes. Although the field "text" can take any and all text entries (not just int), since we have mapped it to an attribute of type int, it will only save the entries that match the attribute type! This means that your attribute type is entirely defined in your data file, and the ui file only defines how a value change can be made. Capella will also automatically throw you an error if you try to match an attribute to a field that cannot take in the given type of values. For example, if we were to map our EInt type to a field type "checkbox", Capella will give an error since checkboxes can only represent Boolean information, and thus it is impossible to communicate an integer value through that field.

Let me know if you have any other questions or if I need to clarify anything.

Best,
Daniil
  • Attachment: Data.JPG
    (Size: 14.67KB, Downloaded 56 times)
  • Attachment: UI.JPG
    (Size: 29.60KB, Downloaded 56 times)
Re: Link PC datas with customized viewpoint [message #3153 is a reply to message #3149] Mon, 13 May 2019 10:53 Go to previous messageGo to next message
jmorane is currently offline  jmorane
Messages: 63
Registered: May 2019
Member
Hello Daniil,

Thank you for your answer ! However, I think I was not precise enough in my question.

When I use the customized viewpoint, I can change its attributes on the "Properties" view, as shown in the image linked.
But, let us imagine that I have already defined my mass in a Data package previously, how will I manage to link that value with the one of the BasicMass ?

I also have an other question, quite unrelated to this one. In the BasicMass viewpoint, where is the sum of each subcomponent mass is done in the code ?

Thank you in advance for your answers,

Regards,

Julien
  • Attachment: BMass.png
    (Size: 63.81KB, Downloaded 65 times)

[Updated on: Mon, 13 May 2019 10:53]

Report message to a moderator

Re: Link PC datas with customized viewpoint [message #3154 is a reply to message #3153] Mon, 13 May 2019 11:52 Go to previous messageGo to next message
Daniil200 is currently offline  Daniil200
Messages: 32
Registered: December 2018
Member
Hello,
Yes it does seem that I have completely misunderstood the question. I do not unfortunately have a lot of knowledge about the BasicMass custom viewpoint. As far as I know, it is not possible to link a BasicMass object with an existing Data object.

I have not looked at the code of BasicMass viewpoint so unfortunately cannot help with the second question.

Sorry,
Daniil
Re: Link PC datas with customized viewpoint [message #3216 is a reply to message #3154] Fri, 24 May 2019 09:38 Go to previous messageGo to next message
jmorane is currently offline  jmorane
Messages: 63
Registered: May 2019
Member
Thank you fr your time anyway Daniil, the topic is then still open : I hope someone will provides us an answer !

regards,
Re: Link PC datas with customized viewpoint [message #3225 is a reply to message #3216] Mon, 27 May 2019 03:42 Go to previous messageGo to next message
jpequery.free.fr is currently offline  jpequery.free.fr
Messages: 10
Registered: September 2015
Location: Gif Sur Yvette
Junior Member

Hello,

regarding mass computation, it's in the mass.diagram.vptext subfile. The file defines diagram extensions over the PhysicalArchitectureBlank diagram, and add a color customization on part containers, modifying background and foreground depending on a condition implemented in two services : isMassSaturated and isMassOverhead. Theses services are implemented in the java service file MassOpenJavaService.java, defined in the generated plugin org.polarsys.capella.vp.mass.design. You can notice some methods in this file are marked using @generated NOT to avoid modifications on viewpoint generation.

considering the extended object, kitalpha is based over a metamodel extension Mechanism. In the data.vptext file, you can create this extension. In the context of the "BasicMass" point of view, two new classes are created. The Mass class contains mass information for a component. And the link between capella objects and mass objects are made with the extension mechanism, here the PartMass extends the Part metaclass and link a Mass by inheritence.

If you want to refer an existing value, such as a LiteralNumericValue, you will have to declare an association. Like the declaration of mass attributes, you can create an association definition, to create an association. I can suggest you to check all the datavalue metamodel to select the correct destination metaclass.

Associations:
myValue refers [1,1] external datavalue.LiteralNumericValue

With best regards,

J.Pequery



Eclipse Modeling Consultant
Obeo - http://www.obeo.fr
Re: Link PC datas with customized viewpoint [message #3226 is a reply to message #3225] Mon, 27 May 2019 05:16 Go to previous message
jmorane is currently offline  jmorane
Messages: 63
Registered: May 2019
Member
Thank you for your answer. I made a short test and it worked exactly the way I wanted.

regards,

Julien
Previous Topic: Custom Validation Rules Not Working
Next Topic: VPDSL ecore package capitalized
Goto Forum:
  


Current Time: Mon Mar 30 17:31:08 EST 2020

Total time taken to generate the page: 0.01775 seconds