You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by md10024 <md...@qwizics.com> on 2007/12/13 02:16:50 UTC

linking to non-default tr:showDetailItem in a tr:panelTabbed

Hi,
I'm using Trinidad with facelets. I have a page "about.xhtml" containing a
tr:panelTabbed that has a default item of "Contact". I would like to also
create a link to the "Company" item on the about.xhtml page. 

How do I programatically reveal the non-default item when linking to this
page?

<<<about.xhtml>>>
<tr:panelTabbed position="above" id="aboutMenu" class="panelClass">
	<tr:showDetailItem id="contactPanel" text="Contact"
		        inlineStyle="float: left">
              <tr:panelHeader text="Contact Us"/>
       </tr:showDetailItem>

	<tr:showDetailItem id="helpPanel" text="Company"
		        inlineStyle="float: left">
               <tr:panelHeader text="Contact Us"/>
       </tr:showDetailItem>
</tr:panelTabbed>

Thanks in advance!

Mark
-- 
View this message in context: http://www.nabble.com/linking-to-non-default-tr%3AshowDetailItem-in-a-tr%3ApanelTabbed-tp14307867p14307867.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: linking to non-default tr:showDetailItem in a tr:panelTabbed

Posted by md10024 <md...@qwizics.com>.
Thanks Gerhard. It was a "real" redirect and changing the scope to "session"
resolved the issue. I'll investigate some custom scope moving forward. I
appreciate your assistance on this!



Gerhard Petracek wrote:
> 
> hello mark,
> 
> you are welcome!
> 
> concerning your second problem:
> are you using a real redirect? (or did you just call it "redirect"?)
> 
> in the case of a real redirect:
> the request scope is too short for such a scenario.
> -> please test it with a session scoped bean (just for testing purpose).
> as final solution use one of the available custom scopes (they are longer
> than request scope and shorter than session scope).
> 
> regards,
> gerhard
> 
> 
> 
> 2007/12/13, md10024 <md...@qwizics.com>:
>>
>>
>> Yes, sorry....I was a little careless in my reading of your post. Using
>> partialTrigger solves the partialSubmit problem when the tr:commandLink
>> is
>> on the same page as the tabSwitcher
>>
>> BUT, when using it from the main.xhtml page     i.e.    <tr:commandLink
>> action="about" id="tabSwitcher" text="show 'Company' tab"
>> actionListener="#{contactForm.showCompanyTab}" />
>>
>> The showCompanyTab(...) method gets called apparently before the redirect
>> to
>> the about.xhtml page so it doesn't take effect
>>
>> In other words, the about.xhtml page gets rendered, the showCompanyTab
>> method gets called but the default panel (not the intended panel) gets
>> rendered. Any ideas?
>>
>> thanks for you patience and cooperation, I'm still trying to master some
>> of
>> the finer details here.
>>
>> Mark
>> --
>> View this message in context:
>> http://www.nabble.com/linking-to-non-default-tr%3AshowDetailItem-in-a-tr%3ApanelTabbed-tp14307867p14323968.html
>> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>>
>>
> 
> 
> -- 
> 
> http://www.irian.at
> 
> Your JSF powerhouse -
> JSF Consulting, Development and
> Courses in English and German
> 
> Professional Support for Apache MyFaces
> 
> 

-- 
View this message in context: http://www.nabble.com/linking-to-non-default-tr%3AshowDetailItem-in-a-tr%3ApanelTabbed-tp14307867p14326174.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: linking to non-default tr:showDetailItem in a tr:panelTabbed

Posted by Gerhard Petracek <ge...@gmail.com>.
hello mark,

you are welcome!

concerning your second problem:
are you using a real redirect? (or did you just call it "redirect"?)

in the case of a real redirect:
the request scope is too short for such a scenario.
-> please test it with a session scoped bean (just for testing purpose).
as final solution use one of the available custom scopes (they are longer
than request scope and shorter than session scope).

regards,
gerhard



2007/12/13, md10024 <md...@qwizics.com>:
>
>
> Yes, sorry....I was a little careless in my reading of your post. Using
> partialTrigger solves the partialSubmit problem when the tr:commandLink is
> on the same page as the tabSwitcher
>
> BUT, when using it from the main.xhtml page     i.e.    <tr:commandLink
> action="about" id="tabSwitcher" text="show 'Company' tab"
> actionListener="#{contactForm.showCompanyTab}" />
>
> The showCompanyTab(...) method gets called apparently before the redirect
> to
> the about.xhtml page so it doesn't take effect
>
> In other words, the about.xhtml page gets rendered, the showCompanyTab
> method gets called but the default panel (not the intended panel) gets
> rendered. Any ideas?
>
> thanks for you patience and cooperation, I'm still trying to master some
> of
> the finer details here.
>
> Mark
> --
> View this message in context:
> http://www.nabble.com/linking-to-non-default-tr%3AshowDetailItem-in-a-tr%3ApanelTabbed-tp14307867p14323968.html
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>
>


