Hey, thanks Jian.

What I've been doing is something like this, which doesn't work for
"special" list element UiObjects (those with 'all' as their uid)

        private String getFullyQualifiedUid(UiObject obj) {
                if ( obj.getParent() != null) {
                        return 
getFullyQualifiedUid(obj.getParent())+"."+obj.getUid();
                } else {
                        return obj.getUid();
                }

        }

Then for all container objects, I iterate over each component within,
and do:

        private void tryToWalk(UiObject obj) {
                // stuff removed for brevity ...

                if ( obj instanceof Container) {
                        obj.components.each {child ->

                                // print out some debug info
                                printInfoForObject(child.getValue())

                                descendent = obj.walkTo(ctx, 
UiID.convertToUiID(child.getValue
().uid));
                                fqUid = getFullyQualifiedUid(child.getValue());

                                if ( descendent ) {
                                        println("${fqUid}.walkTo: PASS: (from 
${obj.uid})");
                                        tryToWalk(descendent);
                                }
                                // ...
                        }
                }
        }

So the question is...what do I do when a component within a container
has a uid of 'all'  -- I tried appending an index to the uid and
passing it in, like 'UiID.convertToUiID(parentObj.uid+"[${idx}]") but
that doesn't seem to produce a valid UiID.

thanks!
Jason



On Jun 20, 4:35 pm, Jian Fang <[email protected]> wrote:
> Another way is to get the list size at runtime and then enumerate all the
> children of the List.
> For efficient purpose, it is better to be implemented at the Engine side so
> that you can
> get back all the information in one method call, which would be at least
> tens of times faster.
> Also, I prefer to name this method as takeSnapShot(uid), which is really to
> take a snapshot
> of the UI module.
>
> However, you are encouraged to go ahead to implement your own idea because
> it may
> take a while for us to get there.
>
> Thanks,
>
> Jian
>
> On Sat, Jun 20, 2009 at 5:01 PM, Jian Fang <[email protected]> wrote:
> > Jason,
>
> > The List is designed for dynamic elements so that you should use UI
> > templates
> > to represent them. Since the dynamic nature of the List, you may not really
> > know
> > how many elements in the List until at runtime.
>
> > If you want to print out the whole UI module, one way is to select a sample
> > index
> > for the UI template and you should go over all possible combinations of the
> > UI templates,
> > which is how we did for the dump() method. For example, if you have the
> > following
> > List definition
>
> > List(uid: "List", clocator:[WHATERVER]){
> >     Selector(uid: "1", clocator:[WHATEVER])
> >     InputBox(uid, "2", clocator: [WHATEVER])
> >     TextBox(uid: "all", clocator: [WHATEVER])
> > }
>
> > Then, you should use index "1", "2", and "3" to cover all the possibility
> > at runtime.
>
> > Seems you try to add more debug information to the Dump() method, which is
> > better
> > to be included in Tellurium core. How about we add a Debug() method for
> > this
> > purpose because the Dump() method is really designed for off-line, while
> > Debug()
> > can be used for runtime.
>
> > If you are interested in how Dump() is implemented, you can look at the
> > code
> > for different UI objects.
>
> > Thanks,
>
> > Jian
>
> > On Sat, Jun 20, 2009 at 1:21 PM, Jason <[email protected]> wrote:
>
> >> Hi all,
>
> >> I've been putting together some code for debugging my UI definitions,
> >> and was walking the UI and printing out various debugging bits on each
> >> element -- whether it could be walked, whether it was present, if it
> >> supported getText(), what the value was...etc.  However, I'm having
> >> trouble traversing a list, due to the magic 'all' uid.
>
> >> So basically, I have a UiObject that's descended from a list. How can
> >> I get a valid fq uid from that object to use when passing to the
> >> DslContext, etc?
>
> >> thanks!
> >> Jason
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"tellurium-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/tellurium-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to