Aleks,

You are right, the ResponseElement interface does not allow lookup of a
specific nested object.  I don't believe that it was a particular design
decision, probably just overlooked.  Also, the default implementation of
response elements stores the nested elements in a private ArrayList, so there
is no way to extend and cast it and then lookup by name as a workaround either.

The only thing I can think of is if you add the nested object using the
setAttribute(String key, Object value) method (instead of add(ResponseElement
re), then there is a getAttribute(String key) method.  Although, sematically
this may not be the correct way to nest elements, it might work.

In the future, we probably ought to consider adding a get(String name) method
to the interface.  Mike, what do you think?

Shash

> Hi all,
> 
> I would like to nest some output(out) and input(in) objects like this:
> 
> forms
> |---form1(out)
> |---form2(out)
> |---form3(out)
> |---+form4(out)
>     |---block1(out)
>     |---block2(out)
>     |---block3(out)
>     |---+block4(out)
>         |---input1(in)
>         |---input2(in)
>         |---input3(in)
>         |---input4(in)
> 
> The process I have right now is like this:
> 1. create a "forms" output if not contained in "ModelResponse"
> 2. create form output if not contained in "forms"
> 3. create block output if not contained in selected form
> 4. create input if not contained in selected block
> 
> Espececially the task "if not contained" is giving me a hard time... 
> with the response object this is easy to do (res.get("name")), but 
> "ResponseElement" objects don't have a "get" method. So... here are 
> my questions...
> 
> 1. How can I find out if an output object is contained in another one?
> 2. Do I really have to do a "out.getAll().iterate()" and go over all 
> entries (this is what I'm doing now)?
> 3. Is there another way to perform this task?
> 
> Thanks in advance...
> 
> Aleks
> http://keelframework.org/documentation
> Keelgroup mailing list
> [EMAIL PROTECTED]
> http://lists.keelframework.com/listinfo.cgi/keelgroup-keelframework.com



http://keelframework.org/documentation
Keelgroup mailing list
[EMAIL PROTECTED]
http://lists.keelframework.com/listinfo.cgi/keelgroup-keelframework.com

Reply via email to