Simon,
thank you once more.
I've tried the solution you provided, without the unnecessary component .
Apparently everything runs fine on the background (things get invoked,
properties get updated), but still neither the clicked tab becomes selected
nor does the outputText get updated.
On the first render of the page I get this warning twice:
WARNING: The viewId property in ViewIdPropertyMenuModel is null. The
viewId property is needed to find the focus rowKey.
5/Jul/2007 10:29:30
org.apache.myfaces.trinidad.model.ViewIdPropertyMenuModel _addToMap
Then, when I click a tab, I get it twice more and then refreshIt is called
(I'm printing something to the logs).
Might something still be missing? Maybe some way to tell the component to
generate an event which alerts its registered partialTriggers... Although
having it be partially re-rendered ought to do it.
Francisco
On 7/4/07, Simon Lessard <[EMAIL PROTECTED]> wrote:
>
> Hello Francisco,
>
> This is not how you must deal with binding. You can still let JSF
> initialise the component. You'll need something like the following:
>
> public class MyBeanClass
> {
> private UIComponent myNavigationPane;
>
> public UIComponent getMyNavigationPane()
> {
> return myNavigationPane;
> }
>
> public void setMyNavigationPane(UIComponent myNavigationPane)
> {
> this.myNavigationPane = myNavigationPane;
> }
>
> public void refreshIt(ActionEvent ev)
> {
> RequestContext.getCurrentInstance().addPartialTarget(myNavigationPane);
> }
> }
>
> In the page do the following:
>
> <tr:navigationPane id="tabber" hint="tabs" value="#{
> fichaBean.gruposAtributos}" var="grupoAtributos" binding="#{
> myBean.myNavigationPane}">
> <f:facet name="nodeStamp">
> <tr:commandNavigationItem action="#{fichaBean.selectGroup}" id="tab"
> text="#{grupoAtributos.ndenomin}" partialSubmit="true" selected="#{
> grupoAtributos.igrupoid eq fichaBean.selectedGroupId}"
> actionListener="#{myBean.refreshIt }">
> <tr:setActionListener from="#{grupoAtributos.igrupoid}" to="#{
> fichaBean.selectedGroupId }" />
> </tr:commandNavigationItem>
> </f:facet>
> </tr:navigationPane>
>
> <tr:outputText value="#{fichaBean.selectedGroupId}"
> partialTriggers="tabber" />
>
>
> ~ Simon
>
> On 7/4/07, Francisco Passos <[EMAIL PROTECTED]> wrote:
> >
> > I'm on it. Having to create the binding is not dramatic :) I'm having
> > this exception though:
> >
> > java.lang.NullPointerException
> > at
> > org.apache.myfaces.trinidad.component.UIXComponentBase.getClientId(
> > UIXComponentBase.java :261)
> > at
> >
org.apache.myfaces.trinidadinternal.context.RequestContextImpl.addPartialTarget
> > (RequestContextImpl.java:488)
> > at pt.dgaiec.stp.beans.FichaBean.<init>(FichaBean.java:43)
> > at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
> > at sun.reflect.NativeConstructorAccessorImpl.newInstance(
> > NativeConstructorAccessorImpl.java:39)
> > Truncated. see log file for complete stacktrace
> >
> >
> > This is how I declared the reference:
> > private transient CoreNavigationPane navigationPane = new
> > CoreNavigationPane();
> >
> >
> > this is the xhtml now:
> >
> > <tr:navigationPane binding="#{fichaBean.navigationPane}" id="tabber"
> > hint="tabs" value="#{fichaBean.gruposAtributos}" var="grupoAtributos"
> > >
> > <f:facet name="nodeStamp">
> > <tr:commandNavigationItem action="#{fichaBean.selectGroup}"
> > id="tab" text="#{grupoAtributos.ndenomin}" partialSubmit="true"
> > selected="#{grupoAtributos.igrupoid eq fichaBean.selectedGroupId}"
> > partialTriggers=":">
> > <tr:setActionListener from="#{grupoAtributos.igrupoid}"
> > to="#{fichaBean.selectedGroupId}" />
> > </tr:commandNavigationItem>
> > </f:facet>
> > </tr:navigationPane>
> >
> > <tr:outputText id="texty" value="#{fichaBean.selectedGroupId}"
> > partialTriggers="tabber" />
> >
> >
> > and this is the action called when a tab is clicked:
> >
> > public void selectGroup() {
> > RequestContext.getCurrentInstance
> > ().addPartialTarget(navigationPane);
> > }
> >
> > I should mention that on the first render (before getting the
> > exception), I get this warning on the logs:
> >
> > 4/Jul/2007 19:27:40
> > org.apache.myfaces.trinidad.model.ViewIdPropertyMenuModel _addToMap
> > WARNING: The viewId property in ViewIdPropertyMenuModel is null. The
> > viewId property is needed to find the focus rowKey.
> >
> > I understand there's an id missing. I just can't figure out where and
> > probably am going to start spreading ids all over the tags that don't have
> > one to see if anything changes.
> >
> > It is probably a good time to thank you and the members here on the
> > list that have helped me out over the past weeks. So, thank you. I figure
> > either I'll get good at this or I'll get banned from the list :)
> >
> > Francisco
> >
> > On 7/4/07, Simon Lessard < [EMAIL PROTECTED]> wrote:
> > >
> > > Hello again,
> > >
> > > you can add a component to the list of component to refresh during a
> > > PPR request by using the following code snippet:
> > >
> > > RequestContext.getCurrentInstance().addPartialTarget(componentToRefresh);
> > >
> > > Sadly you'll have to use binding attribute on our navigationPane to
> > > get a ref to the UIComponent.
> > >
> > > Regards,
> > >
> > > ~ Simon
> > >
> > > On 7/4/07, Francisco Passos <[EMAIL PROTECTED]> wrote:
> > > >
> > > > programatically add the navigationPane as a partialTarget using
> > > > > RequestContext
> > > >
> > > >
> > > > Sorry for asking, but how can I do this? Is there documentation on
> > > > this?
> > > >
> > > > Thank you for your support.
> > > >
> > > > Francisco
> > > >
> > > >
> > > > On 7/4/07, Simon Lessard <[EMAIL PROTECTED]> wrote:
> > > > >
> > > > > Hello Francisco,
> > > > >
> > > > > your problem is with partialTriggers, you must not use "tab" the
> > > > > id of the navigation item won't be simply that. since navigationPane
is an
> > > > > UIXIterator, it's also a NamingContainer, thus it will generated
different
> > > > > client ids including the rowKey. You might have to programatically
add the
> > > > > navigationPane as a partialTarget using RequestContext. You can then
set the
> > > > > partialTriggers value of your outputText to the navigationPane's id.
I think
> > > > > it will work.
> > > > >
> > > > >
> > > > > Regards,
> > > > >
> > > > > ~ Simon
> > > > >
> > > > > On 7/4/07, Francisco Passos < [EMAIL PROTECTED]> wrote:
> > > > >
> > > > > >
> > > > > > I meant panelTabbed, sorry.
> > > > > >
> > > > > > On 7/4/07, Francisco Passos <[EMAIL PROTECTED] >
> > > > > > wrote:
> > > > > > >
> > > > > > > Just tried setting partialTriggers="tab" on the panelPage.
> > > > > > > Same thing still.
> > > > > > >
> > > > > > > On 7/4/07, Simon Lessard < [EMAIL PROTECTED]> wrote:
> > > > > > > >
> > > > > > > > Hello Francisco,
> > > > > > > >
> > > > > > > > Hmmm, strange... Did you try to set a partialTriggers on
> > > > > > > > the navigationPane?
> > > > > > > >
> > > > > > > >
> > > > > > > > Regards,
> > > > > > > >
> > > > > > > > ~ Simon
> > > > > > > >
> > > > > > > > On 7/4/07, Francisco Passos <[EMAIL PROTECTED]>
> > > > > > > > wrote:
> > > > > > > > >
> > > > > > > > > Renzo, yours is a cool solution, but it depends on the
> > > > > > > > > way the subcomponents are stamped, which is an information I
believe we
> > > > > > > > > theoretically shouldn't depend on, unless we had some kind of
control over
> > > > > > > > > the way the stamping goes.
> > > > > > > > >
> > > > > > > > > Simon, I'm trying your solution and here's what I've
> > > > > > > > > come to:
> > > > > > > > >
> > > > > > > > > <tr:navigationPane id="tabber" hint="tabs" value="#{
> > > > > > > > > fichaBean.gruposAtributos}" var="grupoAtributos">
> > > > > > > > > <f:facet name="nodeStamp">
> > > > > > > > > <tr:commandNavigationItem action="#{
> > > > > > > > > fichaBean.selectGroup}" id="tab" text="#{
> > > > > > > > > grupoAtributos.ndenomin}" partialSubmit="true"
> > > > > > > > > selected="#{ grupoAtributos.igrupoid eq
> > > > > > > > > fichaBean.selectedGroupId}">
> > > > > > > > > <tr:setActionListener from="#{
> > > > > > > > > grupoAtributos.igrupoid}" to="#{
> > > > > > > > > fichaBean.selectedGroupId}" />
> > > > > > > > > </tr:commandNavigationItem>
> > > > > > > > > </f:facet>
> > > > > > > > > </tr:navigationPane>
> > > > > > > > >
> > > > > > > > > <tr:outputText value="#{fichaBean.selectedGroupId}"
> > > > > > > > > partialTriggers="tab" />
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > I've checked that the selectedGroupId property is being
> > > > > > > > > updated when I click on the tab, which is the good news :)
> > > > > > > > >
> > > > > > > > > The bad news is that the tab isn't changing its aspect
> > > > > > > > > to show it is selected. And the outputText below does not
update either.
> > > > > > > > > I've tried setting partialTriggers to "tab" as well as
"tabber". What am I
> > > > > > > > > still missing?
> > > > > > > > >
> > > > > > > > > On 7/4/07, Renzo Tomaselli <[EMAIL PROTECTED]>
> > > > > > > > > wrote:
> > > > > > > > > >
> > > > > > > > > > I simply parse the component id. Being an iterating
> > > > > > > > > > component - Tridindad adds a progressive index while
stamping out
> > > > > > > > > > subcomponents:
> > > > > > > > > >
> > > > > > > > > > public void navigation(ActionEvent event) {
> > > > > > > > > > FacesContext fc =
> > > > > > > > > > FacesContext.getCurrentInstance();
> > > > > > > > > > UIComponent actionItem = event.getComponent();
> > > > > > > > > > String id = actionItem.getClientId(fc);
> > > > > > > > > > int i = id.lastIndexOf(
> > > > > > > > > > NamingContainer.SEPARATOR_CHAR);
> > > > > > > > > > if (i >= 0) {
> > > > > > > > > > id = id.substring(0, i);
> > > > > > > > > > i = id.lastIndexOf(
> > > > > > > > > > NamingContainer.SEPARATOR_CHAR);
> > > > > > > > > > id = id.substring(i + 1);
> > > > > > > > > > int newSelected = Integer.parseInt(id);
> > > > > > > > > > .....
> > > > > > > > > >
> > > > > > > > > > This should work well for all Trinidad iterating
> > > > > > > > > > components, provided that stamping includesTrinidad
components only.
> > > > > > > > > > Otherwise, the index can be easily forgotten by Trinidad
(then duplicated id
> > > > > > > > > > warnings), don't ask me why.
> > > > > > > > > >
> > > > > > > > > > -- Renzo
> > > > > > > > > >
> > > > > > > > > > Francisco Passos wrote:
> > > > > > > > > >
> > > > > > > > > > Thank you, your example is great.
> > > > > > > > > >
> > > > > > > > > > However, how do you know what tab has been clicked, so
> > > > > > > > > > you can act accordingly on the actionListener?
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > On 7/2/07, * Renzo Tomaselli* <
> > > > > > > > > > [EMAIL PROTECTED]> wrote:
> > > > > > > > > >
> > > > > > > > > > Francisco,
> > > > > > > > > > component tr:navigationPane is an iterating
> > > > > > > > > > component by itself - no need for an explicit loop. I do it
like this (using
> > > > > > > > > > Facelets):
> > > > > > > > > >
> > > > > > > > > > <ui:component>
> > > > > > > > > > <c:if test="#{bean.visible}">
> > > > > > > > > > <t:saveState id="selected" value="#{
> > > > > > > > > > bean.selected}"/>
> > > > > > > > > > <t:saveState id="tabs" value="#{bean.tabs}"/>
> > > > > > > > > > <tr:navigationPane id="tabber" hint="tabs"
> > > > > > > > > > value="#{bean.tabModel}" var="tab"
> > > > > > > > > > styleClass="navigator">
> > > > > > > > > > <f:facet name="nodeStamp">
> > > > > > > > > > <tr:commandNavigationItem text="#{
> > > > > > > > > > tab.label}" actionListener="#{bean.navigation}"
> > > > > > > > > > id="tab"
> > > > > > > > > > selected="#{cx:isSelected(bean, tab)}" icon="#{
> > > > > > > > > > tab.icon}"/>
> > > > > > > > > > </f:facet>
> > > > > > > > > > </tr:navigationPane>
> > > > > > > > > > <cx:include src="#{bean.component}" bean="#{
> > > > > > > > > > bean.componentBean}" container="#{container}tabby:"/>
> > > > > > > > > > </c:if>
> > > > > > > > > > </ui:component>
> > > > > > > > > >
> > > > > > > > > > Here everythings - from the tab list to the child
> > > > > > > > > > component to appear below the tabs - is dynamically taken
from a bean.
> > > > > > > > > > Tab list and current selection are made persistent
> > > > > > > > > > across requests by means of saveState (my beans are only
request-scoped).
> > > > > > > > > > Hope it helps.
> > > > > > > > > >
> > > > > > > > > > -- Renzo
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > Francisco Passos wrote:
> > > > > > > > > >
> > > > > > > > > > By the way, I'm trying to populate dinamically either
> > > > > > > > > > a panelTabbed or a navigationPane.
> > > > > > > > > >
> > > > > > > > > > When using ui:repeat, panelTabbed renders incorrectly
> > > > > > > > > > (no content appears) and this is shown on the logs:
> > > > > > > > > > WARNING: Only tr:showDetailItem is allowed as child of
> > > > > > > > > > tr:panelTabbed.
> > > > > > > > > >
> > > > > > > > > > When using ui:repeat and navigationPane, an exception
> > > > > > > > > > is thrown:
> > > > > > > > > > SEVERE: Warning: illegal component hierarchy detected,
> > > > > > > > > > expected UIXCommand but found another type of component
instead.
> > > > > > > > > > java.lang.ClassCastException :
> > > > > > > > > > com.sun.facelets.component.UIRepeat
> > > > > > > > > >
> > > > > > > > > > I'm going to try my luck with JSTL now, nevertheless
> > > > > > > > > > if you know of a solution, do tell :)
> > > > > > > > > >
> > > > > > > > > > --Francisco
> > > > > > > > > >
> > > > > > > > > > On 7/2/07, * Francisco Passos* <
> > > > > > > > > > [EMAIL PROTECTED]> wrote:
> > > > > > > > > >
> > > > > > > > > > Simon and Matthias,
> > > > > > > > > >
> > > > > > > > > > thank you for clearing my doubt. By the way, if I may
> > > > > > > > > > leave the suggestion, it would be cool if panelTabbed had
alternative ways
> > > > > > > > > > for presentation, much like navigationPage.
> > > > > > > > > >
> > > > > > > > > > As far as the wiki, I've added the missing entry to
> > > > > > > > > > the page for completeness, although obviously it may still
be incomplete.
> > > > > > > > > >
> > > > > > > > > > --Francisco
> > > > > > > > > >
> > > > > > > > > > On 7/2/07, *Matthias Wessendorf* < [EMAIL PROTECTED]>
> > > > > > > > > > wrote:
> > > > > > > > > >
> > > > > > > > > > Francisco,
> > > > > > > > > >
> > > > > > > > > > we started a wiki, containing infos like this, in the
> > > > > > > > > > past,
> > > > > > > > > > but never updated it.
> > > > > > > > > >
> > > > > > > > > > feel free to join ;-)
> > > > > > > > > >
> > > > > > > > > > -M
> > > > > > > > > >
> > > > > > > > > > On 7/2/07, Simon Lessard < [EMAIL PROTECTED]>
> > > > > > > > > > wrote:
> > > > > > > > > > > Hello Francisco,
> > > > > > > > > > >
> > > > > > > > > > > No, menuTabs was replaced by navigationPane with
> > > > > > > > > > hint attribute set to tabs.
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > > Regards,
> > > > > > > > > > >
> > > > > > > > > > > ~ Simon
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > > On 7/2/07, Francisco Passos <
> > > > > > > > > > [EMAIL PROTECTED]> wrote:
> > > > > > > > > > > > Thank you.
> > > > > > > > > > > >
> > > > > > > > > > > > The correspondence I couldn't find in the wiki was
> > > > > > > > > > for the component
> > > > > > > > > > > af:menuTabs, but probably panelTabbed also replaces
> > > > > > > > > > it.
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > > On 6/29/07, Adam Winer < [EMAIL PROTECTED]> wrote:
> > > > > > > > > > > > > Actually, the Wiki page shows the renaming:
> > > > > > > > > > > > > panelTabbed was formerly called showOneTabs.
> > > > > > > > > > > > >
> > > > > > > > > > > > > There's an example in trinidad-demo.
> > > > > > > > > > > > >
> > > > > > > > > > > > > -- Adam
> > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > > > On 6/29/07, Francisco Passos <
> > > > > > > > > > [EMAIL PROTECTED] > wrote:
> > > > > > > > > > > > > > Hello there.
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > I'm evaluating the usage of a panelTabbed. Are
> > > > > > > > > > there any working
> > > > > > > > > > > examples of
> > > > > > > > > > > > > > this component?
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > The only example I have is from an ADF Faces
> > > > > > > > > > app, which uses
> > > > > > > > > > > af:menuTabs,
> > > > > > > > > > > > > > but
> > > > > > > > > > http://wiki.apache.org/myfaces/Trinidad_renaming
> > > > > > > > > > > does
> > > > > > > > > > > > > > not mention any changes to this component.
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > Thanks,
> > > > > > > > > > > > > > Francisco
> > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > --
> > > > > > > > > > Matthias Wessendorf
> > > > > > > > > >
> > > > > > > > > > further stuff:
> > > > > > > > > > blog: http://matthiaswessendorf.wordpress.com/
> > > > > > > > > > mail: matzew-at-apache-dot-org
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>