-- 

http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces

Re: linking to non-default tr:showDetailItem in a tr:panelTabbed

Posted by md10024 <md...@qwizics.com>.
Yes, sorry....I was a little careless in my reading of your post. Using
partialTrigger solves the partialSubmit problem when the tr:commandLink is
on the same page as the tabSwitcher 

BUT, when using it from the main.xhtml page 	i.e.    <tr:commandLink
action="about" id="tabSwitcher" text="show 'Company' tab"
actionListener="#{contactForm.showCompanyTab}" />

The showCompanyTab(...) method gets called apparently before the redirect to
the about.xhtml page so it doesn't take effect

In other words, the about.xhtml page gets rendered, the showCompanyTab
method gets called but the default panel (not the intended panel) gets
rendered. Any ideas?

thanks for you patience and cooperation, I'm still trying to master some of
the finer details here.

Mark
-- 
View this message in context: http://www.nabble.com/linking-to-non-default-tr%3AshowDetailItem-in-a-tr%3ApanelTabbed-tp14307867p14323968.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: linking to non-default tr:showDetailItem in a tr:panelTabbed

Posted by Gerhard Petracek <ge...@gmail.com>.
hello mark,

@1)
don't forget the partialTriggers-attribute!
please have a second look at my previous mail -> you will find the
following:

        <tr:commandLink id="tabSwitcher" text="show 'Company' tab"
actionListener="#{ bean.showCompanyTab}" partialSubmit="true"/>

        <tr:panelTabbed position="above" id="aboutMenu" class="panelClass"
partialTriggers="tabSwitcher">

-> it also works with the partialSubmit-attribute.

@2)
also this requirement works.
e.g. you can use the same bean within several pages.
(there is also a simple possibility, if you are using different beans...)

(+ don't forget the action-attribute of the link + a proper outcome and
navigation rule)
(in such a case you don't need the partialSubmit-attribute, because you
display a different page...)

regards,
gerhard



