You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Martin Ahrer <ma...@gmx.at> on 2007/07/30 13:59:08 UTC

[Trinidad] selectOneChoice referencing a value with a type that uses inheritance

I'm facing some Trinidad behaviour that I'm not able to explain. I have an
inheritance hierarchy consisting of 3 classes like:
ReportGroup->FolderItem->AbstractTreeItem. 
AbstractTreeItem has a self reference (to make up a tree!) represented by a
property parent of type AbstractTreeItem (with corresponding accessor and
mutator method).

In some form for a ReportGroup instance I try to  show a selectOneChoice so
that a user can select a parent for this instance. 
&lt;tr:selectOneChoice value="#{bean.currentObject.parent}" ...&gt;. (bean
is the managed bean handling the form, currentObject is a bean of type
ReportGroup).

An embedded &lt;f:selectItems value="#{bean.selectItems}"/&gt; element
delivers beans of type ReportGroup to choose from.


When running the JSP containing the form no select box is shown (and of
course the selectItems are never populated). However as soon as I add
(overrride) the setParent() and the getParent() method in ReportGroup the
select box is shown and everything works properly! 

	@Override
	public AbstractTreeItem getParent() {
		return (AbstractTreeItem) super.getParent();
	}

	@Override
	public void setParent(AbstractTreeItem reportFolder) {
		super.setParent(reportFolder);
	}

So it looks that the trinidad selectOneChoice control does not recognize
that there is are inherited setParent() and getParent() methods????

Anybody there who has an idea what's going on? I really want to avoid to
duplicate my accessor and mutator methods that are already present in an
base class down the inheritance tree!!

Thanks
  Martin
-- 
View this message in context: http://www.nabble.com/-Trinidad--selectOneChoice-referencing-a-value-with-a-type-that-uses-inheritance-tf4169672.html#a11862406
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: [Trinidad] selectOneChoice referencing a value with a type that uses inheritance

Posted by Adam Winer <aw...@gmail.com>.
Are any of the classes in that hierarchy package-private?

This isn't a Trinidad thing - what's likely happening is that
the getter/setter methods aren't visible according
to JavaBean rules, so the JavaBean API isn't identifying
the existence of the property.

-- Adam


On 7/30/07, Martin Ahrer <ma...@gmx.at> wrote:
>
> I'm facing some Trinidad behaviour that I'm not able to explain. I have an
> inheritance hierarchy consisting of 3 classes like:
> ReportGroup->FolderItem->AbstractTreeItem.
> AbstractTreeItem has a self reference (to make up a tree!) represented by a
> property parent of type AbstractTreeItem (with corresponding accessor and
> mutator method).
>
> In some form for a ReportGroup instance I try to  show a selectOneChoice so
> that a user can select a parent for this instance.
> &lt;tr:selectOneChoice value="#{bean.currentObject.parent}" ...&gt;. (bean
> is the managed bean handling the form, currentObject is a bean of type
> ReportGroup).
>
> An embedded &lt;f:selectItems value="#{bean.selectItems}"/&gt; element
> delivers beans of type ReportGroup to choose from.
>
>
> When running the JSP containing the form no select box is shown (and of
> course the selectItems are never populated). However as soon as I add
> (overrride) the setParent() and the getParent() method in ReportGroup the
> select box is shown and everything works properly!
>
>         @Override
>         public AbstractTreeItem getParent() {
>                 return (AbstractTreeItem) super.getParent();
>         }
>
>         @Override
>         public void setParent(AbstractTreeItem reportFolder) {
>                 super.setParent(reportFolder);
>         }
>
> So it looks that the trinidad selectOneChoice control does not recognize
> that there is are inherited setParent() and getParent() methods????
>
> Anybody there who has an idea what's going on? I really want to avoid to
> duplicate my accessor and mutator methods that are already present in an
> base class down the inheritance tree!!
>
> Thanks
>   Martin
>
> --
> View this message in context: http://www.nabble.com/-Trinidad--selectOneChoice-referencing-a-value-with-a-type-that-uses-inheritance-tf4169672.html#a11862406
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>
>