Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » How to give the ID for dynamically created elements, and where to save the values
How to give the ID for dynamically created elements, and where to save the values [message #1792107] Wed, 11 July 2018 14:54 Go to next message
Pratiksha Dalal is currently offline Pratiksha DalalFriend
Messages: 19
Registered: May 2018
Junior Member
Hello all,
I am creating elements dynamically in to a section as in the attached screenshot.
index.php/fa/33363/0/
I didn't do the createInstance method as I need only standard elements. Hope this approach is ok.
Now my question is - how do I give the IDs to the newly added elements and big question is where I store them? Hope I don't need to define the placeholders in the ecore! Can I store them in a Java service? may be?
Appreciate any help in this regard.
- P

[Updated on: Wed, 11 July 2018 14:56]

Report message to a moderator

Re: How to give the ID for dynamically created elements, and where to save the values [message #1792162 is a reply to message #1792107] Thu, 12 July 2018 09:27 Go to previous messageGo to next message
Pierre-Charles David is currently offline Pierre-Charles DavidFriend
Messages: 440
Registered: July 2009
Senior Member
Hi,

I'm not sure I correctly understand the question, and in particular which IDs for which "newly added elements". If the question is about the "Id" of the widgets that will be instanciated at runtime by the "For" loop visible in your screenshot, a fixed Id is enough inside the .odesign. If at runtime the "For" loop instanciates 10 concrete "Default Logout CN" widgets, the Sirius/EEF runtime will make sure they each get a unique id internally.

Regards,


Pierre-Charles David - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: How to give the ID for dynamically created elements, and where to save the values [message #1792173 is a reply to message #1792162] Thu, 12 July 2018 10:21 Go to previous messageGo to next message
Pratiksha Dalal is currently offline Pratiksha DalalFriend
Messages: 19
Registered: May 2018
Junior Member
Hi Pierre, thanks for your reply. Its great to know that each element inside my for loop (yes, you are right in your assumption) indeed is getting a unique id. That makes my life much easier. However, I'm not sure about -
a. how to get the dynamic ids that are generated
b. where does the value getting stored so that we can read the values that are set. We need this information in two places - one in the control itself (Value Expression) and the other (in the Feature Name) under the Set operation.
Regards
-Pratiksha
Re: How to give the ID for dynamically created elements, and where to save the values [message #1792186 is a reply to message #1792173] Thu, 12 July 2018 12:12 Go to previous messageGo to next message
Pierre-Charles David is currently offline Pierre-Charles DavidFriend
Messages: 440
Registered: July 2009
Senior Member
We may not be talking about the same things after all. The ones I was referring to are purely technical details of how the Sirius/EEF runtime produces the SWT UI elements needed for a particular semantic element you select. They are never stored anywhere and there is no reason I can see to need them in the Value Expression or Set operation.

In the Value Expression of Set operation, you are in the context of your semantic elements. If your "For" loop has produced 10 Text Widgets for different values of your iterator ("i" in your example), each widget will have the same value of "self", but a different value of "i". You can use those in your "Value Expression" to compute the text that should be displayed for the "i" property of the "self" semantic element. Inside the "Begin" callback (which is called when the user changes the content of the text widget) you still have access to those and also to the "newValue" which corresponds to the text entered by the user. So you can use those 3 to set the "i" property of the "self" semantic element to the "newValue" (whatever that means concretely in you context).

At no point should you need the ids of the model elements that Sirius has created internally to render the properties view's widgets and wire them and their callbacks together.


Pierre-Charles David - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: How to give the ID for dynamically created elements, and where to save the values [message #1792244 is a reply to message #1792186] Fri, 13 July 2018 07:54 Go to previous messageGo to next message
Pratiksha Dalal is currently offline Pratiksha DalalFriend
Messages: 19
Registered: May 2018
Junior Member
Hello Pierre, thanks once again for bringing the clarity in to this. Here is my problem. I have no issues in displaying the dynamic texts in the pop up. However, I do have text boxes and other elements in the popup for whose I need to store the values for my further processing.
index.php/fa/33391/0/
So, if I dont mention the variable in the Set, how do I read it back?
Thanks in advance Pierre for your patience ;)
-Pratiksha
Re: How to give the ID for dynamically created elements, and where to save the values [message #1792489 is a reply to message #1792244] Wed, 18 July 2018 15:18 Go to previous message
Pierre-Charles David is currently offline Pierre-Charles DavidFriend
Messages: 440
Registered: July 2009
Senior Member
Sorry for the delay, I had missed your answer.

The wizards and dialogs configure in the Sirius VSM actually behave exactly like a property sheet (for all intent and purpose, they are just property sheets displayed in a top-level window). When you open such a dialog, it must be bound to a particular element in your model, and every edition performed in the widgets is immediatly applied to the model. Exactly like in the property view. So the answer to "where does this get stored" is "somewhere in your model" (exactly where is up to you, and depends on how you configures your modeler).


Pierre-Charles David - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Previous Topic:Any support for spinning wheel/ wait gif in Sirius?
Next Topic:create and modify external resources for each diagram
Goto Forum:
  


Current Time: Thu Sep 20 22:10:47 GMT 2018

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

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

Back to the top