2 Replies Latest reply: Oct 17, 2012 9:27 AM by Eogan RSS

    how to create multiple component instances at runtime using java

    Ashok singam

      I need to create component instances at runtime using java.I found ComponentSet.add method.But I am not finding a way to get handle of ComponentSet.
      I see methods with params of IRuntimeNode.But how to get ComponentSet from IRuntimeNode.

      If anybody knows or have sampel code then please share with me.

        • 1. Re: how to create multiple component instances at runtime using java
          There are 2 possible ways to deal with this -
          a. You may direct pass the Model (node) as the parameter to the function while create the CX binding.
          b. If you are already passing or at the parent level of the Runtime Node structure, you may then traverse through the Runtime Tree to search for the ComponentSet name to get the handle.

          It would nice to know which worked for you, if possible elaborate your case.

          Piyush Ohri
          • 2. Re: how to create multiple component instances at runtime using java
            Ashok --

            This is a common challenge for those using Configurator Extensions with multiple instantiation for the first time. The problem is that the CIO's representation of the structure for multiply-instantiable Components differs slightly from what both Configurator Developer users and Configurator Runtime users see in those respective applications. Multiply-instantiable Components are not direct children of the Model in which they're defined. Internally, there is an entity that sits between the parent Model and the instantiable Components; that intermediate entity is the ComponentSet object you've found in the CIO documentation.

            If the name of your multiply-instantiable Component is "My Component", then its ComponentSet may be accessed simply by calling getChildByName("My Component") on its parent Model; a List of the instantiated Components may be accessed with the ComponentSet's getChildComponentNodes() method, and instances may be added and deleted using its add() and delete() methods.

            Hope this helps.