2007/12/13, md10024 <md...@qwizics.com>:
>
>
> Gerhard,
>
> That's excellent information, and it works... almost. Two things I find:
>
> 1.    Re: <tr:commandLink ...  partialSubmit="true"/>
>
> I needed to remove the  partialSubmit="true" otherwise I didn't get the
> requested tab rendered.
>
> 2. It works when the  <tr:commandLink... />  is on the same page as the
> tab
> (i.e. about.xhtml) but what if I want to put the the link on a different
> page (ex. main.xhtml) and get the non-default tab on the about.xhtml page
> rendered? This doesn't work for that scenario.
>
>
> Any suggestions?
>
>
>
> Gerhard Petracek wrote:
> >
> > hello mark,
> >
> > e.g.: add an actionListener to your link and the disclosed-attribute to
> > your
> > showDetailItems
> >
> > your snippet (+ modifications):
> >
> >         <tr:commandLink id="tabSwitcher" text="show 'Company' tab"
> > actionListener="#{bean.showCompanyTab}" partialSubmit="true"/>
> >
> >         <tr:panelTabbed position="above" id="aboutMenu"
> class="panelClass"
> > partialTriggers="tabSwitcher">
> >                <tr:showDetailItem id="contactPanel" text="Contact"
> >                                inlineStyle="float: left"
> >                                disclosed="#{bean.showContact}"
> >                                binding="#{bean.contact}">
> >                      <tr:panelHeader text="Contact Us"/>
> >               </tr:showDetailItem>
> >
> >                <tr:showDetailItem id="helpPanel" text="Company"
> >                                inlineStyle="float: left"
> >                                disclosed="#{bean.showCompany}"
> >                                bean="#{bean.company}">
> >                       <tr:panelHeader text="Company"/>
> >               </tr:showDetailItem>
> >         </tr:panelTabbed>
> >
> >
> > in my opinion the disclosed-attribute should be enough.
> > however, at the moment it doesn't work that way.
> > -> you also have to use component binding. (-> you also have to add the
> > binding-attribute - see above)
> >
> > a possible workaround:
> > (don't forget the getter and setter methods)
> >
> > within your bean - e.g.:
> >
> >     private boolean showContact = true;
> >     private boolean showCompany = false;
> >
> >     //workaround:
> >     private CoreShowDetailItem contact;
> >     private CoreShowDetailItem company;
> >
> >     public void showCompanyTab(ActionEvent event)
> >     {
> >         this.showContact = false;
> >         this.showCompany = true;
> >
> >         //workaround:
> >         if(this.contact != null)
> >         {
> >             this.contact.setDisclosed( false );
> >         }
> >         if(this.company != null)
> >         {
> >             this.company.setDisclosed( true );
> >         }
> >     }
> >
> > regards,
> > gerhard
> >
> >
> >
> > 2007/12/13, md10024 <md...@qwizics.com>:
> >>
> >>
> >> Hi,
> >> I'm using Trinidad with facelets. I have a page "about.xhtml"
> containing
> >> a
> >> tr:panelTabbed that has a default item of "Contact". I would like to
> also
> >> create a link to the "Company" item on the about.xhtml page.
> >>
> >> How do I programatically reveal the non-default item when linking to
> this
> >> page?
> >>
> >> <<<about.xhtml>>>
> >> <tr:panelTabbed position="above" id="aboutMenu" class="panelClass">
> >>         <tr:showDetailItem id="contactPanel" text="Contact"
> >>                         inlineStyle="float: left">
> >>               <tr:panelHeader text="Contact Us"/>
> >>        </tr:showDetailItem>
> >>
> >>         <tr:showDetailItem id="helpPanel" text="Company"
> >>                         inlineStyle="float: left">
> >>                <tr:panelHeader text="Contact Us"/>
> >>        </tr:showDetailItem>
> >> </tr:panelTabbed>
> >>
> >> Thanks in advance!
> >>
> >> Mark
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/linking-to-non-default-tr%3AshowDetailItem-in-a-tr%3ApanelTabbed-tp14307867p14307867.html
> >> Sent from the MyFaces - Users mailing list archive at Nabble.com.
> >>
> >>
> >
> >
> > --
> >
> > http://www.irian.at
> >
> > Your JSF powerhouse -
> > JSF Consulting, Development and
> > Courses in English and German
> >
> > Professional Support for Apache MyFaces
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/linking-to-non-default-tr%3AshowDetailItem-in-a-tr%3ApanelTabbed-tp14307867p14320301.html
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>
>


-- 

http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces

Re: linking to non-default tr:showDetailItem in a tr:panelTabbed

Posted by md10024 <md...@qwizics.com>.
Gerhard,

That's excellent information, and it works... almost. Two things I find:

1.    Re: <tr:commandLink ...  partialSubmit="true"/>

I needed to remove the  partialSubmit="true" otherwise I didn't get the
requested tab rendered.

2. It works when the  <tr:commandLink... />  is on the same page as the tab
(i.e. about.xhtml) but what if I want to put the the link on a different
page (ex. main.xhtml) and get the non-default tab on the about.xhtml page
rendered? This doesn't work for that scenario.


Any suggestions?



Gerhard Petracek wrote:
> 
> hello mark,
> 
> e.g.: add an actionListener to your link and the disclosed-attribute to
> your
> showDetailItems
> 
> your snippet (+ modifications):
> 
>         <tr:commandLink id="tabSwitcher" text="show 'Company' tab"
> actionListener="#{bean.showCompanyTab}" partialSubmit="true"/>
> 
>         <tr:panelTabbed position="above" id="aboutMenu" class="panelClass"
> partialTriggers="tabSwitcher">
>                <tr:showDetailItem id="contactPanel" text="Contact"
>                                inlineStyle="float: left"
>                                disclosed="#{bean.showContact}"
>                                binding="#{bean.contact}">
>                      <tr:panelHeader text="Contact Us"/>
>               </tr:showDetailItem>
> 
>                <tr:showDetailItem id="helpPanel" text="Company"
>                                inlineStyle="float: left"
>                                disclosed="#{bean.showCompany}"
>                                bean="#{bean.company}">
>                       <tr:panelHeader text="Company"/>
>               </tr:showDetailItem>
>         </tr:panelTabbed>
> 
> 
> in my opinion the disclosed-attribute should be enough.
> however, at the moment it doesn't work that way.
> -> you also have to use component binding. (-> you also have to add the
> binding-attribute - see above)
> 
> a possible workaround:
> (don't forget the getter and setter methods)
> 
> within your bean - e.g.:
> 
>     private boolean showContact = true;
>     private boolean showCompany = false;
> 
>     //workaround:
>     private CoreShowDetailItem contact;
>     private CoreShowDetailItem company;
> 
>     public void showCompanyTab(ActionEvent event)
>     {
>         this.showContact = false;
>         this.showCompany = true;
> 
>         //workaround:
>         if(this.contact != null)
>         {
>             this.contact.setDisclosed( false );
>         }
>         if(this.company != null)
>         {
>             this.company.setDisclosed( true );
>         }
>     }
> 
> regards,
> gerhard
> 
> 
> 
> 2007/12/13, md10024 <md...@qwizics.com>:
>>
>>
>> Hi,
>> I'm using Trinidad with facelets. I have a page "about.xhtml" containing
>> a
>> tr:panelTabbed that has a default item of "Contact". I would like to also
>> create a link to the "Company" item on the about.xhtml page.
>>
>> How do I programatically reveal the non-default item when linking to this
>> page?
>>
>> <<<about.xhtml>>>
>> <tr:panelTabbed position="above" id="aboutMenu" class="panelClass">
>>         <tr:showDetailItem id="contactPanel" text="Contact"
>>                         inlineStyle="float: left">
>>               <tr:panelHeader text="Contact Us"/>
>>        </tr:showDetailItem>
>>
>>         <tr:showDetailItem id="helpPanel" text="Company"
>>                         inlineStyle="float: left">
>>                <tr:panelHeader text="Contact Us"/>
>>        </tr:showDetailItem>
>> </tr:panelTabbed>
>>
>> Thanks in advance!
>>
>> Mark
>> --
>> View this message in context:
>> http://www.nabble.com/linking-to-non-default-tr%3AshowDetailItem-in-a-tr%3ApanelTabbed-tp14307867p14307867.html
>> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>>
>>
> 
> 
> -- 
> 
> http://www.irian.at
> 
> Your JSF powerhouse -
> JSF Consulting, Development and
> Courses in English and German
> 
> Professional Support for Apache MyFaces
> 
> 

-- 
View this message in context: http://www.nabble.com/linking-to-non-default-tr%3AshowDetailItem-in-a-tr%3ApanelTabbed-tp14307867p14320301.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: linking to non-default tr:showDetailItem in a tr:panelTabbed

Posted by Gerhard Petracek <ge...@gmail.com>.
hello mark,

e.g.: add an actionListener to your link and the disclosed-attribute to your
showDetailItems

your snippet (+ modifications):

        <tr:commandLink id="tabSwitcher" text="show 'Company' tab"
actionListener="#{bean.showCompanyTab}" partialSubmit="true"/>

        <tr:panelTabbed position="above" id="aboutMenu" class="panelClass"
partialTriggers="tabSwitcher">
               <tr:showDetailItem id="contactPanel" text="Contact"
                               inlineStyle="float: left"
                               disclosed="#{bean.showContact}"
                               binding="#{bean.contact}">
                     <tr:panelHeader text="Contact Us"/>
              </tr:showDetailItem>

               <tr:showDetailItem id="helpPanel" text="Company"
                               inlineStyle="float: left"
                               disclosed="#{bean.showCompany}"
                               bean="#{bean.company}">
                      <tr:panelHeader text="Company"/>
              </tr:showDetailItem>
        </tr:panelTabbed>


in my opinion the disclosed-attribute should be enough.
however, at the moment it doesn't work that way.
-> you also have to use component binding. (-> you also have to add the
binding-attribute - see above)

a possible workaround:
(don't forget the getter and setter methods)

within your bean - e.g.:

    private boolean showContact = true;
    private boolean showCompany = false;

    //workaround:
    private CoreShowDetailItem contact;
    private CoreShowDetailItem company;

    public void showCompanyTab(ActionEvent event)
    {
        this.showContact = false;
        this.showCompany = true;

        //workaround:
        if(this.contact != null)
        {
            this.contact.setDisclosed( false );
        }
        if(this.company != null)
        {
            this.company.setDisclosed( true );
        }
    }

regards,
gerhard



2007/12/13, md10024 <md...@qwizics.com>:
>
>
> Hi,
> I'm using Trinidad with facelets. I have a page "about.xhtml" containing a
> tr:panelTabbed that has a default item of "Contact". I would like to also
> create a link to the "Company" item on the about.xhtml page.
>
> How do I programatically reveal the non-default item when linking to this
> page?
>
> <<<about.xhtml>>>
> <tr:panelTabbed position="above" id="aboutMenu" class="panelClass">
>         <tr:showDetailItem id="contactPanel" text="Contact"
>                         inlineStyle="float: left">
>               <tr:panelHeader text="Contact Us"/>
>        </tr:showDetailItem>
>
>         <tr:showDetailItem id="helpPanel" text="Company"
>                         inlineStyle="float: left">
>                <tr:panelHeader text="Contact Us"/>
>        </tr:showDetailItem>
> </tr:panelTabbed>
>
> Thanks in advance!
>
> Mark
> --
> View this message in context:
> http://www.nabble.com/linking-to-non-default-tr%3AshowDetailItem-in-a-tr%3ApanelTabbed-tp14307867p14307867.html
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>
>


-- 

http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces