Skip to Content
author's profile photo Former Member
Former Member

Make copies of an object dynamically by Code ?

Hi everyone,

After all... thanks for your help, believe that I found more valuable help here than in marketplace. =)

THE question of this time is: I have a group created in design time, then I need to make several copies of it in runtime (with code).

How can I make these copies ? I found the object WDCopyService but I can't make an instance of the class =(

Any valuable help with this ?

Regards from Mexico =)

Diego

Add a comment
10|10000 characters needed characters exceeded

Related questions

4 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Nov 27, 2004 at 09:57 AM

    What exactly do you want to copy? How does your use case look like?

    Armin

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      I see 2 possibilities:

      1. Create a Web Dynpro component for those UI parts that have the same structure. Embed instances of this component in views using IWDViewContainerUIElement placeholders.

      or

      2. Implement a method which creates the UI tree for similar parts, and provide method parameters to create the variants. Call this method at appropriate times in wdDoModifyView() to initialize/modify the view structure.

      Cloning of UI trees created at design time is not trivial, so I would not suggest to do this.

      Armin

  • author's profile photo Former Member
    Former Member
    Posted on Nov 27, 2004 at 10:51 AM

    <i>How can I make these copies ? I found the object WDCopyService but I can't make an instance of the class =(</i>

    Because it is so-called Booch Utility Class -- class sole purpose of which is to provide static utility methods. so what you can is call directly WDCopyService.copyCorresponding(...) or other methods

    <BR/>

    VS

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Nov 29, 2004 at 03:19 PM

    Hallo Diego,

    the WDCopyService class is only used for copying node elements form one context (model or value) node to another based on equal attribute names and compatible attribute types.

    But, as I assume, this is not the right copy service for your requirement. You probably want to copy UI-element subtrees starting from an existing root UI-element, e.g. a Group. For this scenario Armin can give you an answer.

    Greetings, Bertram

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 30, 2004 at 12:15 PM

    As Bertram point this out you took wrong direction.

    What you need is to traverse recursively UI elements from cloning target (inclusive), going into recursion on any that implements IWDUIElementContainer and apply a bit of Java Reflection on every step to copy property values / bindings.

    VS

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.