cancel
Showing results for 
Search instead for 
Did you mean: 

Alternative access to the dynamically generated UI Elements

Former Member
0 Kudos

Hi All,

I have a scenario that involves accessing the ui controls that are dynamically generated. I access them through there IDs.But, I would rather prefer to access them alteratively like through there type which would add on the reusability of the code.Is there a work around in webdynpro that can enumerate all the ui elements of a particular view.

Regards

Amit

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

If you really need to iterate through the complete UI tree of a view in a generic fashion, you can use the method described in Chris Whealys book "Inside Web Dynpro for Java", chapter 8.3.2.

If it is sufficient to iterate through the children of some containers whose IDs are known, you can use

IWDUIElementContainer container = (IWDUIElementContainer) view.getElement("ID");
for (Iterator children = container.iterateChildren(); children.hasNext(); )
{
  IWDUIElement child = (IWDUIElement) children.next();
  /* do something with child */
}

Armin

Former Member
0 Kudos

Hi,

If its not a nested hierarchy ,

using a getChildren() on the container would do..

    IWDTransparentContainer tc = (IWDTransparentContainer)view.getElement("RootUIElementContainer");
    IWDUIElementContainer[] uilist  = tc.getChildren();

But nested ones are more complicated..Would this suffice your requirement ?

Whats the actual requirement you are looking at.. ?

Regards

Bharathwaj

abhijeet_mukkawar
Active Contributor
0 Kudos

Amit,

I dont think there is any work around for accessing UI element. As far as I know ids only are used for accessing them.

regards