You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Håkon Sagehaug <ha...@uni.no> on 2011/03/01 23:00:33 UTC

Using statusIndicator

Hi all,

I've just stared using Trinidad and myFaces, and had a question. I'm
implementing a login in page for uses, and wanted to use the
statusIndicator, to give back messages for the user like

1. Got user information
2. Loading datasets
3. Logged in

And tried to have a  tr:outputText within the statusIndicator. The value for
the outPuttext would be linked to a backing bean, but I was not very
successful, do you have any other tips?

I guess one can use the progressIndicator, but I would like text to be
returned not a procentage progress.

cheers, Håkon

Re: Using statusIndicator

Posted by Richard Yee <ri...@gmail.com>.
In a previous post, Hakon wrote, " I looks like it picks up the initial
value for the helloWorldBacking.pollText, but when this value changes it's
it not propagated in the UI."

The tr:statusIndicator is used to display a status when an Trinidad Ajax
call is taking place. It just shows a status when the request is in-flight.

I check one of my applications and this works fine:
                  <tr:panelHorizontalLayout>
                    <tr:spacer height="1" width="135"/>
                    <tr:commandButton id="continueButton"
                                      text="#{bundle.continue_label}"
                                      styleClass="myButton"

action="#{someActionBacking.continueAction}"
                                      partialSubmit="true"/>
                    <tr:statusIndicator>
                      <f:facet name="busy">
                        <tr:image source="///images/pgsIndAnm.gif"
                                  shortDesc="#{bundle.processing_label}"
                                  styleClass="someStatus"/>
                      </f:facet>
                    </tr:statusIndicator>
                  </tr:panelHorizontalLayout>

tr:status doesn't require any partialTrigger attribute to work.

>From what I understand the event is occurring on the server. That is that
some component is changing the contents of the text and Hakon wants to
display the updated text. Depending on how and when the text is updated, a
tr:poll component would poll the server for the change. If the change occurs
as part of another user-initiated event, then a partialTrigger attribute
could be used on the outputText, but the tr:statusIndicator wouldn't be
required either.

-Richard


On Thu, Mar 3, 2011 at 8:25 AM, Scott O'Bryan <da...@gmail.com> wrote:

> That doesn't seem to make any sense to me Richard.  The poll component
> does not replace statusIndicator, they simply do two different things.
>  The purpose of the poll component is to initiate a request based on a
> clock instead of a user click.  You still need some way to display the
> information..
>
> Hakon,
>
> The partial trigger in this case should be on the output text although
> having it on the status indicator should also work (you'll just get a
> larger payload).
>
> Try this.  Remove the status indicator and only have the output text.
> Make sure your outputText is located inside the form (possible your
> getting a scoping issue).
>
> Does that work?  It should.
>
> On Mar 3, 2011, at 9:06 AM, Richard Yee <ri...@gmail.com> wrote:
>
> > You don't want statusIndicator, use tr:poll instead
> >
> > Richard
> >
> > Sent from my iPhone
> >
> > On Mar 3, 2011, at 7:48 AM, Håkon Sagehaug <ha...@uni.no>
> wrote:
> >
> >> Hi
> >>
> >> Yes, that was an old cut and past mistake, I've got loginButton as id
> for
> >> the button. The latest test are with loginButton, not button2. So this
> way
> >> of doing it should normally work?
> >>
> >> cheers, Håkon
> >>
> >> On 3 March 2011 16:35, Scott O'Bryan <da...@gmail.com> wrote:
> >>
> >>> Umm.  Considering the id of your button is button2, I'm not sure why
> >>> your partialTrigger is loginButton.  Can you explain?
> >>>
> >>> On Mar 3, 2011, at 6:46 AM, "Håkon Sagehaug" <ha...@uni.no>
> >>> wrote:
> >>>
> >>>> Hi all,
> >>>>
> >>>> I might not get the full point here ;). Here is what I tried, put
> trigger
> >>> on
> >>>> the statusIndicator like here
> >>>>
> >>>> <tr:statusIndicator partialTriggers="loginButton">
> >>>>                  <f:facet name="busy">
> >>>>                      <tr:outputText
> >>> value="#{helloWorldBacking.pollText}"
> >>>> />
> >>>>                  </f:facet>
> >>>>              </tr:statusIndicator>
> >>>>
> >>>> And on the outputText like here
> >>>>
> >>>> <tr:statusIndicator partialTriggers="loginButton">
> >>>>                  <f:facet name="busy">
> >>>>                      <tr:outputText
> >>> value="#{helloWorldBacking.pollText}"
> >>>> partialTriggers="loginButton"/>
> >>>>                  </f:facet>
> >>>>              </tr:statusIndicator>
> >>>>
> >>>> Where loginButton is
> >>>>
> >>>> <tr:commandButton id="button2" text="Login" partialSubmit="true"/>
> >>>>
> >>>> But nothing seems to have the wanted effect. I looks like it picks up
> the
> >>>> initial value for the helloWorldBacking.pollText, but when this value
> >>>> changes it's it not propagated in the UI. Maybe this can't be done
> like
> >>> I've
> >>>> sketched out. The backing code is the same as sent in a earlier email.
> >>>>
> >>>> Other tips?
> >>>>
> >>>> Cheers, Håkon
> >>>>
> >>>>
> >>>> On 3 March 2011 05:23, Richard Yee <ri...@gmail.com> wrote:
> >>>>
> >>>>> Try putting it inside the tr:form or inside your panelPage
> >>>>>
> >>>>>
> >>>>> -Richard
> >>>>>
> >>>>> 2011/3/1 Håkon Sagehaug <ha...@uni.no>
> >>>>>
> >>>>>> Hi
> >>>>>>
> >>>>>> Thanks for the reply, here is my xhtml, with a simple login form
> >>>>>>
> >>>>>> <tr:document title="Login Demo">
> >>>>>>     <tr:statusIndicator>
> >>>>>>         <f:facet name="busy">
> >>>>>>             <tr:outputText value="#{helloWorldBacking.pollText}" />
> >>>>>>         </f:facet>
> >>>>>>     </tr:statusIndicator>
> >>>>>>     <tr:form>
> >>>>>>
> >>>>>>         <tr:panelPage>
> >>>>>>             <f:facet name="infoStatus">
> >>>>>>                 <tr:legend name="required" />
> >>>>>>             </f:facet>
> >>>>>>
> >>>>>>             <tr:inputText label="Username" id="username"
> >>>>>>                 value="#{helloWorldBacking.username}"
> required="true"
> >>>>> />
> >>>>>>
> >>>>>>             <tr:inputText label="Password" id="password"
> >>>>>>                 value="#{helloWorldBacking.password}"
> required="true"
> >>>>>> secret="true" />
> >>>>>>             <tr:commandButton id="button2" text="Login"
> >>>>>> partialSubmit="true"
> >>>>>>                 action="#{helloWorldBacking.send}" />
> >>>>>>         </tr:panelPage>
> >>>>>>
> >>>>>>     </tr:form>
> >>>>>>
> >>>>>> </tr:document>
> >>>>>>
> >>>>>> And parts of the backing bean
> >>>>>>
> >>>>>> public String send() {
> >>>>>>     FacesContext facesContext = FacesContext.getCurrentInstance();
> >>>>>>
> >>>>>>     System.out.println("user name " + username + " is logged in "
> >>>>>>             + userLoggedIn);
> >>>>>>
> >>>>>>     try {
> >>>>>>         Thread.sleep(5000);
> >>>>>>         Token tok = tokenMgr.getToken(username, password, true);
> >>>>>>        Thread.sleep(2000);
> >>>>>>         pollText = "Token fetched";
> >>>>>>         if (tok != null) {
> >>>>>>             userLoggedIn = true;
> >>>>>>             return ("success");
> >>>>>>         }
> >>>>>>         username = "";
> >>>>>>         password = "";
> >>>>>>     } catch (TrustException e1) {
> >>>>>>         e1.printStackTrace();
> >>>>>>     } catch (AxisFault e) {
> >>>>>>         e.printStackTrace();
> >>>>>>     } catch (FileNotFoundException e) {
> >>>>>>         e.printStackTrace();
> >>>>>>     } catch (XMLStreamException e) {
> >>>>>>         e.printStackTrace();
> >>>>>>     } catch (InterruptedException e) {
> >>>>>>
> >>>>>>         e.printStackTrace();
> >>>>>>     }
> >>>>>>     FacesMessage message = new FacesMessage("Login failed");
> >>>>>>
> >>>>>>     facesContext.addMessage("username", message);
> >>>>>>
> >>>>>>     username = "";
> >>>>>>     password = "";
> >>>>>>
> >>>>>>     return ("error");
> >>>>>>
> >>>>>> }
> >>>>>> As you can see I sleep the thread to simulate the operations needed
> to
> >>>>> log
> >>>>>> in the user, for now I'm only getting the token. After that I'll
> fetch
> >>>>> the
> >>>>>> project, data etc...
> >>>>>>
> >>>>>> So I wanted the pollText to apear  dynmically in the status
> indicator,
> >>>>> but
> >>>>>> can get it to update,.
> >>>>>>
> >>>>>> Any tips?
> >>>>>>
> >>>>>> cheers, Håkon
> >>>>>>
> >>>>>> On 1 March 2011 23:23, Scott O'Bryan <da...@gmail.com> wrote:
> >>>>>>
> >>>>>>> I see no reason why this wouldn't work..  What specifically is
> failing
> >>>>>>> for you and perhaps a code snipi might help me visualize your
> issue.
> >>>>>>>
> >>>>>>> On Mar 1, 2011, at 3:04 PM, "Håkon Sagehaug" <
> hakon.sagehaug@uni.no>
> >>>>>>> wrote:
> >>>>>>>
> >>>>>>>> Hi all,
> >>>>>>>>
> >>>>>>>> I've just stared using Trinidad and myFaces, and had a question.
> I'm
> >>>>>>>> implementing a login in page for uses, and wanted to use the
> >>>>>>>> statusIndicator, to give back messages for the user like
> >>>>>>>>
> >>>>>>>> 1. Got user information
> >>>>>>>> 2. Loading datasets
> >>>>>>>> 3. Logged in
> >>>>>>>>
> >>>>>>>> And tried to have a  tr:outputText within the statusIndicator. The
> >>>>>> value
> >>>>>>> for
> >>>>>>>> the outPuttext would be linked to a backing bean, but I was not
> very
> >>>>>>>> successful, do you have any other tips?
> >>>>>>>>
> >>>>>>>> I guess one can use the progressIndicator, but I would like text
> to
> >>>>> be
> >>>>>>>> returned not a procentage progress.
> >>>>>>>>
> >>>>>>>> cheers, Håkon
> >>>>>>>
> >>>>>>
> >>>>>
> >>>
>

Re: Using statusIndicator

Posted by Håkon Sagehaug <ha...@uni.no>.
Hi,

I've not started to try out the poll yet, have been workign on some other
things last days. I'll give the poll a try and get back to you, thanks for
all the tips

Cheers, Håkon



On 8 March 2011 06:42, Richard Yee <ri...@gmail.com> wrote:

> What are you setting the helloWorldBacking.pollText to?
> Initialize it to "Default'
> In your pollListener, set pollText to new Date().toString
>
> set your partialTriggers attribute in your outputText to be the id of your
> tr:poll element.
>
> -Richard
>
> On Mon, Mar 7, 2011 at 12:48 PM, Scott O'Bryan <da...@gmail.com>
> wrote:
>
> > You get nothing at all?  Are you sure your EL is correct?
> >
> >
> > On 03/03/2011 09:45 AM, Håkon Sagehaug wrote:
> >
> >> Hi
> >>
> >> I now have my login page like this
> >>
> >> <?xml version="1.0" encoding="UTF-8"?>
> >> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> >> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> >> <html xmlns="http://www.w3.org/1999/xhtml"
> >>     xmlns:f="http://java.sun.com/jsf/core"
> >>     xmlns:h="http://java.sun.com/jsf/html"
> >>     xmlns:tr="http://myfaces.apache.org/trinidad">
> >>
> >> <f:view>
> >>     <tr:document title="eSysbio-myFaces-Trinidad">
> >>
> >>         <tr:panelPage>
> >>             <f:facet name="infoStatus">
> >>                 <tr:legend name="required" />
> >>             </f:facet>
> >>             <tr:form>
> >>                 <h:panelGrid colums="2">
> >>                     <tr:outputLabel value="Username" />
> >>                     <tr:inputText id="username"
> >> value="#{helloWorldBacking.username}"
> >>                         required="true" />
> >>                     <tr:outputLabel value="Password" />
> >>                     <tr:inputText id="password"
> >> value="#{helloWorldBacking.password}"
> >>                         required="true" secret="true" />
> >>
> >>                 </h:panelGrid>
> >>                 <tr:commandButton id="loginButton" text="Login"
> >> partialSubmit="true"
> >>                     actionListener="#{helloWorldBacking.send}" />
> >>
> >>
> >>                 <!--
> >>                 <tr:statusIndicator>
> >>                     <tr:outputText value="#{helloWorldBacking.pollText}"
> >> />
> >>                 </tr:statusIndicator>
> >>                  -->
> >>                 <tr:outputText value="#{helloWorldBacking.pollText}"
> >>                     partialTriggers="loginButton" />
> >>             </tr:form>
> >>         </tr:panelPage>
> >>
> >>     </tr:document>
> >> </f:view>
> >> </html>
> >>
> >> But then I got nothing in the outPutText field. Any other hint/tips or
> >> tricks. I really appreciate the help
> >>
> >> Cheers, Håkon
> >>
> >> On 3 March 2011 17:25, Scott O'Bryan<da...@gmail.com>  wrote:
> >>
> >>  That doesn't seem to make any sense to me Richard.  The poll component
> >>> does not replace statusIndicator, they simply do two different things.
> >>>  The purpose of the poll component is to initiate a request based on a
> >>> clock instead of a user click.  You still need some way to display the
> >>> information..
> >>>
> >>> Hakon,
> >>>
> >>> The partial trigger in this case should be on the output text although
> >>> having it on the status indicator should also work (you'll just get a
> >>> larger payload).
> >>>
> >>> Try this.  Remove the status indicator and only have the output text.
> >>> Make sure your outputText is located inside the form (possible your
> >>> getting a scoping issue).
> >>>
> >>> Does that work?  It should.
> >>>
> >>> On Mar 3, 2011, at 9:06 AM, Richard Yee<ri...@gmail.com>
>  wrote:
> >>>
> >>>  You don't want statusIndicator, use tr:poll instead
> >>>>
> >>>> Richard
> >>>>
> >>>> Sent from my iPhone
> >>>>
> >>>> On Mar 3, 2011, at 7:48 AM, Håkon Sagehaug<ha...@uni.no>
> >>>>
> >>> wrote:
> >>>
> >>>> Hi
> >>>>>
> >>>>> Yes, that was an old cut and past mistake, I've got loginButton as id
> >>>>>
> >>>> for
> >>>
> >>>> the button. The latest test are with loginButton, not button2. So this
> >>>>>
> >>>> way
> >>>
> >>>> of doing it should normally work?
> >>>>>
> >>>>> cheers, Håkon
> >>>>>
> >>>>> On 3 March 2011 16:35, Scott O'Bryan<da...@gmail.com>  wrote:
> >>>>>
> >>>>>  Umm.  Considering the id of your button is button2, I'm not sure why
> >>>>>> your partialTrigger is loginButton.  Can you explain?
> >>>>>>
> >>>>>> On Mar 3, 2011, at 6:46 AM, "Håkon Sagehaug"<ha...@uni.no>
> >>>>>> wrote:
> >>>>>>
> >>>>>>  Hi all,
> >>>>>>>
> >>>>>>> I might not get the full point here ;). Here is what I tried, put
> >>>>>>>
> >>>>>> trigger
> >>>
> >>>> on
> >>>>>>
> >>>>>>> the statusIndicator like here
> >>>>>>>
> >>>>>>> <tr:statusIndicator partialTriggers="loginButton">
> >>>>>>>                  <f:facet name="busy">
> >>>>>>>                      <tr:outputText
> >>>>>>>
> >>>>>> value="#{helloWorldBacking.pollText}"
> >>>>>>
> >>>>>>> />
> >>>>>>>                  </f:facet>
> >>>>>>>              </tr:statusIndicator>
> >>>>>>>
> >>>>>>> And on the outputText like here
> >>>>>>>
> >>>>>>> <tr:statusIndicator partialTriggers="loginButton">
> >>>>>>>                  <f:facet name="busy">
> >>>>>>>                      <tr:outputText
> >>>>>>>
> >>>>>> value="#{helloWorldBacking.pollText}"
> >>>>>>
> >>>>>>> partialTriggers="loginButton"/>
> >>>>>>>                  </f:facet>
> >>>>>>>              </tr:statusIndicator>
> >>>>>>>
> >>>>>>> Where loginButton is
> >>>>>>>
> >>>>>>> <tr:commandButton id="button2" text="Login" partialSubmit="true"/>
> >>>>>>>
> >>>>>>> But nothing seems to have the wanted effect. I looks like it picks
> up
> >>>>>>>
> >>>>>> the
> >>>
> >>>> initial value for the helloWorldBacking.pollText, but when this value
> >>>>>>> changes it's it not propagated in the UI. Maybe this can't be done
> >>>>>>>
> >>>>>> like
> >>>
> >>>> I've
> >>>>>>
> >>>>>>> sketched out. The backing code is the same as sent in a earlier
> >>>>>>> email.
> >>>>>>>
> >>>>>>> Other tips?
> >>>>>>>
> >>>>>>> Cheers, Håkon
> >>>>>>>
> >>>>>>>
> >>>>>>> On 3 March 2011 05:23, Richard Yee<ri...@gmail.com>
>  wrote:
> >>>>>>>
> >>>>>>>  Try putting it inside the tr:form or inside your panelPage
> >>>>>>>>
> >>>>>>>>
> >>>>>>>> -Richard
> >>>>>>>>
> >>>>>>>> 2011/3/1 Håkon Sagehaug<ha...@uni.no>
> >>>>>>>>
> >>>>>>>>  Hi
> >>>>>>>>>
> >>>>>>>>> Thanks for the reply, here is my xhtml, with a simple login form
> >>>>>>>>>
> >>>>>>>>> <tr:document title="Login Demo">
> >>>>>>>>>     <tr:statusIndicator>
> >>>>>>>>>         <f:facet name="busy">
> >>>>>>>>>             <tr:outputText value="#{helloWorldBacking.pollText}"
> />
> >>>>>>>>>         </f:facet>
> >>>>>>>>>     </tr:statusIndicator>
> >>>>>>>>>     <tr:form>
> >>>>>>>>>
> >>>>>>>>>         <tr:panelPage>
> >>>>>>>>>             <f:facet name="infoStatus">
> >>>>>>>>>                 <tr:legend name="required" />
> >>>>>>>>>             </f:facet>
> >>>>>>>>>
> >>>>>>>>>             <tr:inputText label="Username" id="username"
> >>>>>>>>>                 value="#{helloWorldBacking.username}"
> >>>>>>>>>
> >>>>>>>> required="true"
> >>>
> >>>> />
> >>>>>>>>
> >>>>>>>>>             <tr:inputText label="Password" id="password"
> >>>>>>>>>                 value="#{helloWorldBacking.password}"
> >>>>>>>>>
> >>>>>>>> required="true"
> >>>
> >>>> secret="true" />
> >>>>>>>>>             <tr:commandButton id="button2" text="Login"
> >>>>>>>>> partialSubmit="true"
> >>>>>>>>>                 action="#{helloWorldBacking.send}" />
> >>>>>>>>>         </tr:panelPage>
> >>>>>>>>>
> >>>>>>>>>     </tr:form>
> >>>>>>>>>
> >>>>>>>>> </tr:document>
> >>>>>>>>>
> >>>>>>>>> And parts of the backing bean
> >>>>>>>>>
> >>>>>>>>> public String send() {
> >>>>>>>>>     FacesContext facesContext =
> FacesContext.getCurrentInstance();
> >>>>>>>>>
> >>>>>>>>>     System.out.println("user name " + username + " is logged in "
> >>>>>>>>>             + userLoggedIn);
> >>>>>>>>>
> >>>>>>>>>     try {
> >>>>>>>>>         Thread.sleep(5000);
> >>>>>>>>>         Token tok = tokenMgr.getToken(username, password, true);
> >>>>>>>>>        Thread.sleep(2000);
> >>>>>>>>>         pollText = "Token fetched";
> >>>>>>>>>         if (tok != null) {
> >>>>>>>>>             userLoggedIn = true;
> >>>>>>>>>             return ("success");
> >>>>>>>>>         }
> >>>>>>>>>         username = "";
> >>>>>>>>>         password = "";
> >>>>>>>>>     } catch (TrustException e1) {
> >>>>>>>>>         e1.printStackTrace();
> >>>>>>>>>     } catch (AxisFault e) {
> >>>>>>>>>         e.printStackTrace();
> >>>>>>>>>     } catch (FileNotFoundException e) {
> >>>>>>>>>         e.printStackTrace();
> >>>>>>>>>     } catch (XMLStreamException e) {
> >>>>>>>>>         e.printStackTrace();
> >>>>>>>>>     } catch (InterruptedException e) {
> >>>>>>>>>
> >>>>>>>>>         e.printStackTrace();
> >>>>>>>>>     }
> >>>>>>>>>     FacesMessage message = new FacesMessage("Login failed");
> >>>>>>>>>
> >>>>>>>>>     facesContext.addMessage("username", message);
> >>>>>>>>>
> >>>>>>>>>     username = "";
> >>>>>>>>>     password = "";
> >>>>>>>>>
> >>>>>>>>>     return ("error");
> >>>>>>>>>
> >>>>>>>>> }
> >>>>>>>>> As you can see I sleep the thread to simulate the operations
> needed
> >>>>>>>>>
> >>>>>>>> to
> >>>
> >>>> log
> >>>>>>>>
> >>>>>>>>> in the user, for now I'm only getting the token. After that I'll
> >>>>>>>>>
> >>>>>>>> fetch
> >>>
> >>>> the
> >>>>>>>>
> >>>>>>>>> project, data etc...
> >>>>>>>>>
> >>>>>>>>> So I wanted the pollText to apear  dynmically in the status
> >>>>>>>>>
> >>>>>>>> indicator,
> >>>
> >>>> but
> >>>>>>>>
> >>>>>>>>> can get it to update,.
> >>>>>>>>>
> >>>>>>>>> Any tips?
> >>>>>>>>>
> >>>>>>>>> cheers, Håkon
> >>>>>>>>>
> >>>>>>>>> On 1 March 2011 23:23, Scott O'Bryan<da...@gmail.com>
>  wrote:
> >>>>>>>>>
> >>>>>>>>>  I see no reason why this wouldn't work..  What specifically is
> >>>>>>>>>>
> >>>>>>>>> failing
> >>>
> >>>> for you and perhaps a code snipi might help me visualize your
> >>>>>>>>>>
> >>>>>>>>> issue.
> >>>
> >>>> On Mar 1, 2011, at 3:04 PM, "Håkon Sagehaug"<
> >>>>>>>>>>
> >>>>>>>>> hakon.sagehaug@uni.no>
> >>>
> >>>> wrote:
> >>>>>>>>>>
> >>>>>>>>>>  Hi all,
> >>>>>>>>>>>
> >>>>>>>>>>> I've just stared using Trinidad and myFaces, and had a
> question.
> >>>>>>>>>>>
> >>>>>>>>>> I'm
> >>>
> >>>> implementing a login in page for uses, and wanted to use the
> >>>>>>>>>>> statusIndicator, to give back messages for the user like
> >>>>>>>>>>>
> >>>>>>>>>>> 1. Got user information
> >>>>>>>>>>> 2. Loading datasets
> >>>>>>>>>>> 3. Logged in
> >>>>>>>>>>>
> >>>>>>>>>>> And tried to have a  tr:outputText within the statusIndicator.
> >>>>>>>>>>> The
> >>>>>>>>>>>
> >>>>>>>>>> value
> >>>>>>>>>
> >>>>>>>>>> for
> >>>>>>>>>>
> >>>>>>>>>>> the outPuttext would be linked to a backing bean, but I was not
> >>>>>>>>>>>
> >>>>>>>>>> very
> >>>
> >>>> successful, do you have any other tips?
> >>>>>>>>>>>
> >>>>>>>>>>> I guess one can use the progressIndicator, but I would like
> text
> >>>>>>>>>>>
> >>>>>>>>>> to
> >>>
> >>>> be
> >>>>>>>>
> >>>>>>>>> returned not a procentage progress.
> >>>>>>>>>>>
> >>>>>>>>>>> cheers, Håkon
> >>>>>>>>>>>
> >>>>>>>>>>
> >
>

Re: Using statusIndicator

Posted by Richard Yee <ri...@gmail.com>.
What are you setting the helloWorldBacking.pollText to?
Initialize it to "Default'
In your pollListener, set pollText to new Date().toString

set your partialTriggers attribute in your outputText to be the id of your
tr:poll element.

-Richard

On Mon, Mar 7, 2011 at 12:48 PM, Scott O'Bryan <da...@gmail.com> wrote:

> You get nothing at all?  Are you sure your EL is correct?
>
>
> On 03/03/2011 09:45 AM, Håkon Sagehaug wrote:
>
>> Hi
>>
>> I now have my login page like this
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
>> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
>> <html xmlns="http://www.w3.org/1999/xhtml"
>>     xmlns:f="http://java.sun.com/jsf/core"
>>     xmlns:h="http://java.sun.com/jsf/html"
>>     xmlns:tr="http://myfaces.apache.org/trinidad">
>>
>> <f:view>
>>     <tr:document title="eSysbio-myFaces-Trinidad">
>>
>>         <tr:panelPage>
>>             <f:facet name="infoStatus">
>>                 <tr:legend name="required" />
>>             </f:facet>
>>             <tr:form>
>>                 <h:panelGrid colums="2">
>>                     <tr:outputLabel value="Username" />
>>                     <tr:inputText id="username"
>> value="#{helloWorldBacking.username}"
>>                         required="true" />
>>                     <tr:outputLabel value="Password" />
>>                     <tr:inputText id="password"
>> value="#{helloWorldBacking.password}"
>>                         required="true" secret="true" />
>>
>>                 </h:panelGrid>
>>                 <tr:commandButton id="loginButton" text="Login"
>> partialSubmit="true"
>>                     actionListener="#{helloWorldBacking.send}" />
>>
>>
>>                 <!--
>>                 <tr:statusIndicator>
>>                     <tr:outputText value="#{helloWorldBacking.pollText}"
>> />
>>                 </tr:statusIndicator>
>>                  -->
>>                 <tr:outputText value="#{helloWorldBacking.pollText}"
>>                     partialTriggers="loginButton" />
>>             </tr:form>
>>         </tr:panelPage>
>>
>>     </tr:document>
>> </f:view>
>> </html>
>>
>> But then I got nothing in the outPutText field. Any other hint/tips or
>> tricks. I really appreciate the help
>>
>> Cheers, Håkon
>>
>> On 3 March 2011 17:25, Scott O'Bryan<da...@gmail.com>  wrote:
>>
>>  That doesn't seem to make any sense to me Richard.  The poll component
>>> does not replace statusIndicator, they simply do two different things.
>>>  The purpose of the poll component is to initiate a request based on a
>>> clock instead of a user click.  You still need some way to display the
>>> information..
>>>
>>> Hakon,
>>>
>>> The partial trigger in this case should be on the output text although
>>> having it on the status indicator should also work (you'll just get a
>>> larger payload).
>>>
>>> Try this.  Remove the status indicator and only have the output text.
>>> Make sure your outputText is located inside the form (possible your
>>> getting a scoping issue).
>>>
>>> Does that work?  It should.
>>>
>>> On Mar 3, 2011, at 9:06 AM, Richard Yee<ri...@gmail.com>  wrote:
>>>
>>>  You don't want statusIndicator, use tr:poll instead
>>>>
>>>> Richard
>>>>
>>>> Sent from my iPhone
>>>>
>>>> On Mar 3, 2011, at 7:48 AM, Håkon Sagehaug<ha...@uni.no>
>>>>
>>> wrote:
>>>
>>>> Hi
>>>>>
>>>>> Yes, that was an old cut and past mistake, I've got loginButton as id
>>>>>
>>>> for
>>>
>>>> the button. The latest test are with loginButton, not button2. So this
>>>>>
>>>> way
>>>
>>>> of doing it should normally work?
>>>>>
>>>>> cheers, Håkon
>>>>>
>>>>> On 3 March 2011 16:35, Scott O'Bryan<da...@gmail.com>  wrote:
>>>>>
>>>>>  Umm.  Considering the id of your button is button2, I'm not sure why
>>>>>> your partialTrigger is loginButton.  Can you explain?
>>>>>>
>>>>>> On Mar 3, 2011, at 6:46 AM, "Håkon Sagehaug"<ha...@uni.no>
>>>>>> wrote:
>>>>>>
>>>>>>  Hi all,
>>>>>>>
>>>>>>> I might not get the full point here ;). Here is what I tried, put
>>>>>>>
>>>>>> trigger
>>>
>>>> on
>>>>>>
>>>>>>> the statusIndicator like here
>>>>>>>
>>>>>>> <tr:statusIndicator partialTriggers="loginButton">
>>>>>>>                  <f:facet name="busy">
>>>>>>>                      <tr:outputText
>>>>>>>
>>>>>> value="#{helloWorldBacking.pollText}"
>>>>>>
>>>>>>> />
>>>>>>>                  </f:facet>
>>>>>>>              </tr:statusIndicator>
>>>>>>>
>>>>>>> And on the outputText like here
>>>>>>>
>>>>>>> <tr:statusIndicator partialTriggers="loginButton">
>>>>>>>                  <f:facet name="busy">
>>>>>>>                      <tr:outputText
>>>>>>>
>>>>>> value="#{helloWorldBacking.pollText}"
>>>>>>
>>>>>>> partialTriggers="loginButton"/>
>>>>>>>                  </f:facet>
>>>>>>>              </tr:statusIndicator>
>>>>>>>
>>>>>>> Where loginButton is
>>>>>>>
>>>>>>> <tr:commandButton id="button2" text="Login" partialSubmit="true"/>
>>>>>>>
>>>>>>> But nothing seems to have the wanted effect. I looks like it picks up
>>>>>>>
>>>>>> the
>>>
>>>> initial value for the helloWorldBacking.pollText, but when this value
>>>>>>> changes it's it not propagated in the UI. Maybe this can't be done
>>>>>>>
>>>>>> like
>>>
>>>> I've
>>>>>>
>>>>>>> sketched out. The backing code is the same as sent in a earlier
>>>>>>> email.
>>>>>>>
>>>>>>> Other tips?
>>>>>>>
>>>>>>> Cheers, Håkon
>>>>>>>
>>>>>>>
>>>>>>> On 3 March 2011 05:23, Richard Yee<ri...@gmail.com>  wrote:
>>>>>>>
>>>>>>>  Try putting it inside the tr:form or inside your panelPage
>>>>>>>>
>>>>>>>>
>>>>>>>> -Richard
>>>>>>>>
>>>>>>>> 2011/3/1 Håkon Sagehaug<ha...@uni.no>
>>>>>>>>
>>>>>>>>  Hi
>>>>>>>>>
>>>>>>>>> Thanks for the reply, here is my xhtml, with a simple login form
>>>>>>>>>
>>>>>>>>> <tr:document title="Login Demo">
>>>>>>>>>     <tr:statusIndicator>
>>>>>>>>>         <f:facet name="busy">
>>>>>>>>>             <tr:outputText value="#{helloWorldBacking.pollText}" />
>>>>>>>>>         </f:facet>
>>>>>>>>>     </tr:statusIndicator>
>>>>>>>>>     <tr:form>
>>>>>>>>>
>>>>>>>>>         <tr:panelPage>
>>>>>>>>>             <f:facet name="infoStatus">
>>>>>>>>>                 <tr:legend name="required" />
>>>>>>>>>             </f:facet>
>>>>>>>>>
>>>>>>>>>             <tr:inputText label="Username" id="username"
>>>>>>>>>                 value="#{helloWorldBacking.username}"
>>>>>>>>>
>>>>>>>> required="true"
>>>
>>>> />
>>>>>>>>
>>>>>>>>>             <tr:inputText label="Password" id="password"
>>>>>>>>>                 value="#{helloWorldBacking.password}"
>>>>>>>>>
>>>>>>>> required="true"
>>>
>>>> secret="true" />
>>>>>>>>>             <tr:commandButton id="button2" text="Login"
>>>>>>>>> partialSubmit="true"
>>>>>>>>>                 action="#{helloWorldBacking.send}" />
>>>>>>>>>         </tr:panelPage>
>>>>>>>>>
>>>>>>>>>     </tr:form>
>>>>>>>>>
>>>>>>>>> </tr:document>
>>>>>>>>>
>>>>>>>>> And parts of the backing bean
>>>>>>>>>
>>>>>>>>> public String send() {
>>>>>>>>>     FacesContext facesContext = FacesContext.getCurrentInstance();
>>>>>>>>>
>>>>>>>>>     System.out.println("user name " + username + " is logged in "
>>>>>>>>>             + userLoggedIn);
>>>>>>>>>
>>>>>>>>>     try {
>>>>>>>>>         Thread.sleep(5000);
>>>>>>>>>         Token tok = tokenMgr.getToken(username, password, true);
>>>>>>>>>        Thread.sleep(2000);
>>>>>>>>>         pollText = "Token fetched";
>>>>>>>>>         if (tok != null) {
>>>>>>>>>             userLoggedIn = true;
>>>>>>>>>             return ("success");
>>>>>>>>>         }
>>>>>>>>>         username = "";
>>>>>>>>>         password = "";
>>>>>>>>>     } catch (TrustException e1) {
>>>>>>>>>         e1.printStackTrace();
>>>>>>>>>     } catch (AxisFault e) {
>>>>>>>>>         e.printStackTrace();
>>>>>>>>>     } catch (FileNotFoundException e) {
>>>>>>>>>         e.printStackTrace();
>>>>>>>>>     } catch (XMLStreamException e) {
>>>>>>>>>         e.printStackTrace();
>>>>>>>>>     } catch (InterruptedException e) {
>>>>>>>>>
>>>>>>>>>         e.printStackTrace();
>>>>>>>>>     }
>>>>>>>>>     FacesMessage message = new FacesMessage("Login failed");
>>>>>>>>>
>>>>>>>>>     facesContext.addMessage("username", message);
>>>>>>>>>
>>>>>>>>>     username = "";
>>>>>>>>>     password = "";
>>>>>>>>>
>>>>>>>>>     return ("error");
>>>>>>>>>
>>>>>>>>> }
>>>>>>>>> As you can see I sleep the thread to simulate the operations needed
>>>>>>>>>
>>>>>>>> to
>>>
>>>> log
>>>>>>>>
>>>>>>>>> in the user, for now I'm only getting the token. After that I'll
>>>>>>>>>
>>>>>>>> fetch
>>>
>>>> the
>>>>>>>>
>>>>>>>>> project, data etc...
>>>>>>>>>
>>>>>>>>> So I wanted the pollText to apear  dynmically in the status
>>>>>>>>>
>>>>>>>> indicator,
>>>
>>>> but
>>>>>>>>
>>>>>>>>> can get it to update,.
>>>>>>>>>
>>>>>>>>> Any tips?
>>>>>>>>>
>>>>>>>>> cheers, Håkon
>>>>>>>>>
>>>>>>>>> On 1 March 2011 23:23, Scott O'Bryan<da...@gmail.com>  wrote:
>>>>>>>>>
>>>>>>>>>  I see no reason why this wouldn't work..  What specifically is
>>>>>>>>>>
>>>>>>>>> failing
>>>
>>>> for you and perhaps a code snipi might help me visualize your
>>>>>>>>>>
>>>>>>>>> issue.
>>>
>>>> On Mar 1, 2011, at 3:04 PM, "Håkon Sagehaug"<
>>>>>>>>>>
>>>>>>>>> hakon.sagehaug@uni.no>
>>>
>>>> wrote:
>>>>>>>>>>
>>>>>>>>>>  Hi all,
>>>>>>>>>>>
>>>>>>>>>>> I've just stared using Trinidad and myFaces, and had a question.
>>>>>>>>>>>
>>>>>>>>>> I'm
>>>
>>>> implementing a login in page for uses, and wanted to use the
>>>>>>>>>>> statusIndicator, to give back messages for the user like
>>>>>>>>>>>
>>>>>>>>>>> 1. Got user information
>>>>>>>>>>> 2. Loading datasets
>>>>>>>>>>> 3. Logged in
>>>>>>>>>>>
>>>>>>>>>>> And tried to have a  tr:outputText within the statusIndicator.
>>>>>>>>>>> The
>>>>>>>>>>>
>>>>>>>>>> value
>>>>>>>>>
>>>>>>>>>> for
>>>>>>>>>>
>>>>>>>>>>> the outPuttext would be linked to a backing bean, but I was not
>>>>>>>>>>>
>>>>>>>>>> very
>>>
>>>> successful, do you have any other tips?
>>>>>>>>>>>
>>>>>>>>>>> I guess one can use the progressIndicator, but I would like text
>>>>>>>>>>>
>>>>>>>>>> to
>>>
>>>> be
>>>>>>>>
>>>>>>>>> returned not a procentage progress.
>>>>>>>>>>>
>>>>>>>>>>> cheers, Håkon
>>>>>>>>>>>
>>>>>>>>>>
>

Re: Using statusIndicator

Posted by Scott O'Bryan <da...@gmail.com>.
You get nothing at all?  Are you sure your EL is correct?

On 03/03/2011 09:45 AM, Håkon Sagehaug wrote:
> Hi
>
> I now have my login page like this
>
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml"
>      xmlns:f="http://java.sun.com/jsf/core"
>      xmlns:h="http://java.sun.com/jsf/html"
>      xmlns:tr="http://myfaces.apache.org/trinidad">
>
> <f:view>
>      <tr:document title="eSysbio-myFaces-Trinidad">
>
>          <tr:panelPage>
>              <f:facet name="infoStatus">
>                  <tr:legend name="required" />
>              </f:facet>
>              <tr:form>
>                  <h:panelGrid colums="2">
>                      <tr:outputLabel value="Username" />
>                      <tr:inputText id="username"
> value="#{helloWorldBacking.username}"
>                          required="true" />
>                      <tr:outputLabel value="Password" />
>                      <tr:inputText id="password"
> value="#{helloWorldBacking.password}"
>                          required="true" secret="true" />
>
>                  </h:panelGrid>
>                  <tr:commandButton id="loginButton" text="Login"
> partialSubmit="true"
>                      actionListener="#{helloWorldBacking.send}" />
>
>
>                  <!--
>                  <tr:statusIndicator>
>                      <tr:outputText value="#{helloWorldBacking.pollText}" />
>                  </tr:statusIndicator>
>                   -->
>                  <tr:outputText value="#{helloWorldBacking.pollText}"
>                      partialTriggers="loginButton" />
>              </tr:form>
>          </tr:panelPage>
>
>      </tr:document>
> </f:view>
> </html>
>
> But then I got nothing in the outPutText field. Any other hint/tips or
> tricks. I really appreciate the help
>
> Cheers, Håkon
>
> On 3 March 2011 17:25, Scott O'Bryan<da...@gmail.com>  wrote:
>
>> That doesn't seem to make any sense to me Richard.  The poll component
>> does not replace statusIndicator, they simply do two different things.
>>   The purpose of the poll component is to initiate a request based on a
>> clock instead of a user click.  You still need some way to display the
>> information..
>>
>> Hakon,
>>
>> The partial trigger in this case should be on the output text although
>> having it on the status indicator should also work (you'll just get a
>> larger payload).
>>
>> Try this.  Remove the status indicator and only have the output text.
>> Make sure your outputText is located inside the form (possible your
>> getting a scoping issue).
>>
>> Does that work?  It should.
>>
>> On Mar 3, 2011, at 9:06 AM, Richard Yee<ri...@gmail.com>  wrote:
>>
>>> You don't want statusIndicator, use tr:poll instead
>>>
>>> Richard
>>>
>>> Sent from my iPhone
>>>
>>> On Mar 3, 2011, at 7:48 AM, Håkon Sagehaug<ha...@uni.no>
>> wrote:
>>>> Hi
>>>>
>>>> Yes, that was an old cut and past mistake, I've got loginButton as id
>> for
>>>> the button. The latest test are with loginButton, not button2. So this
>> way
>>>> of doing it should normally work?
>>>>
>>>> cheers, Håkon
>>>>
>>>> On 3 March 2011 16:35, Scott O'Bryan<da...@gmail.com>  wrote:
>>>>
>>>>> Umm.  Considering the id of your button is button2, I'm not sure why
>>>>> your partialTrigger is loginButton.  Can you explain?
>>>>>
>>>>> On Mar 3, 2011, at 6:46 AM, "Håkon Sagehaug"<ha...@uni.no>
>>>>> wrote:
>>>>>
>>>>>> Hi all,
>>>>>>
>>>>>> I might not get the full point here ;). Here is what I tried, put
>> trigger
>>>>> on
>>>>>> the statusIndicator like here
>>>>>>
>>>>>> <tr:statusIndicator partialTriggers="loginButton">
>>>>>>                   <f:facet name="busy">
>>>>>>                       <tr:outputText
>>>>> value="#{helloWorldBacking.pollText}"
>>>>>> />
>>>>>>                   </f:facet>
>>>>>>               </tr:statusIndicator>
>>>>>>
>>>>>> And on the outputText like here
>>>>>>
>>>>>> <tr:statusIndicator partialTriggers="loginButton">
>>>>>>                   <f:facet name="busy">
>>>>>>                       <tr:outputText
>>>>> value="#{helloWorldBacking.pollText}"
>>>>>> partialTriggers="loginButton"/>
>>>>>>                   </f:facet>
>>>>>>               </tr:statusIndicator>
>>>>>>
>>>>>> Where loginButton is
>>>>>>
>>>>>> <tr:commandButton id="button2" text="Login" partialSubmit="true"/>
>>>>>>
>>>>>> But nothing seems to have the wanted effect. I looks like it picks up
>> the
>>>>>> initial value for the helloWorldBacking.pollText, but when this value
>>>>>> changes it's it not propagated in the UI. Maybe this can't be done
>> like
>>>>> I've
>>>>>> sketched out. The backing code is the same as sent in a earlier email.
>>>>>>
>>>>>> Other tips?
>>>>>>
>>>>>> Cheers, Håkon
>>>>>>
>>>>>>
>>>>>> On 3 March 2011 05:23, Richard Yee<ri...@gmail.com>  wrote:
>>>>>>
>>>>>>> Try putting it inside the tr:form or inside your panelPage
>>>>>>>
>>>>>>>
>>>>>>> -Richard
>>>>>>>
>>>>>>> 2011/3/1 Håkon Sagehaug<ha...@uni.no>
>>>>>>>
>>>>>>>> Hi
>>>>>>>>
>>>>>>>> Thanks for the reply, here is my xhtml, with a simple login form
>>>>>>>>
>>>>>>>> <tr:document title="Login Demo">
>>>>>>>>      <tr:statusIndicator>
>>>>>>>>          <f:facet name="busy">
>>>>>>>>              <tr:outputText value="#{helloWorldBacking.pollText}" />
>>>>>>>>          </f:facet>
>>>>>>>>      </tr:statusIndicator>
>>>>>>>>      <tr:form>
>>>>>>>>
>>>>>>>>          <tr:panelPage>
>>>>>>>>              <f:facet name="infoStatus">
>>>>>>>>                  <tr:legend name="required" />
>>>>>>>>              </f:facet>
>>>>>>>>
>>>>>>>>              <tr:inputText label="Username" id="username"
>>>>>>>>                  value="#{helloWorldBacking.username}"
>> required="true"
>>>>>>> />
>>>>>>>>              <tr:inputText label="Password" id="password"
>>>>>>>>                  value="#{helloWorldBacking.password}"
>> required="true"
>>>>>>>> secret="true" />
>>>>>>>>              <tr:commandButton id="button2" text="Login"
>>>>>>>> partialSubmit="true"
>>>>>>>>                  action="#{helloWorldBacking.send}" />
>>>>>>>>          </tr:panelPage>
>>>>>>>>
>>>>>>>>      </tr:form>
>>>>>>>>
>>>>>>>> </tr:document>
>>>>>>>>
>>>>>>>> And parts of the backing bean
>>>>>>>>
>>>>>>>> public String send() {
>>>>>>>>      FacesContext facesContext = FacesContext.getCurrentInstance();
>>>>>>>>
>>>>>>>>      System.out.println("user name " + username + " is logged in "
>>>>>>>>              + userLoggedIn);
>>>>>>>>
>>>>>>>>      try {
>>>>>>>>          Thread.sleep(5000);
>>>>>>>>          Token tok = tokenMgr.getToken(username, password, true);
>>>>>>>>         Thread.sleep(2000);
>>>>>>>>          pollText = "Token fetched";
>>>>>>>>          if (tok != null) {
>>>>>>>>              userLoggedIn = true;
>>>>>>>>              return ("success");
>>>>>>>>          }
>>>>>>>>          username = "";
>>>>>>>>          password = "";
>>>>>>>>      } catch (TrustException e1) {
>>>>>>>>          e1.printStackTrace();
>>>>>>>>      } catch (AxisFault e) {
>>>>>>>>          e.printStackTrace();
>>>>>>>>      } catch (FileNotFoundException e) {
>>>>>>>>          e.printStackTrace();
>>>>>>>>      } catch (XMLStreamException e) {
>>>>>>>>          e.printStackTrace();
>>>>>>>>      } catch (InterruptedException e) {
>>>>>>>>
>>>>>>>>          e.printStackTrace();
>>>>>>>>      }
>>>>>>>>      FacesMessage message = new FacesMessage("Login failed");
>>>>>>>>
>>>>>>>>      facesContext.addMessage("username", message);
>>>>>>>>
>>>>>>>>      username = "";
>>>>>>>>      password = "";
>>>>>>>>
>>>>>>>>      return ("error");
>>>>>>>>
>>>>>>>> }
>>>>>>>> As you can see I sleep the thread to simulate the operations needed
>> to
>>>>>>> log
>>>>>>>> in the user, for now I'm only getting the token. After that I'll
>> fetch
>>>>>>> the
>>>>>>>> project, data etc...
>>>>>>>>
>>>>>>>> So I wanted the pollText to apear  dynmically in the status
>> indicator,
>>>>>>> but
>>>>>>>> can get it to update,.
>>>>>>>>
>>>>>>>> Any tips?
>>>>>>>>
>>>>>>>> cheers, Håkon
>>>>>>>>
>>>>>>>> On 1 March 2011 23:23, Scott O'Bryan<da...@gmail.com>  wrote:
>>>>>>>>
>>>>>>>>> I see no reason why this wouldn't work..  What specifically is
>> failing
>>>>>>>>> for you and perhaps a code snipi might help me visualize your
>> issue.
>>>>>>>>> On Mar 1, 2011, at 3:04 PM, "Håkon Sagehaug"<
>> hakon.sagehaug@uni.no>
>>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>>> Hi all,
>>>>>>>>>>
>>>>>>>>>> I've just stared using Trinidad and myFaces, and had a question.
>> I'm
>>>>>>>>>> implementing a login in page for uses, and wanted to use the
>>>>>>>>>> statusIndicator, to give back messages for the user like
>>>>>>>>>>
>>>>>>>>>> 1. Got user information
>>>>>>>>>> 2. Loading datasets
>>>>>>>>>> 3. Logged in
>>>>>>>>>>
>>>>>>>>>> And tried to have a  tr:outputText within the statusIndicator. The
>>>>>>>> value
>>>>>>>>> for
>>>>>>>>>> the outPuttext would be linked to a backing bean, but I was not
>> very
>>>>>>>>>> successful, do you have any other tips?
>>>>>>>>>>
>>>>>>>>>> I guess one can use the progressIndicator, but I would like text
>> to
>>>>>>> be
>>>>>>>>>> returned not a procentage progress.
>>>>>>>>>>
>>>>>>>>>> cheers, Håkon


Re: Using statusIndicator

Posted by Richard Yee <ri...@gmail.com>.
You might consider breaking up the sequence of tasks into separate states and use a state machine as the target of the poll component.

Richard

Sent from my iPhone

On Mar 7, 2011, at 2:21 AM, Håkon Sagehaug <ha...@uni.no> wrote:

> Hi,
> 
> Thanks for the tip on the poller, I try that.
> 
> The login process does not take so log time, the fetching of files can take
> a long time, depending on the file size.
> 
> Håkon
> On 4 March 2011 18:22, Richard Yee <ri...@gmail.com> wrote:
> 
>> Hakon,
>> According to the docs, if you don't put an interval, it will default to
>> 5000
>> (5 secs). I would expext setting it to 0 would disable it. You could have
>> your outputText use a partialTrigger on the poll component and have it
>> update whenever the poll gets fired.
>> 
>> How long does this whole process take?
>> 
>> -Richard
>> 
>> 2011/3/4 Håkon Sagehaug <ha...@uni.no>
>> 
>>> Hi,
>>> 
>>> So we're trying to implement  part of a system, already implemented with
>>> icefaces using myfaces and Trinidad. We decided to compare alittle.
>>> Icefaces
>>> have Ajax Push, so it makes it "easy" to update clients whenever there
>> are
>>> things to update. SO when a user logs in, we're calling tree different
>>> web-services in the backend code.  In the other application we update
>> after
>>> each call to one of the web service saying
>>> 
>>> 1. Got security token
>>> 2. got user information
>>> 3. got dataset etc
>>> 
>>> All these are separate call to our web-services, and it would be nice to
>>> update the user about the events. For the login we don't start a new
>>> thread.
>>> Other actions such as adding a dataset, where the user want to fetch one
>> or
>>> more files from ftp/http we start a new thread on the server.First the
>>> thread sends the requets for adding the dataset to the web service, and
>>> gets
>>> back a id. The web service starts a thread for downloading the files,
>> when
>>> finished sets the dataset status to complete. In the mean time the thread
>>> on
>>> the web server polls the status of the download with the id given to him.
>>> So
>>> when the Web server thread gets complete from the web service, a message
>> is
>>> given to the user.
>>> 
>>> Did that give an okay overview? Just a dumb question, how to enable the
>>> poll, setting a positive poll interval? And again thanks for the patience
>>> 
>>> cheers, Håkon
>>> 
>>> 
>>> On 4 March 2011 16:07, Richard Yee <ri...@gmail.com> wrote:
>>> 
>>>> enable it on the server as a result of pressing the commandButton. can
>>> you
>>>> answer some of the questions I posed earlier?
>>>> If we see the whole picture, then perhaps we can come up with a
>> complete
>>>> solution.
>>>> 
>>>> -Richard
>>>> 
>>>> 2011/3/4 Håkon Sagehaug <ha...@uni.no>
>>>> 
>>>>> Hi
>>>>> 
>>>>> Thanks for the tips and holding out this thread.  To kick of the poll
>>> do
>>>> I
>>>>> use rendered=true/false, it should have had a enable/disable. Or can
>> I
>>>> set
>>>>> the interval to 0 or -1.
>>>>> 
>>>>> Cheers, Håkon
>>>>> 
>>>>> On 4 March 2011 14:18, Scott O'Bryan <da...@gmail.com> wrote:
>>>>> 
>>>>>> Yeah, I agree with Richard now that I know your trying to
>> dynamically
>>>>>> update it.  The poll components will kick off the AJAX request and
>>>>>> your partialTrigger (set to the poll component) will allow the text
>>> to
>>>>>> change.
>>>>>> 
>>>>>> I would also suggest disabling the poll component when you don't
>>>>>> expect any changes (ie. Maybe it doesn't start until the login is
>>>>>> submitted and then it turns off after the login successfully
>>>>>> completed).
>>>>>> 
>>>>>> Does anyone know of "Streaming Requests" are handled in the next
>>>>>> servlet spec?  If so, it would be cool for JSF to
>>>>>> Do something with them, allow renderkits like Trinidad to stream
>>>>>> updates in a more generic fashion.
>>>>>> 
>>>>>> On Mar 4, 2011, at 5:53 AM, Richard Yee <ri...@gmail.com>
>>>> wrote:
>>>>>> 
>>>>>>> Hakon,
>>>>>>> See my email from yesterday.  That is why I suggested using the
>>>> tr:poll
>>>>>> component. How many different status messages will you have? What
>>>> period
>>>>> of
>>>>>> time will the messages be changing? Depending on these answers, the
>>>>> tr:poll
>>>>>> component or the statusIndicator will work. Can you list the
>> sequence
>>>> of
>>>>>> events the timing (ie. 2 seconds or 2 minutes later xxx happens on
>>> the
>>>>>> server.) are you starting a separate thread that eventually updates
>> a
>>>>> status
>>>>>> message?
>>>>>>> 
>>>>>>> Richard
>>>>>>> 
>>>>>>> Sent from my iPhone
>>>>>>> 
>>>>>>> On Mar 4, 2011, at 1:34 AM, Håkon Sagehaug <
>> hakon.sagehaug@uni.no>
>>>>>> wrote:
>>>>>>> 
>>>>>>>> Hi
>>>>>>>> 
>>>>>>>> I put the form in various places, but I could not get the wanted
>>>>> effect.
>>>>>>>> Just curious, since this is an update of a value on the server
>>> side.
>>>>> The
>>>>>>>> clients somehow needs to know if the value have changed or not.
>> I
>>>>> guess
>>>>>>>> this is somewhere referred to as server push. My impression of
>> the
>>>>>>>> partialTriggers is that an action is taken on the client side,
>> and
>>>>> then
>>>>>>>> something is triggered on the client side.
>>>>>>>> So in my case the the value form the backing bean id read, but
>>> only
>>>>> when
>>>>>> the
>>>>>>>> button is clicked, not the hole "login session". Is this
>> correct?
>>> I
>>>>>> guess
>>>>>>>> what to me sounds correct is to have some sort of value change
>>>>> listener
>>>>>> on
>>>>>>>> the value for the output text, but I guess that's more for input
>>>> text
>>>>>> etc
>>>>>>>> 
>>>>>>>> Did this make sense?
>>>>>>>> 
>>>>>>>> Cheers, Håkon
>>>>>>>> 
>>>>>>>> 
>>>>>>>> On 3 March 2011 18:18, Scott O'Bryan <da...@gmail.com>
>> wrote:
>>>>>>>> 
>>>>>>>>> Hakkon, put the form around everything and see if it changes
>> the
>>>> PPR
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> On 03/03/2011 10:00 AM, Richard Yee wrote:
>>>>>>>>> 
>>>>>>>>>> what is the initial value of pollText in your backing bean? If
>>> it
>>>> is
>>>>>> "",
>>>>>>>>>> you
>>>>>>>>>> should set it to something else, ie. "Processing".
>>>>>>>>>> 
>>>>>>>>>> The outputText inside statusIndicator will only show during
>> the
>>>> time
>>>>>> the
>>>>>>>>>> Ajax request is being made. Once the response is returned, it
>>> will
>>>>>>>>>> disappear.
>>>>>>>>>> 
>>>>>>>>>> -Richard
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> 2011/3/3 Håkon Sagehaug<ha...@uni.no>
>>>>>>>>>> 
>>>>>>>>>> Hi
>>>>>>>>>>> 
>>>>>>>>>>> I now have my login page like this
>>>>>>>>>>> 
>>>>>>>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>>>>>>>> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
>> Transitional//EN"
>>>>>>>>>>> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
>>>>>>>>>>> <html xmlns="http://www.w3.org/1999/xhtml"
>>>>>>>>>>> xmlns:f="http://java.sun.com/jsf/core"
>>>>>>>>>>> xmlns:h="http://java.sun.com/jsf/html"
>>>>>>>>>>> xmlns:tr="http://myfaces.apache.org/trinidad">
>>>>>>>>>>> 
>>>>>>>>>>> <f:view>
>>>>>>>>>>> <tr:document title="eSysbio-myFaces-Trinidad">
>>>>>>>>>>> 
>>>>>>>>>>>     <tr:panelPage>
>>>>>>>>>>>         <f:facet name="infoStatus">
>>>>>>>>>>>             <tr:legend name="required" />
>>>>>>>>>>>         </f:facet>
>>>>>>>>>>>         <tr:form>
>>>>>>>>>>>             <h:panelGrid colums="2">
>>>>>>>>>>>                 <tr:outputLabel value="Username" />
>>>>>>>>>>>                 <tr:inputText id="username"
>>>>>>>>>>> value="#{helloWorldBacking.username}"
>>>>>>>>>>>                     required="true" />
>>>>>>>>>>>                 <tr:outputLabel value="Password" />
>>>>>>>>>>>                 <tr:inputText id="password"
>>>>>>>>>>> value="#{helloWorldBacking.password}"
>>>>>>>>>>>                     required="true" secret="true" />
>>>>>>>>>>> 
>>>>>>>>>>>             </h:panelGrid>
>>>>>>>>>>>             <tr:commandButton id="loginButton" text="Login"
>>>>>>>>>>> partialSubmit="true"
>>>>>>>>>>>                 actionListener="#{helloWorldBacking.send}"
>> />
>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>>>             <!--
>>>>>>>>>>>             <tr:statusIndicator>
>>>>>>>>>>>                 <tr:outputText
>>>>> value="#{helloWorldBacking.pollText}"
>>>>>>>>>>> />
>>>>>>>>>>>             </tr:statusIndicator>
>>>>>>>>>>>              -->
>>>>>>>>>>>             <tr:outputText
>>> value="#{helloWorldBacking.pollText}"
>>>>>>>>>>>                 partialTriggers="loginButton" />
>>>>>>>>>>>         </tr:form>
>>>>>>>>>>>     </tr:panelPage>
>>>>>>>>>>> 
>>>>>>>>>>> </tr:document>
>>>>>>>>>>> </f:view>
>>>>>>>>>>> </html>
>>>>>>>>>>> 
>>>>>>>>>>> But then I got nothing in the outPutText field. Any other
>>>> hint/tips
>>>>>> or
>>>>>>>>>>> tricks. I really appreciate the help
>>>>>>>>>>> 
>>>>>>>>>>> Cheers, Håkon
>>>>>>>>>>> 
>>>>>>>>>>> On 3 March 2011 17:25, Scott O'Bryan<da...@gmail.com>
>>>> wrote:
>>>>>>>>>>> 
>>>>>>>>>>> That doesn't seem to make any sense to me Richard.  The poll
>>>>>> component
>>>>>>>>>>>> does not replace statusIndicator, they simply do two
>> different
>>>>>> things.
>>>>>>>>>>>> The purpose of the poll component is to initiate a request
>>> based
>>>>> on
>>>>>> a
>>>>>>>>>>>> clock instead of a user click.  You still need some way to
>>>> display
>>>>>> the
>>>>>>>>>>>> information..
>>>>>>>>>>>> 
>>>>>>>>>>>> Hakon,
>>>>>>>>>>>> 
>>>>>>>>>>>> The partial trigger in this case should be on the output
>> text
>>>>>> although
>>>>>>>>>>>> having it on the status indicator should also work (you'll
>>> just
>>>>> get
>>>>>> a
>>>>>>>>>>>> larger payload).
>>>>>>>>>>>> 
>>>>>>>>>>>> Try this.  Remove the status indicator and only have the
>>> output
>>>>>> text.
>>>>>>>>>>>> Make sure your outputText is located inside the form
>> (possible
>>>>> your
>>>>>>>>>>>> getting a scoping issue).
>>>>>>>>>>>> 
>>>>>>>>>>>> Does that work?  It should.
>>>>>>>>>>>> 
>>>>>>>>>>>> On Mar 3, 2011, at 9:06 AM, Richard Yee<
>>> richard.k.yee@gmail.com
>>>>> 
>>>>>>>>>>>> wrote:
>>>>>>>>>>>> 
>>>>>>>>>>>> You don't want statusIndicator, use tr:poll instead
>>>>>>>>>>>>> 
>>>>>>>>>>>>> Richard
>>>>>>>>>>>>> 
>>>>>>>>>>>>> Sent from my iPhone
>>>>>>>>>>>>> 
>>>>>>>>>>>>> On Mar 3, 2011, at 7:48 AM, Håkon Sagehaug<
>>>> hakon.sagehaug@uni.no
>>>>>> 
>>>>>>>>>>>>> 
>>>>>>>>>>>> wrote:
>>>>>>>>>>>> 
>>>>>>>>>>>>> Hi
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> Yes, that was an old cut and past mistake, I've got
>>>> loginButton
>>>>> as
>>>>>> id
>>>>>>>>>>>>>> 
>>>>>>>>>>>>> for
>>>>>>>>>>>> 
>>>>>>>>>>>>> the button. The latest test are with loginButton, not
>>> button2.
>>>> So
>>>>>> this
>>>>>>>>>>>>>> 
>>>>>>>>>>>>> way
>>>>>>>>>>>> 
>>>>>>>>>>>>> of doing it should normally work?
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> cheers, Håkon
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> On 3 March 2011 16:35, Scott O'Bryan<da...@gmail.com>
>>>>> wrote:
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> Umm.  Considering the id of your button is button2, I'm
>> not
>>>> sure
>>>>>> why
>>>>>>>>>>>>>>> your partialTrigger is loginButton.  Can you explain?
>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>> On Mar 3, 2011, at 6:46 AM, "Håkon Sagehaug"<
>>>>>> hakon.sagehaug@uni.no>
>>>>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>> Hi all,
>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>> I might not get the full point here ;). Here is what I
>>>> tried,
>>>>>> put
>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>> trigger
>>>>>>>>>>>> 
>>>>>>>>>>>>> on
>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>> the statusIndicator like here
>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>> <tr:statusIndicator partialTriggers="loginButton">
>>>>>>>>>>>>>>>>               <f:facet name="busy">
>>>>>>>>>>>>>>>>                   <tr:outputText
>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>> value="#{helloWorldBacking.pollText}"
>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>> />
>>>>>>>>>>>>>>>>               </f:facet>
>>>>>>>>>>>>>>>>           </tr:statusIndicator>
>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>> And on the outputText like here
>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>> <tr:statusIndicator partialTriggers="loginButton">
>>>>>>>>>>>>>>>>               <f:facet name="busy">
>>>>>>>>>>>>>>>>                   <tr:outputText
>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>> value="#{helloWorldBacking.pollText}"
>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>> partialTriggers="loginButton"/>
>>>>>>>>>>>>>>>>               </f:facet>
>>>>>>>>>>>>>>>>           </tr:statusIndicator>
>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>> Where loginButton is
>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>> <tr:commandButton id="button2" text="Login"
>>>>>> partialSubmit="true"/>
>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>> But nothing seems to have the wanted effect. I looks
>> like
>>> it
>>>>>> picks
>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>> up
>>>>>>>>>>> 
>>>>>>>>>>>> the
>>>>>>>>>>>> 
>>>>>>>>>>>>> initial value for the helloWorldBacking.pollText, but when
>>> this
>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>> value
>>>>>>>>>>> 
>>>>>>>>>>>> changes it's it not propagated in the UI. Maybe this can't
>> be
>>>> done
>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>> like
>>>>>>>>>>>> 
>>>>>>>>>>>>> I've
>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>> sketched out. The backing code is the same as sent in a
>>>>> earlier
>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>> email.
>>>>>>>>>>> 
>>>>>>>>>>>> Other tips?
>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>> Cheers, Håkon
>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>> On 3 March 2011 05:23, Richard Yee<
>>> richard.k.yee@gmail.com>
>>>>>> wrote:
>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>> Try putting it inside the tr:form or inside your
>> panelPage
>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>> -Richard
>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>> 2011/3/1 Håkon Sagehaug<ha...@uni.no>
>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>> Hi
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>> Thanks for the reply, here is my xhtml, with a simple
>>>> login
>>>>>> form
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>> <tr:document title="Login Demo">
>>>>>>>>>>>>>>>>>>  <tr:statusIndicator>
>>>>>>>>>>>>>>>>>>      <f:facet name="busy">
>>>>>>>>>>>>>>>>>>          <tr:outputText
>>>>> value="#{helloWorldBacking.pollText}"
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>> />
>>>>>>>>>>> 
>>>>>>>>>>>>      </f:facet>
>>>>>>>>>>>>>>>>>>  </tr:statusIndicator>
>>>>>>>>>>>>>>>>>>  <tr:form>
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>      <tr:panelPage>
>>>>>>>>>>>>>>>>>>          <f:facet name="infoStatus">
>>>>>>>>>>>>>>>>>>              <tr:legend name="required" />
>>>>>>>>>>>>>>>>>>          </f:facet>
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>          <tr:inputText label="Username" id="username"
>>>>>>>>>>>>>>>>>>              value="#{helloWorldBacking.username}"
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>> required="true"
>>>>>>>>>>>> 
>>>>>>>>>>>>> />
>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>          <tr:inputText label="Password" id="password"
>>>>>>>>>>>>>>>>>>              value="#{helloWorldBacking.password}"
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>> required="true"
>>>>>>>>>>>> 
>>>>>>>>>>>>> secret="true" />
>>>>>>>>>>>>>>>>>>          <tr:commandButton id="button2" text="Login"
>>>>>>>>>>>>>>>>>> partialSubmit="true"
>>>>>>>>>>>>>>>>>>              action="#{helloWorldBacking.send}" />
>>>>>>>>>>>>>>>>>>      </tr:panelPage>
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>  </tr:form>
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>> </tr:document>
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>> And parts of the backing bean
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>> public String send() {
>>>>>>>>>>>>>>>>>>  FacesContext facesContext =
>>>>>> FacesContext.getCurrentInstance();
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>  System.out.println("user name " + username + " is
>>> logged
>>>>> in
>>>>>> "
>>>>>>>>>>>>>>>>>>          + userLoggedIn);
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>  try {
>>>>>>>>>>>>>>>>>>      Thread.sleep(5000);
>>>>>>>>>>>>>>>>>>      Token tok = tokenMgr.getToken(username,
>> password,
>>>>> true);
>>>>>>>>>>>>>>>>>>     Thread.sleep(2000);
>>>>>>>>>>>>>>>>>>      pollText = "Token fetched";
>>>>>>>>>>>>>>>>>>      if (tok != null) {
>>>>>>>>>>>>>>>>>>          userLoggedIn = true;
>>>>>>>>>>>>>>>>>>          return ("success");
>>>>>>>>>>>>>>>>>>      }
>>>>>>>>>>>>>>>>>>      username = "";
>>>>>>>>>>>>>>>>>>      password = "";
>>>>>>>>>>>>>>>>>>  } catch (TrustException e1) {
>>>>>>>>>>>>>>>>>>      e1.printStackTrace();
>>>>>>>>>>>>>>>>>>  } catch (AxisFault e) {
>>>>>>>>>>>>>>>>>>      e.printStackTrace();
>>>>>>>>>>>>>>>>>>  } catch (FileNotFoundException e) {
>>>>>>>>>>>>>>>>>>      e.printStackTrace();
>>>>>>>>>>>>>>>>>>  } catch (XMLStreamException e) {
>>>>>>>>>>>>>>>>>>      e.printStackTrace();
>>>>>>>>>>>>>>>>>>  } catch (InterruptedException e) {
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>      e.printStackTrace();
>>>>>>>>>>>>>>>>>>  }
>>>>>>>>>>>>>>>>>>  FacesMessage message = new FacesMessage("Login
>>> failed");
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>  facesContext.addMessage("username", message);
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>  username = "";
>>>>>>>>>>>>>>>>>>  password = "";
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>  return ("error");
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>> }
>>>>>>>>>>>>>>>>>> As you can see I sleep the thread to simulate the
>>>> operations
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>> needed
>>>>>>>>>>> 
>>>>>>>>>>>> to
>>>>>>>>>>>> 
>>>>>>>>>>>>> log
>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>> in the user, for now I'm only getting the token. After
>>>> that
>>>>>> I'll
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>> fetch
>>>>>>>>>>>> 
>>>>>>>>>>>>> the
>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>> project, data etc...
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>> So I wanted the pollText to apear  dynmically in the
>>>> status
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>> indicator,
>>>>>>>>>>>> 
>>>>>>>>>>>>> but
>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>> can get it to update,.
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>> Any tips?
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>> cheers, Håkon
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>> On 1 March 2011 23:23, Scott O'Bryan<
>>> darkarena@gmail.com>
>>>>>> wrote:
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>> I see no reason why this wouldn't work..  What
>>>> specifically
>>>>> is
>>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>> failing
>>>>>>>>>>>> 
>>>>>>>>>>>>> for you and perhaps a code snipi might help me visualize
>> your
>>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>> issue.
>>>>>>>>>>>> 
>>>>>>>>>>>>> On Mar 1, 2011, at 3:04 PM, "Håkon Sagehaug"<
>>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>> hakon.sagehaug@uni.no>
>>>>>>>>>>>> 
>>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>> Hi all,
>>>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>>> I've just stared using Trinidad and myFaces, and had
>> a
>>>>>> question.
>>>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>> I'm
>>>>>>>>>>>> 
>>>>>>>>>>>>> implementing a login in page for uses, and wanted to use
>> the
>>>>>>>>>>>>>>>>>>>> statusIndicator, to give back messages for the user
>>> like
>>>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>>> 1. Got user information
>>>>>>>>>>>>>>>>>>>> 2. Loading datasets
>>>>>>>>>>>>>>>>>>>> 3. Logged in
>>>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>>> And tried to have a  tr:outputText within the
>>>>>> statusIndicator.
>>>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>> The
>>>>>>>>>>> 
>>>>>>>>>>>> value
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>> for
>>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>>> the outPuttext would be linked to a backing bean,
>> but
>>> I
>>>>> was
>>>>>> not
>>>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>> very
>>>>>>>>>>>> 
>>>>>>>>>>>>> successful, do you have any other tips?
>>>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>>> I guess one can use the progressIndicator, but I
>> would
>>>>> like
>>>>>> text
>>>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>> to
>>>>>>>>>>>> 
>>>>>>>>>>>>> be
>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>> returned not a procentage progress.
>>>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>>> cheers, Håkon
>>>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>> 
>>>>>>>>> 
>>>>>> 
>>>>> 
>>>> 
>>> 
>> 

Re: Using statusIndicator

Posted by Håkon Sagehaug <ha...@uni.no>.
Hi,

Thanks for the tip on the poller, I try that.

The login process does not take so log time, the fetching of files can take
a long time, depending on the file size.

Håkon
On 4 March 2011 18:22, Richard Yee <ri...@gmail.com> wrote:

> Hakon,
> According to the docs, if you don't put an interval, it will default to
> 5000
> (5 secs). I would expext setting it to 0 would disable it. You could have
> your outputText use a partialTrigger on the poll component and have it
> update whenever the poll gets fired.
>
> How long does this whole process take?
>
> -Richard
>
> 2011/3/4 Håkon Sagehaug <ha...@uni.no>
>
> > Hi,
> >
> > So we're trying to implement  part of a system, already implemented with
> > icefaces using myfaces and Trinidad. We decided to compare alittle.
> > Icefaces
> > have Ajax Push, so it makes it "easy" to update clients whenever there
> are
> > things to update. SO when a user logs in, we're calling tree different
> > web-services in the backend code.  In the other application we update
> after
> > each call to one of the web service saying
> >
> > 1. Got security token
> > 2. got user information
> > 3. got dataset etc
> >
> > All these are separate call to our web-services, and it would be nice to
> > update the user about the events. For the login we don't start a new
> > thread.
> > Other actions such as adding a dataset, where the user want to fetch one
> or
> > more files from ftp/http we start a new thread on the server.First the
> > thread sends the requets for adding the dataset to the web service, and
> > gets
> > back a id. The web service starts a thread for downloading the files,
> when
> > finished sets the dataset status to complete. In the mean time the thread
> > on
> > the web server polls the status of the download with the id given to him.
> > So
> > when the Web server thread gets complete from the web service, a message
> is
> > given to the user.
> >
> > Did that give an okay overview? Just a dumb question, how to enable the
> > poll, setting a positive poll interval? And again thanks for the patience
> >
> > cheers, Håkon
> >
> >
> > On 4 March 2011 16:07, Richard Yee <ri...@gmail.com> wrote:
> >
> > > enable it on the server as a result of pressing the commandButton. can
> > you
> > > answer some of the questions I posed earlier?
> > > If we see the whole picture, then perhaps we can come up with a
> complete
> > > solution.
> > >
> > > -Richard
> > >
> > > 2011/3/4 Håkon Sagehaug <ha...@uni.no>
> > >
> > > > Hi
> > > >
> > > > Thanks for the tips and holding out this thread.  To kick of the poll
> > do
> > > I
> > > > use rendered=true/false, it should have had a enable/disable. Or can
> I
> > > set
> > > > the interval to 0 or -1.
> > > >
> > > > Cheers, Håkon
> > > >
> > > > On 4 March 2011 14:18, Scott O'Bryan <da...@gmail.com> wrote:
> > > >
> > > > > Yeah, I agree with Richard now that I know your trying to
> dynamically
> > > > > update it.  The poll components will kick off the AJAX request and
> > > > > your partialTrigger (set to the poll component) will allow the text
> > to
> > > > > change.
> > > > >
> > > > > I would also suggest disabling the poll component when you don't
> > > > > expect any changes (ie. Maybe it doesn't start until the login is
> > > > > submitted and then it turns off after the login successfully
> > > > > completed).
> > > > >
> > > > > Does anyone know of "Streaming Requests" are handled in the next
> > > > > servlet spec?  If so, it would be cool for JSF to
> > > > > Do something with them, allow renderkits like Trinidad to stream
> > > > > updates in a more generic fashion.
> > > > >
> > > > > On Mar 4, 2011, at 5:53 AM, Richard Yee <ri...@gmail.com>
> > > wrote:
> > > > >
> > > > > > Hakon,
> > > > > > See my email from yesterday.  That is why I suggested using the
> > > tr:poll
> > > > > component. How many different status messages will you have? What
> > > period
> > > > of
> > > > > time will the messages be changing? Depending on these answers, the
> > > > tr:poll
> > > > > component or the statusIndicator will work. Can you list the
> sequence
> > > of
> > > > > events the timing (ie. 2 seconds or 2 minutes later xxx happens on
> > the
> > > > > server.) are you starting a separate thread that eventually updates
> a
> > > > status
> > > > > message?
> > > > > >
> > > > > > Richard
> > > > > >
> > > > > > Sent from my iPhone
> > > > > >
> > > > > > On Mar 4, 2011, at 1:34 AM, Håkon Sagehaug <
> hakon.sagehaug@uni.no>
> > > > > wrote:
> > > > > >
> > > > > >> Hi
> > > > > >>
> > > > > >> I put the form in various places, but I could not get the wanted
> > > > effect.
> > > > > >> Just curious, since this is an update of a value on the server
> > side.
> > > > The
> > > > > >> clients somehow needs to know if the value have changed or not.
>  I
> > > > guess
> > > > > >> this is somewhere referred to as server push. My impression of
> the
> > > > > >> partialTriggers is that an action is taken on the client side,
> and
> > > > then
> > > > > >> something is triggered on the client side.
> > > > > >> So in my case the the value form the backing bean id read, but
> > only
> > > > when
> > > > > the
> > > > > >> button is clicked, not the hole "login session". Is this
> correct?
> > I
> > > > > guess
> > > > > >> what to me sounds correct is to have some sort of value change
> > > > listener
> > > > > on
> > > > > >> the value for the output text, but I guess that's more for input
> > > text
> > > > > etc
> > > > > >>
> > > > > >> Did this make sense?
> > > > > >>
> > > > > >> Cheers, Håkon
> > > > > >>
> > > > > >>
> > > > > >> On 3 March 2011 18:18, Scott O'Bryan <da...@gmail.com>
> wrote:
> > > > > >>
> > > > > >>> Hakkon, put the form around everything and see if it changes
> the
> > > PPR
> > > > > >>>
> > > > > >>>
> > > > > >>>
> > > > > >>> On 03/03/2011 10:00 AM, Richard Yee wrote:
> > > > > >>>
> > > > > >>>> what is the initial value of pollText in your backing bean? If
> > it
> > > is
> > > > > "",
> > > > > >>>> you
> > > > > >>>> should set it to something else, ie. "Processing".
> > > > > >>>>
> > > > > >>>> The outputText inside statusIndicator will only show during
> the
> > > time
> > > > > the
> > > > > >>>> Ajax request is being made. Once the response is returned, it
> > will
> > > > > >>>> disappear.
> > > > > >>>>
> > > > > >>>> -Richard
> > > > > >>>>
> > > > > >>>>
> > > > > >>>>
> > > > > >>>> 2011/3/3 Håkon Sagehaug<ha...@uni.no>
> > > > > >>>>
> > > > > >>>> Hi
> > > > > >>>>>
> > > > > >>>>> I now have my login page like this
> > > > > >>>>>
> > > > > >>>>> <?xml version="1.0" encoding="UTF-8"?>
> > > > > >>>>> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
> Transitional//EN"
> > > > > >>>>> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> > > > > >>>>> <html xmlns="http://www.w3.org/1999/xhtml"
> > > > > >>>>>  xmlns:f="http://java.sun.com/jsf/core"
> > > > > >>>>>  xmlns:h="http://java.sun.com/jsf/html"
> > > > > >>>>>  xmlns:tr="http://myfaces.apache.org/trinidad">
> > > > > >>>>>
> > > > > >>>>> <f:view>
> > > > > >>>>>  <tr:document title="eSysbio-myFaces-Trinidad">
> > > > > >>>>>
> > > > > >>>>>      <tr:panelPage>
> > > > > >>>>>          <f:facet name="infoStatus">
> > > > > >>>>>              <tr:legend name="required" />
> > > > > >>>>>          </f:facet>
> > > > > >>>>>          <tr:form>
> > > > > >>>>>              <h:panelGrid colums="2">
> > > > > >>>>>                  <tr:outputLabel value="Username" />
> > > > > >>>>>                  <tr:inputText id="username"
> > > > > >>>>> value="#{helloWorldBacking.username}"
> > > > > >>>>>                      required="true" />
> > > > > >>>>>                  <tr:outputLabel value="Password" />
> > > > > >>>>>                  <tr:inputText id="password"
> > > > > >>>>> value="#{helloWorldBacking.password}"
> > > > > >>>>>                      required="true" secret="true" />
> > > > > >>>>>
> > > > > >>>>>              </h:panelGrid>
> > > > > >>>>>              <tr:commandButton id="loginButton" text="Login"
> > > > > >>>>> partialSubmit="true"
> > > > > >>>>>                  actionListener="#{helloWorldBacking.send}"
> />
> > > > > >>>>>
> > > > > >>>>>
> > > > > >>>>>              <!--
> > > > > >>>>>              <tr:statusIndicator>
> > > > > >>>>>                  <tr:outputText
> > > > value="#{helloWorldBacking.pollText}"
> > > > > >>>>> />
> > > > > >>>>>              </tr:statusIndicator>
> > > > > >>>>>               -->
> > > > > >>>>>              <tr:outputText
> > value="#{helloWorldBacking.pollText}"
> > > > > >>>>>                  partialTriggers="loginButton" />
> > > > > >>>>>          </tr:form>
> > > > > >>>>>      </tr:panelPage>
> > > > > >>>>>
> > > > > >>>>>  </tr:document>
> > > > > >>>>> </f:view>
> > > > > >>>>> </html>
> > > > > >>>>>
> > > > > >>>>> But then I got nothing in the outPutText field. Any other
> > > hint/tips
> > > > > or
> > > > > >>>>> tricks. I really appreciate the help
> > > > > >>>>>
> > > > > >>>>> Cheers, Håkon
> > > > > >>>>>
> > > > > >>>>> On 3 March 2011 17:25, Scott O'Bryan<da...@gmail.com>
> > >  wrote:
> > > > > >>>>>
> > > > > >>>>> That doesn't seem to make any sense to me Richard.  The poll
> > > > > component
> > > > > >>>>>> does not replace statusIndicator, they simply do two
> different
> > > > > things.
> > > > > >>>>>> The purpose of the poll component is to initiate a request
> > based
> > > > on
> > > > > a
> > > > > >>>>>> clock instead of a user click.  You still need some way to
> > > display
> > > > > the
> > > > > >>>>>> information..
> > > > > >>>>>>
> > > > > >>>>>> Hakon,
> > > > > >>>>>>
> > > > > >>>>>> The partial trigger in this case should be on the output
> text
> > > > > although
> > > > > >>>>>> having it on the status indicator should also work (you'll
> > just
> > > > get
> > > > > a
> > > > > >>>>>> larger payload).
> > > > > >>>>>>
> > > > > >>>>>> Try this.  Remove the status indicator and only have the
> > output
> > > > > text.
> > > > > >>>>>> Make sure your outputText is located inside the form
> (possible
> > > > your
> > > > > >>>>>> getting a scoping issue).
> > > > > >>>>>>
> > > > > >>>>>> Does that work?  It should.
> > > > > >>>>>>
> > > > > >>>>>> On Mar 3, 2011, at 9:06 AM, Richard Yee<
> > richard.k.yee@gmail.com
> > > >
> > > > > >>>>>> wrote:
> > > > > >>>>>>
> > > > > >>>>>> You don't want statusIndicator, use tr:poll instead
> > > > > >>>>>>>
> > > > > >>>>>>> Richard
> > > > > >>>>>>>
> > > > > >>>>>>> Sent from my iPhone
> > > > > >>>>>>>
> > > > > >>>>>>> On Mar 3, 2011, at 7:48 AM, Håkon Sagehaug<
> > > hakon.sagehaug@uni.no
> > > > >
> > > > > >>>>>>>
> > > > > >>>>>> wrote:
> > > > > >>>>>>
> > > > > >>>>>>> Hi
> > > > > >>>>>>>>
> > > > > >>>>>>>> Yes, that was an old cut and past mistake, I've got
> > > loginButton
> > > > as
> > > > > id
> > > > > >>>>>>>>
> > > > > >>>>>>> for
> > > > > >>>>>>
> > > > > >>>>>>> the button. The latest test are with loginButton, not
> > button2.
> > > So
> > > > > this
> > > > > >>>>>>>>
> > > > > >>>>>>> way
> > > > > >>>>>>
> > > > > >>>>>>> of doing it should normally work?
> > > > > >>>>>>>>
> > > > > >>>>>>>> cheers, Håkon
> > > > > >>>>>>>>
> > > > > >>>>>>>> On 3 March 2011 16:35, Scott O'Bryan<da...@gmail.com>
> > > >  wrote:
> > > > > >>>>>>>>
> > > > > >>>>>>>> Umm.  Considering the id of your button is button2, I'm
> not
> > > sure
> > > > > why
> > > > > >>>>>>>>> your partialTrigger is loginButton.  Can you explain?
> > > > > >>>>>>>>>
> > > > > >>>>>>>>> On Mar 3, 2011, at 6:46 AM, "Håkon Sagehaug"<
> > > > > hakon.sagehaug@uni.no>
> > > > > >>>>>>>>> wrote:
> > > > > >>>>>>>>>
> > > > > >>>>>>>>> Hi all,
> > > > > >>>>>>>>>>
> > > > > >>>>>>>>>> I might not get the full point here ;). Here is what I
> > > tried,
> > > > > put
> > > > > >>>>>>>>>>
> > > > > >>>>>>>>> trigger
> > > > > >>>>>>
> > > > > >>>>>>> on
> > > > > >>>>>>>>>
> > > > > >>>>>>>>>> the statusIndicator like here
> > > > > >>>>>>>>>>
> > > > > >>>>>>>>>> <tr:statusIndicator partialTriggers="loginButton">
> > > > > >>>>>>>>>>                <f:facet name="busy">
> > > > > >>>>>>>>>>                    <tr:outputText
> > > > > >>>>>>>>>>
> > > > > >>>>>>>>> value="#{helloWorldBacking.pollText}"
> > > > > >>>>>>>>>
> > > > > >>>>>>>>>> />
> > > > > >>>>>>>>>>                </f:facet>
> > > > > >>>>>>>>>>            </tr:statusIndicator>
> > > > > >>>>>>>>>>
> > > > > >>>>>>>>>> And on the outputText like here
> > > > > >>>>>>>>>>
> > > > > >>>>>>>>>> <tr:statusIndicator partialTriggers="loginButton">
> > > > > >>>>>>>>>>                <f:facet name="busy">
> > > > > >>>>>>>>>>                    <tr:outputText
> > > > > >>>>>>>>>>
> > > > > >>>>>>>>> value="#{helloWorldBacking.pollText}"
> > > > > >>>>>>>>>
> > > > > >>>>>>>>>> partialTriggers="loginButton"/>
> > > > > >>>>>>>>>>                </f:facet>
> > > > > >>>>>>>>>>            </tr:statusIndicator>
> > > > > >>>>>>>>>>
> > > > > >>>>>>>>>> Where loginButton is
> > > > > >>>>>>>>>>
> > > > > >>>>>>>>>> <tr:commandButton id="button2" text="Login"
> > > > > partialSubmit="true"/>
> > > > > >>>>>>>>>>
> > > > > >>>>>>>>>> But nothing seems to have the wanted effect. I looks
> like
> > it
> > > > > picks
> > > > > >>>>>>>>>>
> > > > > >>>>>>>>> up
> > > > > >>>>>
> > > > > >>>>>> the
> > > > > >>>>>>
> > > > > >>>>>>> initial value for the helloWorldBacking.pollText, but when
> > this
> > > > > >>>>>>>>>>
> > > > > >>>>>>>>> value
> > > > > >>>>>
> > > > > >>>>>> changes it's it not propagated in the UI. Maybe this can't
> be
> > > done
> > > > > >>>>>>>>>>
> > > > > >>>>>>>>> like
> > > > > >>>>>>
> > > > > >>>>>>> I've
> > > > > >>>>>>>>>
> > > > > >>>>>>>>>> sketched out. The backing code is the same as sent in a
> > > > earlier
> > > > > >>>>>>>>>>
> > > > > >>>>>>>>> email.
> > > > > >>>>>
> > > > > >>>>>> Other tips?
> > > > > >>>>>>>>>>
> > > > > >>>>>>>>>> Cheers, Håkon
> > > > > >>>>>>>>>>
> > > > > >>>>>>>>>>
> > > > > >>>>>>>>>> On 3 March 2011 05:23, Richard Yee<
> > richard.k.yee@gmail.com>
> > > > >  wrote:
> > > > > >>>>>>>>>>
> > > > > >>>>>>>>>> Try putting it inside the tr:form or inside your
> panelPage
> > > > > >>>>>>>>>>>
> > > > > >>>>>>>>>>>
> > > > > >>>>>>>>>>> -Richard
> > > > > >>>>>>>>>>>
> > > > > >>>>>>>>>>> 2011/3/1 Håkon Sagehaug<ha...@uni.no>
> > > > > >>>>>>>>>>>
> > > > > >>>>>>>>>>> Hi
> > > > > >>>>>>>>>>>>
> > > > > >>>>>>>>>>>> Thanks for the reply, here is my xhtml, with a simple
> > > login
> > > > > form
> > > > > >>>>>>>>>>>>
> > > > > >>>>>>>>>>>> <tr:document title="Login Demo">
> > > > > >>>>>>>>>>>>   <tr:statusIndicator>
> > > > > >>>>>>>>>>>>       <f:facet name="busy">
> > > > > >>>>>>>>>>>>           <tr:outputText
> > > > value="#{helloWorldBacking.pollText}"
> > > > > >>>>>>>>>>>>
> > > > > >>>>>>>>>>> />
> > > > > >>>>>
> > > > > >>>>>>       </f:facet>
> > > > > >>>>>>>>>>>>   </tr:statusIndicator>
> > > > > >>>>>>>>>>>>   <tr:form>
> > > > > >>>>>>>>>>>>
> > > > > >>>>>>>>>>>>       <tr:panelPage>
> > > > > >>>>>>>>>>>>           <f:facet name="infoStatus">
> > > > > >>>>>>>>>>>>               <tr:legend name="required" />
> > > > > >>>>>>>>>>>>           </f:facet>
> > > > > >>>>>>>>>>>>
> > > > > >>>>>>>>>>>>           <tr:inputText label="Username" id="username"
> > > > > >>>>>>>>>>>>               value="#{helloWorldBacking.username}"
> > > > > >>>>>>>>>>>>
> > > > > >>>>>>>>>>> required="true"
> > > > > >>>>>>
> > > > > >>>>>>> />
> > > > > >>>>>>>>>>>
> > > > > >>>>>>>>>>>>           <tr:inputText label="Password" id="password"
> > > > > >>>>>>>>>>>>               value="#{helloWorldBacking.password}"
> > > > > >>>>>>>>>>>>
> > > > > >>>>>>>>>>> required="true"
> > > > > >>>>>>
> > > > > >>>>>>> secret="true" />
> > > > > >>>>>>>>>>>>           <tr:commandButton id="button2" text="Login"
> > > > > >>>>>>>>>>>> partialSubmit="true"
> > > > > >>>>>>>>>>>>               action="#{helloWorldBacking.send}" />
> > > > > >>>>>>>>>>>>       </tr:panelPage>
> > > > > >>>>>>>>>>>>
> > > > > >>>>>>>>>>>>   </tr:form>
> > > > > >>>>>>>>>>>>
> > > > > >>>>>>>>>>>> </tr:document>
> > > > > >>>>>>>>>>>>
> > > > > >>>>>>>>>>>> And parts of the backing bean
> > > > > >>>>>>>>>>>>
> > > > > >>>>>>>>>>>> public String send() {
> > > > > >>>>>>>>>>>>   FacesContext facesContext =
> > > > > FacesContext.getCurrentInstance();
> > > > > >>>>>>>>>>>>
> > > > > >>>>>>>>>>>>   System.out.println("user name " + username + " is
> > logged
> > > > in
> > > > > "
> > > > > >>>>>>>>>>>>           + userLoggedIn);
> > > > > >>>>>>>>>>>>
> > > > > >>>>>>>>>>>>   try {
> > > > > >>>>>>>>>>>>       Thread.sleep(5000);
> > > > > >>>>>>>>>>>>       Token tok = tokenMgr.getToken(username,
> password,
> > > > true);
> > > > > >>>>>>>>>>>>      Thread.sleep(2000);
> > > > > >>>>>>>>>>>>       pollText = "Token fetched";
> > > > > >>>>>>>>>>>>       if (tok != null) {
> > > > > >>>>>>>>>>>>           userLoggedIn = true;
> > > > > >>>>>>>>>>>>           return ("success");
> > > > > >>>>>>>>>>>>       }
> > > > > >>>>>>>>>>>>       username = "";
> > > > > >>>>>>>>>>>>       password = "";
> > > > > >>>>>>>>>>>>   } catch (TrustException e1) {
> > > > > >>>>>>>>>>>>       e1.printStackTrace();
> > > > > >>>>>>>>>>>>   } catch (AxisFault e) {
> > > > > >>>>>>>>>>>>       e.printStackTrace();
> > > > > >>>>>>>>>>>>   } catch (FileNotFoundException e) {
> > > > > >>>>>>>>>>>>       e.printStackTrace();
> > > > > >>>>>>>>>>>>   } catch (XMLStreamException e) {
> > > > > >>>>>>>>>>>>       e.printStackTrace();
> > > > > >>>>>>>>>>>>   } catch (InterruptedException e) {
> > > > > >>>>>>>>>>>>
> > > > > >>>>>>>>>>>>       e.printStackTrace();
> > > > > >>>>>>>>>>>>   }
> > > > > >>>>>>>>>>>>   FacesMessage message = new FacesMessage("Login
> > failed");
> > > > > >>>>>>>>>>>>
> > > > > >>>>>>>>>>>>   facesContext.addMessage("username", message);
> > > > > >>>>>>>>>>>>
> > > > > >>>>>>>>>>>>   username = "";
> > > > > >>>>>>>>>>>>   password = "";
> > > > > >>>>>>>>>>>>
> > > > > >>>>>>>>>>>>   return ("error");
> > > > > >>>>>>>>>>>>
> > > > > >>>>>>>>>>>> }
> > > > > >>>>>>>>>>>> As you can see I sleep the thread to simulate the
> > > operations
> > > > > >>>>>>>>>>>>
> > > > > >>>>>>>>>>> needed
> > > > > >>>>>
> > > > > >>>>>> to
> > > > > >>>>>>
> > > > > >>>>>>> log
> > > > > >>>>>>>>>>>
> > > > > >>>>>>>>>>>> in the user, for now I'm only getting the token. After
> > > that
> > > > > I'll
> > > > > >>>>>>>>>>>>
> > > > > >>>>>>>>>>> fetch
> > > > > >>>>>>
> > > > > >>>>>>> the
> > > > > >>>>>>>>>>>
> > > > > >>>>>>>>>>>> project, data etc...
> > > > > >>>>>>>>>>>>
> > > > > >>>>>>>>>>>> So I wanted the pollText to apear  dynmically in the
> > > status
> > > > > >>>>>>>>>>>>
> > > > > >>>>>>>>>>> indicator,
> > > > > >>>>>>
> > > > > >>>>>>> but
> > > > > >>>>>>>>>>>
> > > > > >>>>>>>>>>>> can get it to update,.
> > > > > >>>>>>>>>>>>
> > > > > >>>>>>>>>>>> Any tips?
> > > > > >>>>>>>>>>>>
> > > > > >>>>>>>>>>>> cheers, Håkon
> > > > > >>>>>>>>>>>>
> > > > > >>>>>>>>>>>> On 1 March 2011 23:23, Scott O'Bryan<
> > darkarena@gmail.com>
> > > > >  wrote:
> > > > > >>>>>>>>>>>>
> > > > > >>>>>>>>>>>> I see no reason why this wouldn't work..  What
> > > specifically
> > > > is
> > > > > >>>>>>>>>>>>>
> > > > > >>>>>>>>>>>> failing
> > > > > >>>>>>
> > > > > >>>>>>> for you and perhaps a code snipi might help me visualize
> your
> > > > > >>>>>>>>>>>>>
> > > > > >>>>>>>>>>>> issue.
> > > > > >>>>>>
> > > > > >>>>>>> On Mar 1, 2011, at 3:04 PM, "Håkon Sagehaug"<
> > > > > >>>>>>>>>>>>>
> > > > > >>>>>>>>>>>> hakon.sagehaug@uni.no>
> > > > > >>>>>>
> > > > > >>>>>>> wrote:
> > > > > >>>>>>>>>>>>>
> > > > > >>>>>>>>>>>>> Hi all,
> > > > > >>>>>>>>>>>>>>
> > > > > >>>>>>>>>>>>>> I've just stared using Trinidad and myFaces, and had
> a
> > > > > question.
> > > > > >>>>>>>>>>>>>>
> > > > > >>>>>>>>>>>>> I'm
> > > > > >>>>>>
> > > > > >>>>>>> implementing a login in page for uses, and wanted to use
> the
> > > > > >>>>>>>>>>>>>> statusIndicator, to give back messages for the user
> > like
> > > > > >>>>>>>>>>>>>>
> > > > > >>>>>>>>>>>>>> 1. Got user information
> > > > > >>>>>>>>>>>>>> 2. Loading datasets
> > > > > >>>>>>>>>>>>>> 3. Logged in
> > > > > >>>>>>>>>>>>>>
> > > > > >>>>>>>>>>>>>> And tried to have a  tr:outputText within the
> > > > > statusIndicator.
> > > > > >>>>>>>>>>>>>>
> > > > > >>>>>>>>>>>>> The
> > > > > >>>>>
> > > > > >>>>>> value
> > > > > >>>>>>>>>>>>
> > > > > >>>>>>>>>>>>> for
> > > > > >>>>>>>>>>>>>
> > > > > >>>>>>>>>>>>>> the outPuttext would be linked to a backing bean,
> but
> > I
> > > > was
> > > > > not
> > > > > >>>>>>>>>>>>>>
> > > > > >>>>>>>>>>>>> very
> > > > > >>>>>>
> > > > > >>>>>>> successful, do you have any other tips?
> > > > > >>>>>>>>>>>>>>
> > > > > >>>>>>>>>>>>>> I guess one can use the progressIndicator, but I
> would
> > > > like
> > > > > text
> > > > > >>>>>>>>>>>>>>
> > > > > >>>>>>>>>>>>> to
> > > > > >>>>>>
> > > > > >>>>>>> be
> > > > > >>>>>>>>>>>
> > > > > >>>>>>>>>>>> returned not a procentage progress.
> > > > > >>>>>>>>>>>>>>
> > > > > >>>>>>>>>>>>>> cheers, Håkon
> > > > > >>>>>>>>>>>>>>
> > > > > >>>>>>>>>>>>>
> > > > > >>>
> > > > >
> > > >
> > >
> >
>

Re: Using statusIndicator

Posted by Richard Yee <ri...@gmail.com>.
Hakon,
According to the docs, if you don't put an interval, it will default to 5000
(5 secs). I would expext setting it to 0 would disable it. You could have
your outputText use a partialTrigger on the poll component and have it
update whenever the poll gets fired.

How long does this whole process take?

-Richard

2011/3/4 Håkon Sagehaug <ha...@uni.no>

> Hi,
>
> So we're trying to implement  part of a system, already implemented with
> icefaces using myfaces and Trinidad. We decided to compare alittle.
> Icefaces
> have Ajax Push, so it makes it "easy" to update clients whenever there are
> things to update. SO when a user logs in, we're calling tree different
> web-services in the backend code.  In the other application we update after
> each call to one of the web service saying
>
> 1. Got security token
> 2. got user information
> 3. got dataset etc
>
> All these are separate call to our web-services, and it would be nice to
> update the user about the events. For the login we don't start a new
> thread.
> Other actions such as adding a dataset, where the user want to fetch one or
> more files from ftp/http we start a new thread on the server.First the
> thread sends the requets for adding the dataset to the web service, and
> gets
> back a id. The web service starts a thread for downloading the files, when
> finished sets the dataset status to complete. In the mean time the thread
> on
> the web server polls the status of the download with the id given to him.
> So
> when the Web server thread gets complete from the web service, a message is
> given to the user.
>
> Did that give an okay overview? Just a dumb question, how to enable the
> poll, setting a positive poll interval? And again thanks for the patience
>
> cheers, Håkon
>
>
> On 4 March 2011 16:07, Richard Yee <ri...@gmail.com> wrote:
>
> > enable it on the server as a result of pressing the commandButton. can
> you
> > answer some of the questions I posed earlier?
> > If we see the whole picture, then perhaps we can come up with a complete
> > solution.
> >
> > -Richard
> >
> > 2011/3/4 Håkon Sagehaug <ha...@uni.no>
> >
> > > Hi
> > >
> > > Thanks for the tips and holding out this thread.  To kick of the poll
> do
> > I
> > > use rendered=true/false, it should have had a enable/disable. Or can I
> > set
> > > the interval to 0 or -1.
> > >
> > > Cheers, Håkon
> > >
> > > On 4 March 2011 14:18, Scott O'Bryan <da...@gmail.com> wrote:
> > >
> > > > Yeah, I agree with Richard now that I know your trying to dynamically
> > > > update it.  The poll components will kick off the AJAX request and
> > > > your partialTrigger (set to the poll component) will allow the text
> to
> > > > change.
> > > >
> > > > I would also suggest disabling the poll component when you don't
> > > > expect any changes (ie. Maybe it doesn't start until the login is
> > > > submitted and then it turns off after the login successfully
> > > > completed).
> > > >
> > > > Does anyone know of "Streaming Requests" are handled in the next
> > > > servlet spec?  If so, it would be cool for JSF to
> > > > Do something with them, allow renderkits like Trinidad to stream
> > > > updates in a more generic fashion.
> > > >
> > > > On Mar 4, 2011, at 5:53 AM, Richard Yee <ri...@gmail.com>
> > wrote:
> > > >
> > > > > Hakon,
> > > > > See my email from yesterday.  That is why I suggested using the
> > tr:poll
> > > > component. How many different status messages will you have? What
> > period
> > > of
> > > > time will the messages be changing? Depending on these answers, the
> > > tr:poll
> > > > component or the statusIndicator will work. Can you list the sequence
> > of
> > > > events the timing (ie. 2 seconds or 2 minutes later xxx happens on
> the
> > > > server.) are you starting a separate thread that eventually updates a
> > > status
> > > > message?
> > > > >
> > > > > Richard
> > > > >
> > > > > Sent from my iPhone
> > > > >
> > > > > On Mar 4, 2011, at 1:34 AM, Håkon Sagehaug <ha...@uni.no>
> > > > wrote:
> > > > >
> > > > >> Hi
> > > > >>
> > > > >> I put the form in various places, but I could not get the wanted
> > > effect.
> > > > >> Just curious, since this is an update of a value on the server
> side.
> > > The
> > > > >> clients somehow needs to know if the value have changed or not.  I
> > > guess
> > > > >> this is somewhere referred to as server push. My impression of the
> > > > >> partialTriggers is that an action is taken on the client side, and
> > > then
> > > > >> something is triggered on the client side.
> > > > >> So in my case the the value form the backing bean id read, but
> only
> > > when
> > > > the
> > > > >> button is clicked, not the hole "login session". Is this correct?
> I
> > > > guess
> > > > >> what to me sounds correct is to have some sort of value change
> > > listener
> > > > on
> > > > >> the value for the output text, but I guess that's more for input
> > text
> > > > etc
> > > > >>
> > > > >> Did this make sense?
> > > > >>
> > > > >> Cheers, Håkon
> > > > >>
> > > > >>
> > > > >> On 3 March 2011 18:18, Scott O'Bryan <da...@gmail.com> wrote:
> > > > >>
> > > > >>> Hakkon, put the form around everything and see if it changes the
> > PPR
> > > > >>>
> > > > >>>
> > > > >>>
> > > > >>> On 03/03/2011 10:00 AM, Richard Yee wrote:
> > > > >>>
> > > > >>>> what is the initial value of pollText in your backing bean? If
> it
> > is
> > > > "",
> > > > >>>> you
> > > > >>>> should set it to something else, ie. "Processing".
> > > > >>>>
> > > > >>>> The outputText inside statusIndicator will only show during the
> > time
> > > > the
> > > > >>>> Ajax request is being made. Once the response is returned, it
> will
> > > > >>>> disappear.
> > > > >>>>
> > > > >>>> -Richard
> > > > >>>>
> > > > >>>>
> > > > >>>>
> > > > >>>> 2011/3/3 Håkon Sagehaug<ha...@uni.no>
> > > > >>>>
> > > > >>>> Hi
> > > > >>>>>
> > > > >>>>> I now have my login page like this
> > > > >>>>>
> > > > >>>>> <?xml version="1.0" encoding="UTF-8"?>
> > > > >>>>> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> > > > >>>>> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> > > > >>>>> <html xmlns="http://www.w3.org/1999/xhtml"
> > > > >>>>>  xmlns:f="http://java.sun.com/jsf/core"
> > > > >>>>>  xmlns:h="http://java.sun.com/jsf/html"
> > > > >>>>>  xmlns:tr="http://myfaces.apache.org/trinidad">
> > > > >>>>>
> > > > >>>>> <f:view>
> > > > >>>>>  <tr:document title="eSysbio-myFaces-Trinidad">
> > > > >>>>>
> > > > >>>>>      <tr:panelPage>
> > > > >>>>>          <f:facet name="infoStatus">
> > > > >>>>>              <tr:legend name="required" />
> > > > >>>>>          </f:facet>
> > > > >>>>>          <tr:form>
> > > > >>>>>              <h:panelGrid colums="2">
> > > > >>>>>                  <tr:outputLabel value="Username" />
> > > > >>>>>                  <tr:inputText id="username"
> > > > >>>>> value="#{helloWorldBacking.username}"
> > > > >>>>>                      required="true" />
> > > > >>>>>                  <tr:outputLabel value="Password" />
> > > > >>>>>                  <tr:inputText id="password"
> > > > >>>>> value="#{helloWorldBacking.password}"
> > > > >>>>>                      required="true" secret="true" />
> > > > >>>>>
> > > > >>>>>              </h:panelGrid>
> > > > >>>>>              <tr:commandButton id="loginButton" text="Login"
> > > > >>>>> partialSubmit="true"
> > > > >>>>>                  actionListener="#{helloWorldBacking.send}" />
> > > > >>>>>
> > > > >>>>>
> > > > >>>>>              <!--
> > > > >>>>>              <tr:statusIndicator>
> > > > >>>>>                  <tr:outputText
> > > value="#{helloWorldBacking.pollText}"
> > > > >>>>> />
> > > > >>>>>              </tr:statusIndicator>
> > > > >>>>>               -->
> > > > >>>>>              <tr:outputText
> value="#{helloWorldBacking.pollText}"
> > > > >>>>>                  partialTriggers="loginButton" />
> > > > >>>>>          </tr:form>
> > > > >>>>>      </tr:panelPage>
> > > > >>>>>
> > > > >>>>>  </tr:document>
> > > > >>>>> </f:view>
> > > > >>>>> </html>
> > > > >>>>>
> > > > >>>>> But then I got nothing in the outPutText field. Any other
> > hint/tips
> > > > or
> > > > >>>>> tricks. I really appreciate the help
> > > > >>>>>
> > > > >>>>> Cheers, Håkon
> > > > >>>>>
> > > > >>>>> On 3 March 2011 17:25, Scott O'Bryan<da...@gmail.com>
> >  wrote:
> > > > >>>>>
> > > > >>>>> That doesn't seem to make any sense to me Richard.  The poll
> > > > component
> > > > >>>>>> does not replace statusIndicator, they simply do two different
> > > > things.
> > > > >>>>>> The purpose of the poll component is to initiate a request
> based
> > > on
> > > > a
> > > > >>>>>> clock instead of a user click.  You still need some way to
> > display
> > > > the
> > > > >>>>>> information..
> > > > >>>>>>
> > > > >>>>>> Hakon,
> > > > >>>>>>
> > > > >>>>>> The partial trigger in this case should be on the output text
> > > > although
> > > > >>>>>> having it on the status indicator should also work (you'll
> just
> > > get
> > > > a
> > > > >>>>>> larger payload).
> > > > >>>>>>
> > > > >>>>>> Try this.  Remove the status indicator and only have the
> output
> > > > text.
> > > > >>>>>> Make sure your outputText is located inside the form (possible
> > > your
> > > > >>>>>> getting a scoping issue).
> > > > >>>>>>
> > > > >>>>>> Does that work?  It should.
> > > > >>>>>>
> > > > >>>>>> On Mar 3, 2011, at 9:06 AM, Richard Yee<
> richard.k.yee@gmail.com
> > >
> > > > >>>>>> wrote:
> > > > >>>>>>
> > > > >>>>>> You don't want statusIndicator, use tr:poll instead
> > > > >>>>>>>
> > > > >>>>>>> Richard
> > > > >>>>>>>
> > > > >>>>>>> Sent from my iPhone
> > > > >>>>>>>
> > > > >>>>>>> On Mar 3, 2011, at 7:48 AM, Håkon Sagehaug<
> > hakon.sagehaug@uni.no
> > > >
> > > > >>>>>>>
> > > > >>>>>> wrote:
> > > > >>>>>>
> > > > >>>>>>> Hi
> > > > >>>>>>>>
> > > > >>>>>>>> Yes, that was an old cut and past mistake, I've got
> > loginButton
> > > as
> > > > id
> > > > >>>>>>>>
> > > > >>>>>>> for
> > > > >>>>>>
> > > > >>>>>>> the button. The latest test are with loginButton, not
> button2.
> > So
> > > > this
> > > > >>>>>>>>
> > > > >>>>>>> way
> > > > >>>>>>
> > > > >>>>>>> of doing it should normally work?
> > > > >>>>>>>>
> > > > >>>>>>>> cheers, Håkon
> > > > >>>>>>>>
> > > > >>>>>>>> On 3 March 2011 16:35, Scott O'Bryan<da...@gmail.com>
> > >  wrote:
> > > > >>>>>>>>
> > > > >>>>>>>> Umm.  Considering the id of your button is button2, I'm not
> > sure
> > > > why
> > > > >>>>>>>>> your partialTrigger is loginButton.  Can you explain?
> > > > >>>>>>>>>
> > > > >>>>>>>>> On Mar 3, 2011, at 6:46 AM, "Håkon Sagehaug"<
> > > > hakon.sagehaug@uni.no>
> > > > >>>>>>>>> wrote:
> > > > >>>>>>>>>
> > > > >>>>>>>>> Hi all,
> > > > >>>>>>>>>>
> > > > >>>>>>>>>> I might not get the full point here ;). Here is what I
> > tried,
> > > > put
> > > > >>>>>>>>>>
> > > > >>>>>>>>> trigger
> > > > >>>>>>
> > > > >>>>>>> on
> > > > >>>>>>>>>
> > > > >>>>>>>>>> the statusIndicator like here
> > > > >>>>>>>>>>
> > > > >>>>>>>>>> <tr:statusIndicator partialTriggers="loginButton">
> > > > >>>>>>>>>>                <f:facet name="busy">
> > > > >>>>>>>>>>                    <tr:outputText
> > > > >>>>>>>>>>
> > > > >>>>>>>>> value="#{helloWorldBacking.pollText}"
> > > > >>>>>>>>>
> > > > >>>>>>>>>> />
> > > > >>>>>>>>>>                </f:facet>
> > > > >>>>>>>>>>            </tr:statusIndicator>
> > > > >>>>>>>>>>
> > > > >>>>>>>>>> And on the outputText like here
> > > > >>>>>>>>>>
> > > > >>>>>>>>>> <tr:statusIndicator partialTriggers="loginButton">
> > > > >>>>>>>>>>                <f:facet name="busy">
> > > > >>>>>>>>>>                    <tr:outputText
> > > > >>>>>>>>>>
> > > > >>>>>>>>> value="#{helloWorldBacking.pollText}"
> > > > >>>>>>>>>
> > > > >>>>>>>>>> partialTriggers="loginButton"/>
> > > > >>>>>>>>>>                </f:facet>
> > > > >>>>>>>>>>            </tr:statusIndicator>
> > > > >>>>>>>>>>
> > > > >>>>>>>>>> Where loginButton is
> > > > >>>>>>>>>>
> > > > >>>>>>>>>> <tr:commandButton id="button2" text="Login"
> > > > partialSubmit="true"/>
> > > > >>>>>>>>>>
> > > > >>>>>>>>>> But nothing seems to have the wanted effect. I looks like
> it
> > > > picks
> > > > >>>>>>>>>>
> > > > >>>>>>>>> up
> > > > >>>>>
> > > > >>>>>> the
> > > > >>>>>>
> > > > >>>>>>> initial value for the helloWorldBacking.pollText, but when
> this
> > > > >>>>>>>>>>
> > > > >>>>>>>>> value
> > > > >>>>>
> > > > >>>>>> changes it's it not propagated in the UI. Maybe this can't be
> > done
> > > > >>>>>>>>>>
> > > > >>>>>>>>> like
> > > > >>>>>>
> > > > >>>>>>> I've
> > > > >>>>>>>>>
> > > > >>>>>>>>>> sketched out. The backing code is the same as sent in a
> > > earlier
> > > > >>>>>>>>>>
> > > > >>>>>>>>> email.
> > > > >>>>>
> > > > >>>>>> Other tips?
> > > > >>>>>>>>>>
> > > > >>>>>>>>>> Cheers, Håkon
> > > > >>>>>>>>>>
> > > > >>>>>>>>>>
> > > > >>>>>>>>>> On 3 March 2011 05:23, Richard Yee<
> richard.k.yee@gmail.com>
> > > >  wrote:
> > > > >>>>>>>>>>
> > > > >>>>>>>>>> Try putting it inside the tr:form or inside your panelPage
> > > > >>>>>>>>>>>
> > > > >>>>>>>>>>>
> > > > >>>>>>>>>>> -Richard
> > > > >>>>>>>>>>>
> > > > >>>>>>>>>>> 2011/3/1 Håkon Sagehaug<ha...@uni.no>
> > > > >>>>>>>>>>>
> > > > >>>>>>>>>>> Hi
> > > > >>>>>>>>>>>>
> > > > >>>>>>>>>>>> Thanks for the reply, here is my xhtml, with a simple
> > login
> > > > form
> > > > >>>>>>>>>>>>
> > > > >>>>>>>>>>>> <tr:document title="Login Demo">
> > > > >>>>>>>>>>>>   <tr:statusIndicator>
> > > > >>>>>>>>>>>>       <f:facet name="busy">
> > > > >>>>>>>>>>>>           <tr:outputText
> > > value="#{helloWorldBacking.pollText}"
> > > > >>>>>>>>>>>>
> > > > >>>>>>>>>>> />
> > > > >>>>>
> > > > >>>>>>       </f:facet>
> > > > >>>>>>>>>>>>   </tr:statusIndicator>
> > > > >>>>>>>>>>>>   <tr:form>
> > > > >>>>>>>>>>>>
> > > > >>>>>>>>>>>>       <tr:panelPage>
> > > > >>>>>>>>>>>>           <f:facet name="infoStatus">
> > > > >>>>>>>>>>>>               <tr:legend name="required" />
> > > > >>>>>>>>>>>>           </f:facet>
> > > > >>>>>>>>>>>>
> > > > >>>>>>>>>>>>           <tr:inputText label="Username" id="username"
> > > > >>>>>>>>>>>>               value="#{helloWorldBacking.username}"
> > > > >>>>>>>>>>>>
> > > > >>>>>>>>>>> required="true"
> > > > >>>>>>
> > > > >>>>>>> />
> > > > >>>>>>>>>>>
> > > > >>>>>>>>>>>>           <tr:inputText label="Password" id="password"
> > > > >>>>>>>>>>>>               value="#{helloWorldBacking.password}"
> > > > >>>>>>>>>>>>
> > > > >>>>>>>>>>> required="true"
> > > > >>>>>>
> > > > >>>>>>> secret="true" />
> > > > >>>>>>>>>>>>           <tr:commandButton id="button2" text="Login"
> > > > >>>>>>>>>>>> partialSubmit="true"
> > > > >>>>>>>>>>>>               action="#{helloWorldBacking.send}" />
> > > > >>>>>>>>>>>>       </tr:panelPage>
> > > > >>>>>>>>>>>>
> > > > >>>>>>>>>>>>   </tr:form>
> > > > >>>>>>>>>>>>
> > > > >>>>>>>>>>>> </tr:document>
> > > > >>>>>>>>>>>>
> > > > >>>>>>>>>>>> And parts of the backing bean
> > > > >>>>>>>>>>>>
> > > > >>>>>>>>>>>> public String send() {
> > > > >>>>>>>>>>>>   FacesContext facesContext =
> > > > FacesContext.getCurrentInstance();
> > > > >>>>>>>>>>>>
> > > > >>>>>>>>>>>>   System.out.println("user name " + username + " is
> logged
> > > in
> > > > "
> > > > >>>>>>>>>>>>           + userLoggedIn);
> > > > >>>>>>>>>>>>
> > > > >>>>>>>>>>>>   try {
> > > > >>>>>>>>>>>>       Thread.sleep(5000);
> > > > >>>>>>>>>>>>       Token tok = tokenMgr.getToken(username, password,
> > > true);
> > > > >>>>>>>>>>>>      Thread.sleep(2000);
> > > > >>>>>>>>>>>>       pollText = "Token fetched";
> > > > >>>>>>>>>>>>       if (tok != null) {
> > > > >>>>>>>>>>>>           userLoggedIn = true;
> > > > >>>>>>>>>>>>           return ("success");
> > > > >>>>>>>>>>>>       }
> > > > >>>>>>>>>>>>       username = "";
> > > > >>>>>>>>>>>>       password = "";
> > > > >>>>>>>>>>>>   } catch (TrustException e1) {
> > > > >>>>>>>>>>>>       e1.printStackTrace();
> > > > >>>>>>>>>>>>   } catch (AxisFault e) {
> > > > >>>>>>>>>>>>       e.printStackTrace();
> > > > >>>>>>>>>>>>   } catch (FileNotFoundException e) {
> > > > >>>>>>>>>>>>       e.printStackTrace();
> > > > >>>>>>>>>>>>   } catch (XMLStreamException e) {
> > > > >>>>>>>>>>>>       e.printStackTrace();
> > > > >>>>>>>>>>>>   } catch (InterruptedException e) {
> > > > >>>>>>>>>>>>
> > > > >>>>>>>>>>>>       e.printStackTrace();
> > > > >>>>>>>>>>>>   }
> > > > >>>>>>>>>>>>   FacesMessage message = new FacesMessage("Login
> failed");
> > > > >>>>>>>>>>>>
> > > > >>>>>>>>>>>>   facesContext.addMessage("username", message);
> > > > >>>>>>>>>>>>
> > > > >>>>>>>>>>>>   username = "";
> > > > >>>>>>>>>>>>   password = "";
> > > > >>>>>>>>>>>>
> > > > >>>>>>>>>>>>   return ("error");
> > > > >>>>>>>>>>>>
> > > > >>>>>>>>>>>> }
> > > > >>>>>>>>>>>> As you can see I sleep the thread to simulate the
> > operations
> > > > >>>>>>>>>>>>
> > > > >>>>>>>>>>> needed
> > > > >>>>>
> > > > >>>>>> to
> > > > >>>>>>
> > > > >>>>>>> log
> > > > >>>>>>>>>>>
> > > > >>>>>>>>>>>> in the user, for now I'm only getting the token. After
> > that
> > > > I'll
> > > > >>>>>>>>>>>>
> > > > >>>>>>>>>>> fetch
> > > > >>>>>>
> > > > >>>>>>> the
> > > > >>>>>>>>>>>
> > > > >>>>>>>>>>>> project, data etc...
> > > > >>>>>>>>>>>>
> > > > >>>>>>>>>>>> So I wanted the pollText to apear  dynmically in the
> > status
> > > > >>>>>>>>>>>>
> > > > >>>>>>>>>>> indicator,
> > > > >>>>>>
> > > > >>>>>>> but
> > > > >>>>>>>>>>>
> > > > >>>>>>>>>>>> can get it to update,.
> > > > >>>>>>>>>>>>
> > > > >>>>>>>>>>>> Any tips?
> > > > >>>>>>>>>>>>
> > > > >>>>>>>>>>>> cheers, Håkon
> > > > >>>>>>>>>>>>
> > > > >>>>>>>>>>>> On 1 March 2011 23:23, Scott O'Bryan<
> darkarena@gmail.com>
> > > >  wrote:
> > > > >>>>>>>>>>>>
> > > > >>>>>>>>>>>> I see no reason why this wouldn't work..  What
> > specifically
> > > is
> > > > >>>>>>>>>>>>>
> > > > >>>>>>>>>>>> failing
> > > > >>>>>>
> > > > >>>>>>> for you and perhaps a code snipi might help me visualize your
> > > > >>>>>>>>>>>>>
> > > > >>>>>>>>>>>> issue.
> > > > >>>>>>
> > > > >>>>>>> On Mar 1, 2011, at 3:04 PM, "Håkon Sagehaug"<
> > > > >>>>>>>>>>>>>
> > > > >>>>>>>>>>>> hakon.sagehaug@uni.no>
> > > > >>>>>>
> > > > >>>>>>> wrote:
> > > > >>>>>>>>>>>>>
> > > > >>>>>>>>>>>>> Hi all,
> > > > >>>>>>>>>>>>>>
> > > > >>>>>>>>>>>>>> I've just stared using Trinidad and myFaces, and had a
> > > > question.
> > > > >>>>>>>>>>>>>>
> > > > >>>>>>>>>>>>> I'm
> > > > >>>>>>
> > > > >>>>>>> implementing a login in page for uses, and wanted to use the
> > > > >>>>>>>>>>>>>> statusIndicator, to give back messages for the user
> like
> > > > >>>>>>>>>>>>>>
> > > > >>>>>>>>>>>>>> 1. Got user information
> > > > >>>>>>>>>>>>>> 2. Loading datasets
> > > > >>>>>>>>>>>>>> 3. Logged in
> > > > >>>>>>>>>>>>>>
> > > > >>>>>>>>>>>>>> And tried to have a  tr:outputText within the
> > > > statusIndicator.
> > > > >>>>>>>>>>>>>>
> > > > >>>>>>>>>>>>> The
> > > > >>>>>
> > > > >>>>>> value
> > > > >>>>>>>>>>>>
> > > > >>>>>>>>>>>>> for
> > > > >>>>>>>>>>>>>
> > > > >>>>>>>>>>>>>> the outPuttext would be linked to a backing bean, but
> I
> > > was
> > > > not
> > > > >>>>>>>>>>>>>>
> > > > >>>>>>>>>>>>> very
> > > > >>>>>>
> > > > >>>>>>> successful, do you have any other tips?
> > > > >>>>>>>>>>>>>>
> > > > >>>>>>>>>>>>>> I guess one can use the progressIndicator, but I would
> > > like
> > > > text
> > > > >>>>>>>>>>>>>>
> > > > >>>>>>>>>>>>> to
> > > > >>>>>>
> > > > >>>>>>> be
> > > > >>>>>>>>>>>
> > > > >>>>>>>>>>>> returned not a procentage progress.
> > > > >>>>>>>>>>>>>>
> > > > >>>>>>>>>>>>>> cheers, Håkon
> > > > >>>>>>>>>>>>>>
> > > > >>>>>>>>>>>>>
> > > > >>>
> > > >
> > >
> >
>

Re: Using statusIndicator

Posted by Scott O'Bryan <da...@gmail.com>.
Well Trinidad is able to do many things on the client without needing
to go to the server.  Moreso, however, Trinidad's framework is very
solid.  Oracle's renderkit, for instance, extends Trinidad to do a
animations, push technology, and a bunch of other things.

I guess the overall design principal for Trinidad has been to allow
the greatest control over the request/response payload while sticking
as much as possible to the spirit of JSF.

I do know there is some interest in developing a new renderkit with
some extra capabilities on top of Trinidad or maybe some of the push
stuff can be added.  Hopefully we'll get some traction on this.

Scott

On Mar 7, 2011, at 7:47 AM, Håkon Sagehaug <ha...@uni.no> wrote:

> Yes I guess we've seen this. So we just have to figure out how to ask from
> the client side each time we want something updated e.g. a list of
> something. There I guess the poller is what we would use, and turn it off if
> we don't need it anymore. BTW is that by setting interval to 0(zero)?
>
> Or any other better ways to ask for updates from a client?
>
> So fare we like myfaces/trinidad, so we will continue trying it out.
>
> Håkon
>
> On 7 March 2011 15:27, Scott O'Bryan <da...@gmail.com> wrote:
>
>> Yeah.  ICEfaces has an interesting model.  Their AJAX is merely a
>> synchronization between the client and the DOM stored on the server.
>> There are a number of real advantages to the framework and a number of
>> disadvantages.
>>
>> Trinidad is architected on a different principal.  There is a lot of
>> work done directly on the client and their is no server-side Dom.  And
>> while ServerSide push can be done in Trinidad with some extensions to
>> the framework, they have to be expressly enabled on a component by
>> commoner basis.
>>
>> Scott
>>
>> On Mar 4, 2011, at 8:39 AM, Håkon Sagehaug <ha...@uni.no> wrote:
>>
>>> Hi,
>>>
>>> So we're trying to implement  part of a system, already implemented with
>>> icefaces using myfaces and Trinidad. We decided to compare alittle.
>> Icefaces
>>> have Ajax Push, so it makes it "easy" to update clients whenever there
>> are
>>> things to update. SO when a user logs in, we're calling tree different
>>> web-services in the backend code.  In the other application we update
>> after
>>> each call to one of the web service saying
>>>
>>> 1. Got security token
>>> 2. got user information
>>> 3. got dataset etc
>>>
>>> All these are separate call to our web-services, and it would be nice to
>>> update the user about the events. For the login we don't start a new
>> thread.
>>> Other actions such as adding a dataset, where the user want to fetch one
>> or
>>> more files from ftp/http we start a new thread on the server.First the
>>> thread sends the requets for adding the dataset to the web service, and
>> gets
>>> back a id. The web service starts a thread for downloading the files,
>> when
>>> finished sets the dataset status to complete. In the mean time the thread
>> on
>>> the web server polls the status of the download with the id given to him.
>> So
>>> when the Web server thread gets complete from the web service, a message
>> is
>>> given to the user.
>>>
>>> Did that give an okay overview? Just a dumb question, how to enable the
>>> poll, setting a positive poll interval? And again thanks for the patience
>>>
>>> cheers, Håkon
>>>
>>>
>>> On 4 March 2011 16:07, Richard Yee <ri...@gmail.com> wrote:
>>>
>>>> enable it on the server as a result of pressing the commandButton. can
>> you
>>>> answer some of the questions I posed earlier?
>>>> If we see the whole picture, then perhaps we can come up with a complete
>>>> solution.
>>>>
>>>> -Richard
>>>>
>>>> 2011/3/4 Håkon Sagehaug <ha...@uni.no>
>>>>
>>>>> Hi
>>>>>
>>>>> Thanks for the tips and holding out this thread.  To kick of the poll
>> do
>>>> I
>>>>> use rendered=true/false, it should have had a enable/disable. Or can I
>>>> set
>>>>> the interval to 0 or -1.
>>>>>
>>>>> Cheers, Håkon
>>>>>
>>>>> On 4 March 2011 14:18, Scott O'Bryan <da...@gmail.com> wrote:
>>>>>
>>>>>> Yeah, I agree with Richard now that I know your trying to dynamically
>>>>>> update it.  The poll components will kick off the AJAX request and
>>>>>> your partialTrigger (set to the poll component) will allow the text to
>>>>>> change.
>>>>>>
>>>>>> I would also suggest disabling the poll component when you don't
>>>>>> expect any changes (ie. Maybe it doesn't start until the login is
>>>>>> submitted and then it turns off after the login successfully
>>>>>> completed).
>>>>>>
>>>>>> Does anyone know of "Streaming Requests" are handled in the next
>>>>>> servlet spec?  If so, it would be cool for JSF to
>>>>>> Do something with them, allow renderkits like Trinidad to stream
>>>>>> updates in a more generic fashion.
>>>>>>
>>>>>> On Mar 4, 2011, at 5:53 AM, Richard Yee <ri...@gmail.com>
>>>> wrote:
>>>>>>
>>>>>>> Hakon,
>>>>>>> See my email from yesterday.  That is why I suggested using the
>>>> tr:poll
>>>>>> component. How many different status messages will you have? What
>>>> period
>>>>> of
>>>>>> time will the messages be changing? Depending on these answers, the
>>>>> tr:poll
>>>>>> component or the statusIndicator will work. Can you list the sequence
>>>> of
>>>>>> events the timing (ie. 2 seconds or 2 minutes later xxx happens on the
>>>>>> server.) are you starting a separate thread that eventually updates a
>>>>> status
>>>>>> message?
>>>>>>>
>>>>>>> Richard
>>>>>>>
>>>>>>> Sent from my iPhone
>>>>>>>
>>>>>>> On Mar 4, 2011, at 1:34 AM, Håkon Sagehaug <ha...@uni.no>
>>>>>> wrote:
>>>>>>>
>>>>>>>> Hi
>>>>>>>>
>>>>>>>> I put the form in various places, but I could not get the wanted
>>>>> effect.
>>>>>>>> Just curious, since this is an update of a value on the server side.
>>>>> The
>>>>>>>> clients somehow needs to know if the value have changed or not.  I
>>>>> guess
>>>>>>>> this is somewhere referred to as server push. My impression of the
>>>>>>>> partialTriggers is that an action is taken on the client side, and
>>>>> then
>>>>>>>> something is triggered on the client side.
>>>>>>>> So in my case the the value form the backing bean id read, but only
>>>>> when
>>>>>> the
>>>>>>>> button is clicked, not the hole "login session". Is this correct? I
>>>>>> guess
>>>>>>>> what to me sounds correct is to have some sort of value change
>>>>> listener
>>>>>> on
>>>>>>>> the value for the output text, but I guess that's more for input
>>>> text
>>>>>> etc
>>>>>>>>
>>>>>>>> Did this make sense?
>>>>>>>>
>>>>>>>> Cheers, Håkon
>>>>>>>>
>>>>>>>>
>>>>>>>> On 3 March 2011 18:18, Scott O'Bryan <da...@gmail.com> wrote:
>>>>>>>>
>>>>>>>>> Hakkon, put the form around everything and see if it changes the
>>>> PPR
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On 03/03/2011 10:00 AM, Richard Yee wrote:
>>>>>>>>>
>>>>>>>>>> what is the initial value of pollText in your backing bean? If it
>>>> is
>>>>>> "",
>>>>>>>>>> you
>>>>>>>>>> should set it to something else, ie. "Processing".
>>>>>>>>>>
>>>>>>>>>> The outputText inside statusIndicator will only show during the
>>>> time
>>>>>> the
>>>>>>>>>> Ajax request is being made. Once the response is returned, it will
>>>>>>>>>> disappear.
>>>>>>>>>>
>>>>>>>>>> -Richard
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> 2011/3/3 Håkon Sagehaug<ha...@uni.no>
>>>>>>>>>>
>>>>>>>>>> Hi
>>>>>>>>>>>
>>>>>>>>>>> I now have my login page like this
>>>>>>>>>>>
>>>>>>>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>>>>>>>> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
>>>>>>>>>>> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
>>>>>>>>>>> <html xmlns="http://www.w3.org/1999/xhtml"
>>>>>>>>>>> xmlns:f="http://java.sun.com/jsf/core"
>>>>>>>>>>> xmlns:h="http://java.sun.com/jsf/html"
>>>>>>>>>>> xmlns:tr="http://myfaces.apache.org/trinidad">
>>>>>>>>>>>
>>>>>>>>>>> <f:view>
>>>>>>>>>>> <tr:document title="eSysbio-myFaces-Trinidad">
>>>>>>>>>>>
>>>>>>>>>>>    <tr:panelPage>
>>>>>>>>>>>        <f:facet name="infoStatus">
>>>>>>>>>>>            <tr:legend name="required" />
>>>>>>>>>>>        </f:facet>
>>>>>>>>>>>        <tr:form>
>>>>>>>>>>>            <h:panelGrid colums="2">
>>>>>>>>>>>                <tr:outputLabel value="Username" />
>>>>>>>>>>>                <tr:inputText id="username"
>>>>>>>>>>> value="#{helloWorldBacking.username}"
>>>>>>>>>>>                    required="true" />
>>>>>>>>>>>                <tr:outputLabel value="Password" />
>>>>>>>>>>>                <tr:inputText id="password"
>>>>>>>>>>> value="#{helloWorldBacking.password}"
>>>>>>>>>>>                    required="true" secret="true" />
>>>>>>>>>>>
>>>>>>>>>>>            </h:panelGrid>
>>>>>>>>>>>            <tr:commandButton id="loginButton" text="Login"
>>>>>>>>>>> partialSubmit="true"
>>>>>>>>>>>                actionListener="#{helloWorldBacking.send}" />
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>            <!--
>>>>>>>>>>>            <tr:statusIndicator>
>>>>>>>>>>>                <tr:outputText
>>>>> value="#{helloWorldBacking.pollText}"
>>>>>>>>>>> />
>>>>>>>>>>>            </tr:statusIndicator>
>>>>>>>>>>>             -->
>>>>>>>>>>>            <tr:outputText value="#{helloWorldBacking.pollText}"
>>>>>>>>>>>                partialTriggers="loginButton" />
>>>>>>>>>>>        </tr:form>
>>>>>>>>>>>    </tr:panelPage>
>>>>>>>>>>>
>>>>>>>>>>> </tr:document>
>>>>>>>>>>> </f:view>
>>>>>>>>>>> </html>
>>>>>>>>>>>
>>>>>>>>>>> But then I got nothing in the outPutText field. Any other
>>>> hint/tips
>>>>>> or
>>>>>>>>>>> tricks. I really appreciate the help
>>>>>>>>>>>
>>>>>>>>>>> Cheers, Håkon
>>>>>>>>>>>
>>>>>>>>>>> On 3 March 2011 17:25, Scott O'Bryan<da...@gmail.com>
>>>> wrote:
>>>>>>>>>>>
>>>>>>>>>>> That doesn't seem to make any sense to me Richard.  The poll
>>>>>> component
>>>>>>>>>>>> does not replace statusIndicator, they simply do two different
>>>>>> things.
>>>>>>>>>>>> The purpose of the poll component is to initiate a request based
>>>>> on
>>>>>> a
>>>>>>>>>>>> clock instead of a user click.  You still need some way to
>>>> display
>>>>>> the
>>>>>>>>>>>> information..
>>>>>>>>>>>>
>>>>>>>>>>>> Hakon,
>>>>>>>>>>>>
>>>>>>>>>>>> The partial trigger in this case should be on the output text
>>>>>> although
>>>>>>>>>>>> having it on the status indicator should also work (you'll just
>>>>> get
>>>>>> a
>>>>>>>>>>>> larger payload).
>>>>>>>>>>>>
>>>>>>>>>>>> Try this.  Remove the status indicator and only have the output
>>>>>> text.
>>>>>>>>>>>> Make sure your outputText is located inside the form (possible
>>>>> your
>>>>>>>>>>>> getting a scoping issue).
>>>>>>>>>>>>
>>>>>>>>>>>> Does that work?  It should.
>>>>>>>>>>>>
>>>>>>>>>>>> On Mar 3, 2011, at 9:06 AM, Richard Yee<richard.k.yee@gmail.com
>>>>>
>>>>>>>>>>>> wrote:
>>>>>>>>>>>>
>>>>>>>>>>>> You don't want statusIndicator, use tr:poll instead
>>>>>>>>>>>>>
>>>>>>>>>>>>> Richard
>>>>>>>>>>>>>
>>>>>>>>>>>>> Sent from my iPhone
>>>>>>>>>>>>>
>>>>>>>>>>>>> On Mar 3, 2011, at 7:48 AM, Håkon Sagehaug<
>>>> hakon.sagehaug@uni.no
>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>> wrote:
>>>>>>>>>>>>
>>>>>>>>>>>>> Hi
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Yes, that was an old cut and past mistake, I've got
>>>> loginButton
>>>>> as
>>>>>> id
>>>>>>>>>>>>>>
>>>>>>>>>>>>> for
>>>>>>>>>>>>
>>>>>>>>>>>>> the button. The latest test are with loginButton, not button2.
>>>> So
>>>>>> this
>>>>>>>>>>>>>>
>>>>>>>>>>>>> way
>>>>>>>>>>>>
>>>>>>>>>>>>> of doing it should normally work?
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> cheers, Håkon
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> On 3 March 2011 16:35, Scott O'Bryan<da...@gmail.com>
>>>>> wrote:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Umm.  Considering the id of your button is button2, I'm not
>>>> sure
>>>>>> why
>>>>>>>>>>>>>>> your partialTrigger is loginButton.  Can you explain?
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> On Mar 3, 2011, at 6:46 AM, "Håkon Sagehaug"<
>>>>>> hakon.sagehaug@uni.no>
>>>>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Hi all,
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> I might not get the full point here ;). Here is what I
>>>> tried,
>>>>>> put
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> trigger
>>>>>>>>>>>>
>>>>>>>>>>>>> on
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> the statusIndicator like here
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> <tr:statusIndicator partialTriggers="loginButton">
>>>>>>>>>>>>>>>>              <f:facet name="busy">
>>>>>>>>>>>>>>>>                  <tr:outputText
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> value="#{helloWorldBacking.pollText}"
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> />
>>>>>>>>>>>>>>>>              </f:facet>
>>>>>>>>>>>>>>>>          </tr:statusIndicator>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> And on the outputText like here
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> <tr:statusIndicator partialTriggers="loginButton">
>>>>>>>>>>>>>>>>              <f:facet name="busy">
>>>>>>>>>>>>>>>>                  <tr:outputText
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> value="#{helloWorldBacking.pollText}"
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> partialTriggers="loginButton"/>
>>>>>>>>>>>>>>>>              </f:facet>
>>>>>>>>>>>>>>>>          </tr:statusIndicator>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Where loginButton is
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> <tr:commandButton id="button2" text="Login"
>>>>>> partialSubmit="true"/>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> But nothing seems to have the wanted effect. I looks like it
>>>>>> picks
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> up
>>>>>>>>>>>
>>>>>>>>>>>> the
>>>>>>>>>>>>
>>>>>>>>>>>>> initial value for the helloWorldBacking.pollText, but when this
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> value
>>>>>>>>>>>
>>>>>>>>>>>> changes it's it not propagated in the UI. Maybe this can't be
>>>> done
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> like
>>>>>>>>>>>>
>>>>>>>>>>>>> I've
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> sketched out. The backing code is the same as sent in a
>>>>> earlier
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> email.
>>>>>>>>>>>
>>>>>>>>>>>> Other tips?
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Cheers, Håkon
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> On 3 March 2011 05:23, Richard Yee<ri...@gmail.com>
>>>>>> wrote:
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Try putting it inside the tr:form or inside your panelPage
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> -Richard
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> 2011/3/1 Håkon Sagehaug<ha...@uni.no>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> Hi
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> Thanks for the reply, here is my xhtml, with a simple
>>>> login
>>>>>> form
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> <tr:document title="Login Demo">
>>>>>>>>>>>>>>>>>> <tr:statusIndicator>
>>>>>>>>>>>>>>>>>>     <f:facet name="busy">
>>>>>>>>>>>>>>>>>>         <tr:outputText
>>>>> value="#{helloWorldBacking.pollText}"
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> />
>>>>>>>>>>>
>>>>>>>>>>>>     </f:facet>
>>>>>>>>>>>>>>>>>> </tr:statusIndicator>
>>>>>>>>>>>>>>>>>> <tr:form>
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>     <tr:panelPage>
>>>>>>>>>>>>>>>>>>         <f:facet name="infoStatus">
>>>>>>>>>>>>>>>>>>             <tr:legend name="required" />
>>>>>>>>>>>>>>>>>>         </f:facet>
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>         <tr:inputText label="Username" id="username"
>>>>>>>>>>>>>>>>>>             value="#{helloWorldBacking.username}"
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> required="true"
>>>>>>>>>>>>
>>>>>>>>>>>>> />
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>         <tr:inputText label="Password" id="password"
>>>>>>>>>>>>>>>>>>             value="#{helloWorldBacking.password}"
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> required="true"
>>>>>>>>>>>>
>>>>>>>>>>>>> secret="true" />
>>>>>>>>>>>>>>>>>>         <tr:commandButton id="button2" text="Login"
>>>>>>>>>>>>>>>>>> partialSubmit="true"
>>>>>>>>>>>>>>>>>>             action="#{helloWorldBacking.send}" />
>>>>>>>>>>>>>>>>>>     </tr:panelPage>
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> </tr:form>
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> </tr:document>
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> And parts of the backing bean
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> public String send() {
>>>>>>>>>>>>>>>>>> FacesContext facesContext =
>>>>>> FacesContext.getCurrentInstance();
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> System.out.println("user name " + username + " is logged
>>>>> in
>>>>>> "
>>>>>>>>>>>>>>>>>>         + userLoggedIn);
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> try {
>>>>>>>>>>>>>>>>>>     Thread.sleep(5000);
>>>>>>>>>>>>>>>>>>     Token tok = tokenMgr.getToken(username, password,
>>>>> true);
>>>>>>>>>>>>>>>>>>    Thread.sleep(2000);
>>>>>>>>>>>>>>>>>>     pollText = "Token fetched";
>>>>>>>>>>>>>>>>>>     if (tok != null) {
>>>>>>>>>>>>>>>>>>         userLoggedIn = true;
>>>>>>>>>>>>>>>>>>         return ("success");
>>>>>>>>>>>>>>>>>>     }
>>>>>>>>>>>>>>>>>>     username = "";
>>>>>>>>>>>>>>>>>>     password = "";
>>>>>>>>>>>>>>>>>> } catch (TrustException e1) {
>>>>>>>>>>>>>>>>>>     e1.printStackTrace();
>>>>>>>>>>>>>>>>>> } catch (AxisFault e) {
>>>>>>>>>>>>>>>>>>     e.printStackTrace();
>>>>>>>>>>>>>>>>>> } catch (FileNotFoundException e) {
>>>>>>>>>>>>>>>>>>     e.printStackTrace();
>>>>>>>>>>>>>>>>>> } catch (XMLStreamException e) {
>>>>>>>>>>>>>>>>>>     e.printStackTrace();
>>>>>>>>>>>>>>>>>> } catch (InterruptedException e) {
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>     e.printStackTrace();
>>>>>>>>>>>>>>>>>> }
>>>>>>>>>>>>>>>>>> FacesMessage message = new FacesMessage("Login failed");
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> facesContext.addMessage("username", message);
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> username = "";
>>>>>>>>>>>>>>>>>> password = "";
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> return ("error");
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> }
>>>>>>>>>>>>>>>>>> As you can see I sleep the thread to simulate the
>>>> operations
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> needed
>>>>>>>>>>>
>>>>>>>>>>>> to
>>>>>>>>>>>>
>>>>>>>>>>>>> log
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> in the user, for now I'm only getting the token. After
>>>> that
>>>>>> I'll
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> fetch
>>>>>>>>>>>>
>>>>>>>>>>>>> the
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> project, data etc...
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> So I wanted the pollText to apear  dynmically in the
>>>> status
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> indicator,
>>>>>>>>>>>>
>>>>>>>>>>>>> but
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> can get it to update,.
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> Any tips?
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> cheers, Håkon
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> On 1 March 2011 23:23, Scott O'Bryan<da...@gmail.com>
>>>>>> wrote:
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> I see no reason why this wouldn't work..  What
>>>> specifically
>>>>> is
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> failing
>>>>>>>>>>>>
>>>>>>>>>>>>> for you and perhaps a code snipi might help me visualize your
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> issue.
>>>>>>>>>>>>
>>>>>>>>>>>>> On Mar 1, 2011, at 3:04 PM, "Håkon Sagehaug"<
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> hakon.sagehaug@uni.no>
>>>>>>>>>>>>
>>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> Hi all,
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> I've just stared using Trinidad and myFaces, and had a
>>>>>> question.
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> I'm
>>>>>>>>>>>>
>>>>>>>>>>>>> implementing a login in page for uses, and wanted to use the
>>>>>>>>>>>>>>>>>>>> statusIndicator, to give back messages for the user like
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> 1. Got user information
>>>>>>>>>>>>>>>>>>>> 2. Loading datasets
>>>>>>>>>>>>>>>>>>>> 3. Logged in
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> And tried to have a  tr:outputText within the
>>>>>> statusIndicator.
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> The
>>>>>>>>>>>
>>>>>>>>>>>> value
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> for
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> the outPuttext would be linked to a backing bean, but I
>>>>> was
>>>>>> not
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> very
>>>>>>>>>>>>
>>>>>>>>>>>>> successful, do you have any other tips?
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> I guess one can use the progressIndicator, but I would
>>>>> like
>>>>>> text
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> to
>>>>>>>>>>>>
>>>>>>>>>>>>> be
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> returned not a procentage progress.
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> cheers, Håkon
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>
>>>>>>
>>>>>
>>>>
>>

Re: Using statusIndicator

Posted by Håkon Sagehaug <ha...@uni.no>.
Yes I guess we've seen this. So we just have to figure out how to ask from
the client side each time we want something updated e.g. a list of
something. There I guess the poller is what we would use, and turn it off if
we don't need it anymore. BTW is that by setting interval to 0(zero)?

Or any other better ways to ask for updates from a client?

So fare we like myfaces/trinidad, so we will continue trying it out.

Håkon

On 7 March 2011 15:27, Scott O'Bryan <da...@gmail.com> wrote:

> Yeah.  ICEfaces has an interesting model.  Their AJAX is merely a
> synchronization between the client and the DOM stored on the server.
> There are a number of real advantages to the framework and a number of
> disadvantages.
>
> Trinidad is architected on a different principal.  There is a lot of
> work done directly on the client and their is no server-side Dom.  And
> while ServerSide push can be done in Trinidad with some extensions to
> the framework, they have to be expressly enabled on a component by
> commoner basis.
>
> Scott
>
> On Mar 4, 2011, at 8:39 AM, Håkon Sagehaug <ha...@uni.no> wrote:
>
> > Hi,
> >
> > So we're trying to implement  part of a system, already implemented with
> > icefaces using myfaces and Trinidad. We decided to compare alittle.
> Icefaces
> > have Ajax Push, so it makes it "easy" to update clients whenever there
> are
> > things to update. SO when a user logs in, we're calling tree different
> > web-services in the backend code.  In the other application we update
> after
> > each call to one of the web service saying
> >
> > 1. Got security token
> > 2. got user information
> > 3. got dataset etc
> >
> > All these are separate call to our web-services, and it would be nice to
> > update the user about the events. For the login we don't start a new
> thread.
> > Other actions such as adding a dataset, where the user want to fetch one
> or
> > more files from ftp/http we start a new thread on the server.First the
> > thread sends the requets for adding the dataset to the web service, and
> gets
> > back a id. The web service starts a thread for downloading the files,
> when
> > finished sets the dataset status to complete. In the mean time the thread
> on
> > the web server polls the status of the download with the id given to him.
> So
> > when the Web server thread gets complete from the web service, a message
> is
> > given to the user.
> >
> > Did that give an okay overview? Just a dumb question, how to enable the
> > poll, setting a positive poll interval? And again thanks for the patience
> >
> > cheers, Håkon
> >
> >
> > On 4 March 2011 16:07, Richard Yee <ri...@gmail.com> wrote:
> >
> >> enable it on the server as a result of pressing the commandButton. can
> you
> >> answer some of the questions I posed earlier?
> >> If we see the whole picture, then perhaps we can come up with a complete
> >> solution.
> >>
> >> -Richard
> >>
> >> 2011/3/4 Håkon Sagehaug <ha...@uni.no>
> >>
> >>> Hi
> >>>
> >>> Thanks for the tips and holding out this thread.  To kick of the poll
> do
> >> I
> >>> use rendered=true/false, it should have had a enable/disable. Or can I
> >> set
> >>> the interval to 0 or -1.
> >>>
> >>> Cheers, Håkon
> >>>
> >>> On 4 March 2011 14:18, Scott O'Bryan <da...@gmail.com> wrote:
> >>>
> >>>> Yeah, I agree with Richard now that I know your trying to dynamically
> >>>> update it.  The poll components will kick off the AJAX request and
> >>>> your partialTrigger (set to the poll component) will allow the text to
> >>>> change.
> >>>>
> >>>> I would also suggest disabling the poll component when you don't
> >>>> expect any changes (ie. Maybe it doesn't start until the login is
> >>>> submitted and then it turns off after the login successfully
> >>>> completed).
> >>>>
> >>>> Does anyone know of "Streaming Requests" are handled in the next
> >>>> servlet spec?  If so, it would be cool for JSF to
> >>>> Do something with them, allow renderkits like Trinidad to stream
> >>>> updates in a more generic fashion.
> >>>>
> >>>> On Mar 4, 2011, at 5:53 AM, Richard Yee <ri...@gmail.com>
> >> wrote:
> >>>>
> >>>>> Hakon,
> >>>>> See my email from yesterday.  That is why I suggested using the
> >> tr:poll
> >>>> component. How many different status messages will you have? What
> >> period
> >>> of
> >>>> time will the messages be changing? Depending on these answers, the
> >>> tr:poll
> >>>> component or the statusIndicator will work. Can you list the sequence
> >> of
> >>>> events the timing (ie. 2 seconds or 2 minutes later xxx happens on the
> >>>> server.) are you starting a separate thread that eventually updates a
> >>> status
> >>>> message?
> >>>>>
> >>>>> Richard
> >>>>>
> >>>>> Sent from my iPhone
> >>>>>
> >>>>> On Mar 4, 2011, at 1:34 AM, Håkon Sagehaug <ha...@uni.no>
> >>>> wrote:
> >>>>>
> >>>>>> Hi
> >>>>>>
> >>>>>> I put the form in various places, but I could not get the wanted
> >>> effect.
> >>>>>> Just curious, since this is an update of a value on the server side.
> >>> The
> >>>>>> clients somehow needs to know if the value have changed or not.  I
> >>> guess
> >>>>>> this is somewhere referred to as server push. My impression of the
> >>>>>> partialTriggers is that an action is taken on the client side, and
> >>> then
> >>>>>> something is triggered on the client side.
> >>>>>> So in my case the the value form the backing bean id read, but only
> >>> when
> >>>> the
> >>>>>> button is clicked, not the hole "login session". Is this correct? I
> >>>> guess
> >>>>>> what to me sounds correct is to have some sort of value change
> >>> listener
> >>>> on
> >>>>>> the value for the output text, but I guess that's more for input
> >> text
> >>>> etc
> >>>>>>
> >>>>>> Did this make sense?
> >>>>>>
> >>>>>> Cheers, Håkon
> >>>>>>
> >>>>>>
> >>>>>> On 3 March 2011 18:18, Scott O'Bryan <da...@gmail.com> wrote:
> >>>>>>
> >>>>>>> Hakkon, put the form around everything and see if it changes the
> >> PPR
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>> On 03/03/2011 10:00 AM, Richard Yee wrote:
> >>>>>>>
> >>>>>>>> what is the initial value of pollText in your backing bean? If it
> >> is
> >>>> "",
> >>>>>>>> you
> >>>>>>>> should set it to something else, ie. "Processing".
> >>>>>>>>
> >>>>>>>> The outputText inside statusIndicator will only show during the
> >> time
> >>>> the
> >>>>>>>> Ajax request is being made. Once the response is returned, it will
> >>>>>>>> disappear.
> >>>>>>>>
> >>>>>>>> -Richard
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>> 2011/3/3 Håkon Sagehaug<ha...@uni.no>
> >>>>>>>>
> >>>>>>>> Hi
> >>>>>>>>>
> >>>>>>>>> I now have my login page like this
> >>>>>>>>>
> >>>>>>>>> <?xml version="1.0" encoding="UTF-8"?>
> >>>>>>>>> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> >>>>>>>>> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> >>>>>>>>> <html xmlns="http://www.w3.org/1999/xhtml"
> >>>>>>>>> xmlns:f="http://java.sun.com/jsf/core"
> >>>>>>>>> xmlns:h="http://java.sun.com/jsf/html"
> >>>>>>>>> xmlns:tr="http://myfaces.apache.org/trinidad">
> >>>>>>>>>
> >>>>>>>>> <f:view>
> >>>>>>>>> <tr:document title="eSysbio-myFaces-Trinidad">
> >>>>>>>>>
> >>>>>>>>>     <tr:panelPage>
> >>>>>>>>>         <f:facet name="infoStatus">
> >>>>>>>>>             <tr:legend name="required" />
> >>>>>>>>>         </f:facet>
> >>>>>>>>>         <tr:form>
> >>>>>>>>>             <h:panelGrid colums="2">
> >>>>>>>>>                 <tr:outputLabel value="Username" />
> >>>>>>>>>                 <tr:inputText id="username"
> >>>>>>>>> value="#{helloWorldBacking.username}"
> >>>>>>>>>                     required="true" />
> >>>>>>>>>                 <tr:outputLabel value="Password" />
> >>>>>>>>>                 <tr:inputText id="password"
> >>>>>>>>> value="#{helloWorldBacking.password}"
> >>>>>>>>>                     required="true" secret="true" />
> >>>>>>>>>
> >>>>>>>>>             </h:panelGrid>
> >>>>>>>>>             <tr:commandButton id="loginButton" text="Login"
> >>>>>>>>> partialSubmit="true"
> >>>>>>>>>                 actionListener="#{helloWorldBacking.send}" />
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>             <!--
> >>>>>>>>>             <tr:statusIndicator>
> >>>>>>>>>                 <tr:outputText
> >>> value="#{helloWorldBacking.pollText}"
> >>>>>>>>> />
> >>>>>>>>>             </tr:statusIndicator>
> >>>>>>>>>              -->
> >>>>>>>>>             <tr:outputText value="#{helloWorldBacking.pollText}"
> >>>>>>>>>                 partialTriggers="loginButton" />
> >>>>>>>>>         </tr:form>
> >>>>>>>>>     </tr:panelPage>
> >>>>>>>>>
> >>>>>>>>> </tr:document>
> >>>>>>>>> </f:view>
> >>>>>>>>> </html>
> >>>>>>>>>
> >>>>>>>>> But then I got nothing in the outPutText field. Any other
> >> hint/tips
> >>>> or
> >>>>>>>>> tricks. I really appreciate the help
> >>>>>>>>>
> >>>>>>>>> Cheers, Håkon
> >>>>>>>>>
> >>>>>>>>> On 3 March 2011 17:25, Scott O'Bryan<da...@gmail.com>
> >> wrote:
> >>>>>>>>>
> >>>>>>>>> That doesn't seem to make any sense to me Richard.  The poll
> >>>> component
> >>>>>>>>>> does not replace statusIndicator, they simply do two different
> >>>> things.
> >>>>>>>>>> The purpose of the poll component is to initiate a request based
> >>> on
> >>>> a
> >>>>>>>>>> clock instead of a user click.  You still need some way to
> >> display
> >>>> the
> >>>>>>>>>> information..
> >>>>>>>>>>
> >>>>>>>>>> Hakon,
> >>>>>>>>>>
> >>>>>>>>>> The partial trigger in this case should be on the output text
> >>>> although
> >>>>>>>>>> having it on the status indicator should also work (you'll just
> >>> get
> >>>> a
> >>>>>>>>>> larger payload).
> >>>>>>>>>>
> >>>>>>>>>> Try this.  Remove the status indicator and only have the output
> >>>> text.
> >>>>>>>>>> Make sure your outputText is located inside the form (possible
> >>> your
> >>>>>>>>>> getting a scoping issue).
> >>>>>>>>>>
> >>>>>>>>>> Does that work?  It should.
> >>>>>>>>>>
> >>>>>>>>>> On Mar 3, 2011, at 9:06 AM, Richard Yee<richard.k.yee@gmail.com
> >>>
> >>>>>>>>>> wrote:
> >>>>>>>>>>
> >>>>>>>>>> You don't want statusIndicator, use tr:poll instead
> >>>>>>>>>>>
> >>>>>>>>>>> Richard
> >>>>>>>>>>>
> >>>>>>>>>>> Sent from my iPhone
> >>>>>>>>>>>
> >>>>>>>>>>> On Mar 3, 2011, at 7:48 AM, Håkon Sagehaug<
> >> hakon.sagehaug@uni.no
> >>>>
> >>>>>>>>>>>
> >>>>>>>>>> wrote:
> >>>>>>>>>>
> >>>>>>>>>>> Hi
> >>>>>>>>>>>>
> >>>>>>>>>>>> Yes, that was an old cut and past mistake, I've got
> >> loginButton
> >>> as
> >>>> id
> >>>>>>>>>>>>
> >>>>>>>>>>> for
> >>>>>>>>>>
> >>>>>>>>>>> the button. The latest test are with loginButton, not button2.
> >> So
> >>>> this
> >>>>>>>>>>>>
> >>>>>>>>>>> way
> >>>>>>>>>>
> >>>>>>>>>>> of doing it should normally work?
> >>>>>>>>>>>>
> >>>>>>>>>>>> cheers, Håkon
> >>>>>>>>>>>>
> >>>>>>>>>>>> On 3 March 2011 16:35, Scott O'Bryan<da...@gmail.com>
> >>> wrote:
> >>>>>>>>>>>>
> >>>>>>>>>>>> Umm.  Considering the id of your button is button2, I'm not
> >> sure
> >>>> why
> >>>>>>>>>>>>> your partialTrigger is loginButton.  Can you explain?
> >>>>>>>>>>>>>
> >>>>>>>>>>>>> On Mar 3, 2011, at 6:46 AM, "Håkon Sagehaug"<
> >>>> hakon.sagehaug@uni.no>
> >>>>>>>>>>>>> wrote:
> >>>>>>>>>>>>>
> >>>>>>>>>>>>> Hi all,
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> I might not get the full point here ;). Here is what I
> >> tried,
> >>>> put
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>> trigger
> >>>>>>>>>>
> >>>>>>>>>>> on
> >>>>>>>>>>>>>
> >>>>>>>>>>>>>> the statusIndicator like here
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> <tr:statusIndicator partialTriggers="loginButton">
> >>>>>>>>>>>>>>               <f:facet name="busy">
> >>>>>>>>>>>>>>                   <tr:outputText
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>> value="#{helloWorldBacking.pollText}"
> >>>>>>>>>>>>>
> >>>>>>>>>>>>>> />
> >>>>>>>>>>>>>>               </f:facet>
> >>>>>>>>>>>>>>           </tr:statusIndicator>
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> And on the outputText like here
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> <tr:statusIndicator partialTriggers="loginButton">
> >>>>>>>>>>>>>>               <f:facet name="busy">
> >>>>>>>>>>>>>>                   <tr:outputText
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>> value="#{helloWorldBacking.pollText}"
> >>>>>>>>>>>>>
> >>>>>>>>>>>>>> partialTriggers="loginButton"/>
> >>>>>>>>>>>>>>               </f:facet>
> >>>>>>>>>>>>>>           </tr:statusIndicator>
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> Where loginButton is
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> <tr:commandButton id="button2" text="Login"
> >>>> partialSubmit="true"/>
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> But nothing seems to have the wanted effect. I looks like it
> >>>> picks
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>> up
> >>>>>>>>>
> >>>>>>>>>> the
> >>>>>>>>>>
> >>>>>>>>>>> initial value for the helloWorldBacking.pollText, but when this
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>> value
> >>>>>>>>>
> >>>>>>>>>> changes it's it not propagated in the UI. Maybe this can't be
> >> done
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>> like
> >>>>>>>>>>
> >>>>>>>>>>> I've
> >>>>>>>>>>>>>
> >>>>>>>>>>>>>> sketched out. The backing code is the same as sent in a
> >>> earlier
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>> email.
> >>>>>>>>>
> >>>>>>>>>> Other tips?
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> Cheers, Håkon
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> On 3 March 2011 05:23, Richard Yee<ri...@gmail.com>
> >>>> wrote:
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> Try putting it inside the tr:form or inside your panelPage
> >>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>> -Richard
> >>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>> 2011/3/1 Håkon Sagehaug<ha...@uni.no>
> >>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>> Hi
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>> Thanks for the reply, here is my xhtml, with a simple
> >> login
> >>>> form
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>> <tr:document title="Login Demo">
> >>>>>>>>>>>>>>>>  <tr:statusIndicator>
> >>>>>>>>>>>>>>>>      <f:facet name="busy">
> >>>>>>>>>>>>>>>>          <tr:outputText
> >>> value="#{helloWorldBacking.pollText}"
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>> />
> >>>>>>>>>
> >>>>>>>>>>      </f:facet>
> >>>>>>>>>>>>>>>>  </tr:statusIndicator>
> >>>>>>>>>>>>>>>>  <tr:form>
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>      <tr:panelPage>
> >>>>>>>>>>>>>>>>          <f:facet name="infoStatus">
> >>>>>>>>>>>>>>>>              <tr:legend name="required" />
> >>>>>>>>>>>>>>>>          </f:facet>
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>          <tr:inputText label="Username" id="username"
> >>>>>>>>>>>>>>>>              value="#{helloWorldBacking.username}"
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>> required="true"
> >>>>>>>>>>
> >>>>>>>>>>> />
> >>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>          <tr:inputText label="Password" id="password"
> >>>>>>>>>>>>>>>>              value="#{helloWorldBacking.password}"
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>> required="true"
> >>>>>>>>>>
> >>>>>>>>>>> secret="true" />
> >>>>>>>>>>>>>>>>          <tr:commandButton id="button2" text="Login"
> >>>>>>>>>>>>>>>> partialSubmit="true"
> >>>>>>>>>>>>>>>>              action="#{helloWorldBacking.send}" />
> >>>>>>>>>>>>>>>>      </tr:panelPage>
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>  </tr:form>
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>> </tr:document>
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>> And parts of the backing bean
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>> public String send() {
> >>>>>>>>>>>>>>>>  FacesContext facesContext =
> >>>> FacesContext.getCurrentInstance();
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>  System.out.println("user name " + username + " is logged
> >>> in
> >>>> "
> >>>>>>>>>>>>>>>>          + userLoggedIn);
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>  try {
> >>>>>>>>>>>>>>>>      Thread.sleep(5000);
> >>>>>>>>>>>>>>>>      Token tok = tokenMgr.getToken(username, password,
> >>> true);
> >>>>>>>>>>>>>>>>     Thread.sleep(2000);
> >>>>>>>>>>>>>>>>      pollText = "Token fetched";
> >>>>>>>>>>>>>>>>      if (tok != null) {
> >>>>>>>>>>>>>>>>          userLoggedIn = true;
> >>>>>>>>>>>>>>>>          return ("success");
> >>>>>>>>>>>>>>>>      }
> >>>>>>>>>>>>>>>>      username = "";
> >>>>>>>>>>>>>>>>      password = "";
> >>>>>>>>>>>>>>>>  } catch (TrustException e1) {
> >>>>>>>>>>>>>>>>      e1.printStackTrace();
> >>>>>>>>>>>>>>>>  } catch (AxisFault e) {
> >>>>>>>>>>>>>>>>      e.printStackTrace();
> >>>>>>>>>>>>>>>>  } catch (FileNotFoundException e) {
> >>>>>>>>>>>>>>>>      e.printStackTrace();
> >>>>>>>>>>>>>>>>  } catch (XMLStreamException e) {
> >>>>>>>>>>>>>>>>      e.printStackTrace();
> >>>>>>>>>>>>>>>>  } catch (InterruptedException e) {
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>      e.printStackTrace();
> >>>>>>>>>>>>>>>>  }
> >>>>>>>>>>>>>>>>  FacesMessage message = new FacesMessage("Login failed");
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>  facesContext.addMessage("username", message);
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>  username = "";
> >>>>>>>>>>>>>>>>  password = "";
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>  return ("error");
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>> }
> >>>>>>>>>>>>>>>> As you can see I sleep the thread to simulate the
> >> operations
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>> needed
> >>>>>>>>>
> >>>>>>>>>> to
> >>>>>>>>>>
> >>>>>>>>>>> log
> >>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>> in the user, for now I'm only getting the token. After
> >> that
> >>>> I'll
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>> fetch
> >>>>>>>>>>
> >>>>>>>>>>> the
> >>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>> project, data etc...
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>> So I wanted the pollText to apear  dynmically in the
> >> status
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>> indicator,
> >>>>>>>>>>
> >>>>>>>>>>> but
> >>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>> can get it to update,.
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>> Any tips?
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>> cheers, Håkon
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>> On 1 March 2011 23:23, Scott O'Bryan<da...@gmail.com>
> >>>> wrote:
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>> I see no reason why this wouldn't work..  What
> >> specifically
> >>> is
> >>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>> failing
> >>>>>>>>>>
> >>>>>>>>>>> for you and perhaps a code snipi might help me visualize your
> >>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>> issue.
> >>>>>>>>>>
> >>>>>>>>>>> On Mar 1, 2011, at 3:04 PM, "Håkon Sagehaug"<
> >>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>> hakon.sagehaug@uni.no>
> >>>>>>>>>>
> >>>>>>>>>>> wrote:
> >>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>> Hi all,
> >>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>> I've just stared using Trinidad and myFaces, and had a
> >>>> question.
> >>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>> I'm
> >>>>>>>>>>
> >>>>>>>>>>> implementing a login in page for uses, and wanted to use the
> >>>>>>>>>>>>>>>>>> statusIndicator, to give back messages for the user like
> >>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>> 1. Got user information
> >>>>>>>>>>>>>>>>>> 2. Loading datasets
> >>>>>>>>>>>>>>>>>> 3. Logged in
> >>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>> And tried to have a  tr:outputText within the
> >>>> statusIndicator.
> >>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>> The
> >>>>>>>>>
> >>>>>>>>>> value
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>> for
> >>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>> the outPuttext would be linked to a backing bean, but I
> >>> was
> >>>> not
> >>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>> very
> >>>>>>>>>>
> >>>>>>>>>>> successful, do you have any other tips?
> >>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>> I guess one can use the progressIndicator, but I would
> >>> like
> >>>> text
> >>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>> to
> >>>>>>>>>>
> >>>>>>>>>>> be
> >>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>> returned not a procentage progress.
> >>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>> cheers, Håkon
> >>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>
> >>>>>>>
> >>>>
> >>>
> >>
>

Re: Using statusIndicator

Posted by Scott O'Bryan <da...@gmail.com>.
Yeah.  ICEfaces has an interesting model.  Their AJAX is merely a
synchronization between the client and the DOM stored on the server.
There are a number of real advantages to the framework and a number of
disadvantages.

Trinidad is architected on a different principal.  There is a lot of
work done directly on the client and their is no server-side Dom.  And
while ServerSide push can be done in Trinidad with some extensions to
the framework, they have to be expressly enabled on a component by
commoner basis.

Scott

On Mar 4, 2011, at 8:39 AM, Håkon Sagehaug <ha...@uni.no> wrote:

> Hi,
>
> So we're trying to implement  part of a system, already implemented with
> icefaces using myfaces and Trinidad. We decided to compare alittle. Icefaces
> have Ajax Push, so it makes it "easy" to update clients whenever there are
> things to update. SO when a user logs in, we're calling tree different
> web-services in the backend code.  In the other application we update after
> each call to one of the web service saying
>
> 1. Got security token
> 2. got user information
> 3. got dataset etc
>
> All these are separate call to our web-services, and it would be nice to
> update the user about the events. For the login we don't start a new thread.
> Other actions such as adding a dataset, where the user want to fetch one or
> more files from ftp/http we start a new thread on the server.First the
> thread sends the requets for adding the dataset to the web service, and gets
> back a id. The web service starts a thread for downloading the files, when
> finished sets the dataset status to complete. In the mean time the thread on
> the web server polls the status of the download with the id given to him. So
> when the Web server thread gets complete from the web service, a message is
> given to the user.
>
> Did that give an okay overview? Just a dumb question, how to enable the
> poll, setting a positive poll interval? And again thanks for the patience
>
> cheers, Håkon
>
>
> On 4 March 2011 16:07, Richard Yee <ri...@gmail.com> wrote:
>
>> enable it on the server as a result of pressing the commandButton. can you
>> answer some of the questions I posed earlier?
>> If we see the whole picture, then perhaps we can come up with a complete
>> solution.
>>
>> -Richard
>>
>> 2011/3/4 Håkon Sagehaug <ha...@uni.no>
>>
>>> Hi
>>>
>>> Thanks for the tips and holding out this thread.  To kick of the poll do
>> I
>>> use rendered=true/false, it should have had a enable/disable. Or can I
>> set
>>> the interval to 0 or -1.
>>>
>>> Cheers, Håkon
>>>
>>> On 4 March 2011 14:18, Scott O'Bryan <da...@gmail.com> wrote:
>>>
>>>> Yeah, I agree with Richard now that I know your trying to dynamically
>>>> update it.  The poll components will kick off the AJAX request and
>>>> your partialTrigger (set to the poll component) will allow the text to
>>>> change.
>>>>
>>>> I would also suggest disabling the poll component when you don't
>>>> expect any changes (ie. Maybe it doesn't start until the login is
>>>> submitted and then it turns off after the login successfully
>>>> completed).
>>>>
>>>> Does anyone know of "Streaming Requests" are handled in the next
>>>> servlet spec?  If so, it would be cool for JSF to
>>>> Do something with them, allow renderkits like Trinidad to stream
>>>> updates in a more generic fashion.
>>>>
>>>> On Mar 4, 2011, at 5:53 AM, Richard Yee <ri...@gmail.com>
>> wrote:
>>>>
>>>>> Hakon,
>>>>> See my email from yesterday.  That is why I suggested using the
>> tr:poll
>>>> component. How many different status messages will you have? What
>> period
>>> of
>>>> time will the messages be changing? Depending on these answers, the
>>> tr:poll
>>>> component or the statusIndicator will work. Can you list the sequence
>> of
>>>> events the timing (ie. 2 seconds or 2 minutes later xxx happens on the
>>>> server.) are you starting a separate thread that eventually updates a
>>> status
>>>> message?
>>>>>
>>>>> Richard
>>>>>
>>>>> Sent from my iPhone
>>>>>
>>>>> On Mar 4, 2011, at 1:34 AM, Håkon Sagehaug <ha...@uni.no>
>>>> wrote:
>>>>>
>>>>>> Hi
>>>>>>
>>>>>> I put the form in various places, but I could not get the wanted
>>> effect.
>>>>>> Just curious, since this is an update of a value on the server side.
>>> The
>>>>>> clients somehow needs to know if the value have changed or not.  I
>>> guess
>>>>>> this is somewhere referred to as server push. My impression of the
>>>>>> partialTriggers is that an action is taken on the client side, and
>>> then
>>>>>> something is triggered on the client side.
>>>>>> So in my case the the value form the backing bean id read, but only
>>> when
>>>> the
>>>>>> button is clicked, not the hole "login session". Is this correct? I
>>>> guess
>>>>>> what to me sounds correct is to have some sort of value change
>>> listener
>>>> on
>>>>>> the value for the output text, but I guess that's more for input
>> text
>>>> etc
>>>>>>
>>>>>> Did this make sense?
>>>>>>
>>>>>> Cheers, Håkon
>>>>>>
>>>>>>
>>>>>> On 3 March 2011 18:18, Scott O'Bryan <da...@gmail.com> wrote:
>>>>>>
>>>>>>> Hakkon, put the form around everything and see if it changes the
>> PPR
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On 03/03/2011 10:00 AM, Richard Yee wrote:
>>>>>>>
>>>>>>>> what is the initial value of pollText in your backing bean? If it
>> is
>>>> "",
>>>>>>>> you
>>>>>>>> should set it to something else, ie. "Processing".
>>>>>>>>
>>>>>>>> The outputText inside statusIndicator will only show during the
>> time
>>>> the
>>>>>>>> Ajax request is being made. Once the response is returned, it will
>>>>>>>> disappear.
>>>>>>>>
>>>>>>>> -Richard
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> 2011/3/3 Håkon Sagehaug<ha...@uni.no>
>>>>>>>>
>>>>>>>> Hi
>>>>>>>>>
>>>>>>>>> I now have my login page like this
>>>>>>>>>
>>>>>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>>>>>> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
>>>>>>>>> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
>>>>>>>>> <html xmlns="http://www.w3.org/1999/xhtml"
>>>>>>>>> xmlns:f="http://java.sun.com/jsf/core"
>>>>>>>>> xmlns:h="http://java.sun.com/jsf/html"
>>>>>>>>> xmlns:tr="http://myfaces.apache.org/trinidad">
>>>>>>>>>
>>>>>>>>> <f:view>
>>>>>>>>> <tr:document title="eSysbio-myFaces-Trinidad">
>>>>>>>>>
>>>>>>>>>     <tr:panelPage>
>>>>>>>>>         <f:facet name="infoStatus">
>>>>>>>>>             <tr:legend name="required" />
>>>>>>>>>         </f:facet>
>>>>>>>>>         <tr:form>
>>>>>>>>>             <h:panelGrid colums="2">
>>>>>>>>>                 <tr:outputLabel value="Username" />
>>>>>>>>>                 <tr:inputText id="username"
>>>>>>>>> value="#{helloWorldBacking.username}"
>>>>>>>>>                     required="true" />
>>>>>>>>>                 <tr:outputLabel value="Password" />
>>>>>>>>>                 <tr:inputText id="password"
>>>>>>>>> value="#{helloWorldBacking.password}"
>>>>>>>>>                     required="true" secret="true" />
>>>>>>>>>
>>>>>>>>>             </h:panelGrid>
>>>>>>>>>             <tr:commandButton id="loginButton" text="Login"
>>>>>>>>> partialSubmit="true"
>>>>>>>>>                 actionListener="#{helloWorldBacking.send}" />
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>             <!--
>>>>>>>>>             <tr:statusIndicator>
>>>>>>>>>                 <tr:outputText
>>> value="#{helloWorldBacking.pollText}"
>>>>>>>>> />
>>>>>>>>>             </tr:statusIndicator>
>>>>>>>>>              -->
>>>>>>>>>             <tr:outputText value="#{helloWorldBacking.pollText}"
>>>>>>>>>                 partialTriggers="loginButton" />
>>>>>>>>>         </tr:form>
>>>>>>>>>     </tr:panelPage>
>>>>>>>>>
>>>>>>>>> </tr:document>
>>>>>>>>> </f:view>
>>>>>>>>> </html>
>>>>>>>>>
>>>>>>>>> But then I got nothing in the outPutText field. Any other
>> hint/tips
>>>> or
>>>>>>>>> tricks. I really appreciate the help
>>>>>>>>>
>>>>>>>>> Cheers, Håkon
>>>>>>>>>
>>>>>>>>> On 3 March 2011 17:25, Scott O'Bryan<da...@gmail.com>
>> wrote:
>>>>>>>>>
>>>>>>>>> That doesn't seem to make any sense to me Richard.  The poll
>>>> component
>>>>>>>>>> does not replace statusIndicator, they simply do two different
>>>> things.
>>>>>>>>>> The purpose of the poll component is to initiate a request based
>>> on
>>>> a
>>>>>>>>>> clock instead of a user click.  You still need some way to
>> display
>>>> the
>>>>>>>>>> information..
>>>>>>>>>>
>>>>>>>>>> Hakon,
>>>>>>>>>>
>>>>>>>>>> The partial trigger in this case should be on the output text
>>>> although
>>>>>>>>>> having it on the status indicator should also work (you'll just
>>> get
>>>> a
>>>>>>>>>> larger payload).
>>>>>>>>>>
>>>>>>>>>> Try this.  Remove the status indicator and only have the output
>>>> text.
>>>>>>>>>> Make sure your outputText is located inside the form (possible
>>> your
>>>>>>>>>> getting a scoping issue).
>>>>>>>>>>
>>>>>>>>>> Does that work?  It should.
>>>>>>>>>>
>>>>>>>>>> On Mar 3, 2011, at 9:06 AM, Richard Yee<richard.k.yee@gmail.com
>>>
>>>>>>>>>> wrote:
>>>>>>>>>>
>>>>>>>>>> You don't want statusIndicator, use tr:poll instead
>>>>>>>>>>>
>>>>>>>>>>> Richard
>>>>>>>>>>>
>>>>>>>>>>> Sent from my iPhone
>>>>>>>>>>>
>>>>>>>>>>> On Mar 3, 2011, at 7:48 AM, Håkon Sagehaug<
>> hakon.sagehaug@uni.no
>>>>
>>>>>>>>>>>
>>>>>>>>>> wrote:
>>>>>>>>>>
>>>>>>>>>>> Hi
>>>>>>>>>>>>
>>>>>>>>>>>> Yes, that was an old cut and past mistake, I've got
>> loginButton
>>> as
>>>> id
>>>>>>>>>>>>
>>>>>>>>>>> for
>>>>>>>>>>
>>>>>>>>>>> the button. The latest test are with loginButton, not button2.
>> So
>>>> this
>>>>>>>>>>>>
>>>>>>>>>>> way
>>>>>>>>>>
>>>>>>>>>>> of doing it should normally work?
>>>>>>>>>>>>
>>>>>>>>>>>> cheers, Håkon
>>>>>>>>>>>>
>>>>>>>>>>>> On 3 March 2011 16:35, Scott O'Bryan<da...@gmail.com>
>>> wrote:
>>>>>>>>>>>>
>>>>>>>>>>>> Umm.  Considering the id of your button is button2, I'm not
>> sure
>>>> why
>>>>>>>>>>>>> your partialTrigger is loginButton.  Can you explain?
>>>>>>>>>>>>>
>>>>>>>>>>>>> On Mar 3, 2011, at 6:46 AM, "Håkon Sagehaug"<
>>>> hakon.sagehaug@uni.no>
>>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>
>>>>>>>>>>>>> Hi all,
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> I might not get the full point here ;). Here is what I
>> tried,
>>>> put
>>>>>>>>>>>>>>
>>>>>>>>>>>>> trigger
>>>>>>>>>>
>>>>>>>>>>> on
>>>>>>>>>>>>>
>>>>>>>>>>>>>> the statusIndicator like here
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> <tr:statusIndicator partialTriggers="loginButton">
>>>>>>>>>>>>>>               <f:facet name="busy">
>>>>>>>>>>>>>>                   <tr:outputText
>>>>>>>>>>>>>>
>>>>>>>>>>>>> value="#{helloWorldBacking.pollText}"
>>>>>>>>>>>>>
>>>>>>>>>>>>>> />
>>>>>>>>>>>>>>               </f:facet>
>>>>>>>>>>>>>>           </tr:statusIndicator>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> And on the outputText like here
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> <tr:statusIndicator partialTriggers="loginButton">
>>>>>>>>>>>>>>               <f:facet name="busy">
>>>>>>>>>>>>>>                   <tr:outputText
>>>>>>>>>>>>>>
>>>>>>>>>>>>> value="#{helloWorldBacking.pollText}"
>>>>>>>>>>>>>
>>>>>>>>>>>>>> partialTriggers="loginButton"/>
>>>>>>>>>>>>>>               </f:facet>
>>>>>>>>>>>>>>           </tr:statusIndicator>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Where loginButton is
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> <tr:commandButton id="button2" text="Login"
>>>> partialSubmit="true"/>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> But nothing seems to have the wanted effect. I looks like it
>>>> picks
>>>>>>>>>>>>>>
>>>>>>>>>>>>> up
>>>>>>>>>
>>>>>>>>>> the
>>>>>>>>>>
>>>>>>>>>>> initial value for the helloWorldBacking.pollText, but when this
>>>>>>>>>>>>>>
>>>>>>>>>>>>> value
>>>>>>>>>
>>>>>>>>>> changes it's it not propagated in the UI. Maybe this can't be
>> done
>>>>>>>>>>>>>>
>>>>>>>>>>>>> like
>>>>>>>>>>
>>>>>>>>>>> I've
>>>>>>>>>>>>>
>>>>>>>>>>>>>> sketched out. The backing code is the same as sent in a
>>> earlier
>>>>>>>>>>>>>>
>>>>>>>>>>>>> email.
>>>>>>>>>
>>>>>>>>>> Other tips?
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Cheers, Håkon
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> On 3 March 2011 05:23, Richard Yee<ri...@gmail.com>
>>>> wrote:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Try putting it inside the tr:form or inside your panelPage
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> -Richard
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> 2011/3/1 Håkon Sagehaug<ha...@uni.no>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Hi
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Thanks for the reply, here is my xhtml, with a simple
>> login
>>>> form
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> <tr:document title="Login Demo">
>>>>>>>>>>>>>>>>  <tr:statusIndicator>
>>>>>>>>>>>>>>>>      <f:facet name="busy">
>>>>>>>>>>>>>>>>          <tr:outputText
>>> value="#{helloWorldBacking.pollText}"
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> />
>>>>>>>>>
>>>>>>>>>>      </f:facet>
>>>>>>>>>>>>>>>>  </tr:statusIndicator>
>>>>>>>>>>>>>>>>  <tr:form>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>      <tr:panelPage>
>>>>>>>>>>>>>>>>          <f:facet name="infoStatus">
>>>>>>>>>>>>>>>>              <tr:legend name="required" />
>>>>>>>>>>>>>>>>          </f:facet>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>          <tr:inputText label="Username" id="username"
>>>>>>>>>>>>>>>>              value="#{helloWorldBacking.username}"
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> required="true"
>>>>>>>>>>
>>>>>>>>>>> />
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>          <tr:inputText label="Password" id="password"
>>>>>>>>>>>>>>>>              value="#{helloWorldBacking.password}"
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> required="true"
>>>>>>>>>>
>>>>>>>>>>> secret="true" />
>>>>>>>>>>>>>>>>          <tr:commandButton id="button2" text="Login"
>>>>>>>>>>>>>>>> partialSubmit="true"
>>>>>>>>>>>>>>>>              action="#{helloWorldBacking.send}" />
>>>>>>>>>>>>>>>>      </tr:panelPage>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>  </tr:form>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> </tr:document>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> And parts of the backing bean
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> public String send() {
>>>>>>>>>>>>>>>>  FacesContext facesContext =
>>>> FacesContext.getCurrentInstance();
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>  System.out.println("user name " + username + " is logged
>>> in
>>>> "
>>>>>>>>>>>>>>>>          + userLoggedIn);
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>  try {
>>>>>>>>>>>>>>>>      Thread.sleep(5000);
>>>>>>>>>>>>>>>>      Token tok = tokenMgr.getToken(username, password,
>>> true);
>>>>>>>>>>>>>>>>     Thread.sleep(2000);
>>>>>>>>>>>>>>>>      pollText = "Token fetched";
>>>>>>>>>>>>>>>>      if (tok != null) {
>>>>>>>>>>>>>>>>          userLoggedIn = true;
>>>>>>>>>>>>>>>>          return ("success");
>>>>>>>>>>>>>>>>      }
>>>>>>>>>>>>>>>>      username = "";
>>>>>>>>>>>>>>>>      password = "";
>>>>>>>>>>>>>>>>  } catch (TrustException e1) {
>>>>>>>>>>>>>>>>      e1.printStackTrace();
>>>>>>>>>>>>>>>>  } catch (AxisFault e) {
>>>>>>>>>>>>>>>>      e.printStackTrace();
>>>>>>>>>>>>>>>>  } catch (FileNotFoundException e) {
>>>>>>>>>>>>>>>>      e.printStackTrace();
>>>>>>>>>>>>>>>>  } catch (XMLStreamException e) {
>>>>>>>>>>>>>>>>      e.printStackTrace();
>>>>>>>>>>>>>>>>  } catch (InterruptedException e) {
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>      e.printStackTrace();
>>>>>>>>>>>>>>>>  }
>>>>>>>>>>>>>>>>  FacesMessage message = new FacesMessage("Login failed");
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>  facesContext.addMessage("username", message);
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>  username = "";
>>>>>>>>>>>>>>>>  password = "";
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>  return ("error");
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> }
>>>>>>>>>>>>>>>> As you can see I sleep the thread to simulate the
>> operations
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> needed
>>>>>>>>>
>>>>>>>>>> to
>>>>>>>>>>
>>>>>>>>>>> log
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> in the user, for now I'm only getting the token. After
>> that
>>>> I'll
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> fetch
>>>>>>>>>>
>>>>>>>>>>> the
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> project, data etc...
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> So I wanted the pollText to apear  dynmically in the
>> status
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> indicator,
>>>>>>>>>>
>>>>>>>>>>> but
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> can get it to update,.
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Any tips?
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> cheers, Håkon
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> On 1 March 2011 23:23, Scott O'Bryan<da...@gmail.com>
>>>> wrote:
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> I see no reason why this wouldn't work..  What
>> specifically
>>> is
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> failing
>>>>>>>>>>
>>>>>>>>>>> for you and perhaps a code snipi might help me visualize your
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> issue.
>>>>>>>>>>
>>>>>>>>>>> On Mar 1, 2011, at 3:04 PM, "Håkon Sagehaug"<
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> hakon.sagehaug@uni.no>
>>>>>>>>>>
>>>>>>>>>>> wrote:
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> Hi all,
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> I've just stared using Trinidad and myFaces, and had a
>>>> question.
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> I'm
>>>>>>>>>>
>>>>>>>>>>> implementing a login in page for uses, and wanted to use the
>>>>>>>>>>>>>>>>>> statusIndicator, to give back messages for the user like
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> 1. Got user information
>>>>>>>>>>>>>>>>>> 2. Loading datasets
>>>>>>>>>>>>>>>>>> 3. Logged in
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> And tried to have a  tr:outputText within the
>>>> statusIndicator.
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> The
>>>>>>>>>
>>>>>>>>>> value
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> for
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> the outPuttext would be linked to a backing bean, but I
>>> was
>>>> not
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> very
>>>>>>>>>>
>>>>>>>>>>> successful, do you have any other tips?
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> I guess one can use the progressIndicator, but I would
>>> like
>>>> text
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> to
>>>>>>>>>>
>>>>>>>>>>> be
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> returned not a procentage progress.
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> cheers, Håkon
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>
>>>>
>>>
>>

Re: Using statusIndicator

Posted by Håkon Sagehaug <ha...@uni.no>.
Hi,

So we're trying to implement  part of a system, already implemented with
icefaces using myfaces and Trinidad. We decided to compare alittle. Icefaces
have Ajax Push, so it makes it "easy" to update clients whenever there are
things to update. SO when a user logs in, we're calling tree different
web-services in the backend code.  In the other application we update after
each call to one of the web service saying

1. Got security token
2. got user information
3. got dataset etc

All these are separate call to our web-services, and it would be nice to
update the user about the events. For the login we don't start a new thread.
Other actions such as adding a dataset, where the user want to fetch one or
more files from ftp/http we start a new thread on the server.First the
thread sends the requets for adding the dataset to the web service, and gets
back a id. The web service starts a thread for downloading the files, when
finished sets the dataset status to complete. In the mean time the thread on
the web server polls the status of the download with the id given to him. So
when the Web server thread gets complete from the web service, a message is
given to the user.

Did that give an okay overview? Just a dumb question, how to enable the
poll, setting a positive poll interval? And again thanks for the patience

cheers, Håkon


On 4 March 2011 16:07, Richard Yee <ri...@gmail.com> wrote:

> enable it on the server as a result of pressing the commandButton. can you
> answer some of the questions I posed earlier?
> If we see the whole picture, then perhaps we can come up with a complete
> solution.
>
> -Richard
>
> 2011/3/4 Håkon Sagehaug <ha...@uni.no>
>
> > Hi
> >
> > Thanks for the tips and holding out this thread.  To kick of the poll do
> I
> > use rendered=true/false, it should have had a enable/disable. Or can I
> set
> > the interval to 0 or -1.
> >
> > Cheers, Håkon
> >
> > On 4 March 2011 14:18, Scott O'Bryan <da...@gmail.com> wrote:
> >
> > > Yeah, I agree with Richard now that I know your trying to dynamically
> > > update it.  The poll components will kick off the AJAX request and
> > > your partialTrigger (set to the poll component) will allow the text to
> > > change.
> > >
> > > I would also suggest disabling the poll component when you don't
> > > expect any changes (ie. Maybe it doesn't start until the login is
> > > submitted and then it turns off after the login successfully
> > > completed).
> > >
> > > Does anyone know of "Streaming Requests" are handled in the next
> > > servlet spec?  If so, it would be cool for JSF to
> > > Do something with them, allow renderkits like Trinidad to stream
> > > updates in a more generic fashion.
> > >
> > > On Mar 4, 2011, at 5:53 AM, Richard Yee <ri...@gmail.com>
> wrote:
> > >
> > > > Hakon,
> > > > See my email from yesterday.  That is why I suggested using the
> tr:poll
> > > component. How many different status messages will you have? What
> period
> > of
> > > time will the messages be changing? Depending on these answers, the
> > tr:poll
> > > component or the statusIndicator will work. Can you list the sequence
> of
> > > events the timing (ie. 2 seconds or 2 minutes later xxx happens on the
> > > server.) are you starting a separate thread that eventually updates a
> > status
> > > message?
> > > >
> > > > Richard
> > > >
> > > > Sent from my iPhone
> > > >
> > > > On Mar 4, 2011, at 1:34 AM, Håkon Sagehaug <ha...@uni.no>
> > > wrote:
> > > >
> > > >> Hi
> > > >>
> > > >> I put the form in various places, but I could not get the wanted
> > effect.
> > > >> Just curious, since this is an update of a value on the server side.
> > The
> > > >> clients somehow needs to know if the value have changed or not.  I
> > guess
> > > >> this is somewhere referred to as server push. My impression of the
> > > >> partialTriggers is that an action is taken on the client side, and
> > then
> > > >> something is triggered on the client side.
> > > >> So in my case the the value form the backing bean id read, but only
> > when
> > > the
> > > >> button is clicked, not the hole "login session". Is this correct? I
> > > guess
> > > >> what to me sounds correct is to have some sort of value change
> > listener
> > > on
> > > >> the value for the output text, but I guess that's more for input
> text
> > > etc
> > > >>
> > > >> Did this make sense?
> > > >>
> > > >> Cheers, Håkon
> > > >>
> > > >>
> > > >> On 3 March 2011 18:18, Scott O'Bryan <da...@gmail.com> wrote:
> > > >>
> > > >>> Hakkon, put the form around everything and see if it changes the
> PPR
> > > >>>
> > > >>>
> > > >>>
> > > >>> On 03/03/2011 10:00 AM, Richard Yee wrote:
> > > >>>
> > > >>>> what is the initial value of pollText in your backing bean? If it
> is
> > > "",
> > > >>>> you
> > > >>>> should set it to something else, ie. "Processing".
> > > >>>>
> > > >>>> The outputText inside statusIndicator will only show during the
> time
> > > the
> > > >>>> Ajax request is being made. Once the response is returned, it will
> > > >>>> disappear.
> > > >>>>
> > > >>>> -Richard
> > > >>>>
> > > >>>>
> > > >>>>
> > > >>>> 2011/3/3 Håkon Sagehaug<ha...@uni.no>
> > > >>>>
> > > >>>> Hi
> > > >>>>>
> > > >>>>> I now have my login page like this
> > > >>>>>
> > > >>>>> <?xml version="1.0" encoding="UTF-8"?>
> > > >>>>> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> > > >>>>> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> > > >>>>> <html xmlns="http://www.w3.org/1999/xhtml"
> > > >>>>>  xmlns:f="http://java.sun.com/jsf/core"
> > > >>>>>  xmlns:h="http://java.sun.com/jsf/html"
> > > >>>>>  xmlns:tr="http://myfaces.apache.org/trinidad">
> > > >>>>>
> > > >>>>> <f:view>
> > > >>>>>  <tr:document title="eSysbio-myFaces-Trinidad">
> > > >>>>>
> > > >>>>>      <tr:panelPage>
> > > >>>>>          <f:facet name="infoStatus">
> > > >>>>>              <tr:legend name="required" />
> > > >>>>>          </f:facet>
> > > >>>>>          <tr:form>
> > > >>>>>              <h:panelGrid colums="2">
> > > >>>>>                  <tr:outputLabel value="Username" />
> > > >>>>>                  <tr:inputText id="username"
> > > >>>>> value="#{helloWorldBacking.username}"
> > > >>>>>                      required="true" />
> > > >>>>>                  <tr:outputLabel value="Password" />
> > > >>>>>                  <tr:inputText id="password"
> > > >>>>> value="#{helloWorldBacking.password}"
> > > >>>>>                      required="true" secret="true" />
> > > >>>>>
> > > >>>>>              </h:panelGrid>
> > > >>>>>              <tr:commandButton id="loginButton" text="Login"
> > > >>>>> partialSubmit="true"
> > > >>>>>                  actionListener="#{helloWorldBacking.send}" />
> > > >>>>>
> > > >>>>>
> > > >>>>>              <!--
> > > >>>>>              <tr:statusIndicator>
> > > >>>>>                  <tr:outputText
> > value="#{helloWorldBacking.pollText}"
> > > >>>>> />
> > > >>>>>              </tr:statusIndicator>
> > > >>>>>               -->
> > > >>>>>              <tr:outputText value="#{helloWorldBacking.pollText}"
> > > >>>>>                  partialTriggers="loginButton" />
> > > >>>>>          </tr:form>
> > > >>>>>      </tr:panelPage>
> > > >>>>>
> > > >>>>>  </tr:document>
> > > >>>>> </f:view>
> > > >>>>> </html>
> > > >>>>>
> > > >>>>> But then I got nothing in the outPutText field. Any other
> hint/tips
> > > or
> > > >>>>> tricks. I really appreciate the help
> > > >>>>>
> > > >>>>> Cheers, Håkon
> > > >>>>>
> > > >>>>> On 3 March 2011 17:25, Scott O'Bryan<da...@gmail.com>
>  wrote:
> > > >>>>>
> > > >>>>> That doesn't seem to make any sense to me Richard.  The poll
> > > component
> > > >>>>>> does not replace statusIndicator, they simply do two different
> > > things.
> > > >>>>>> The purpose of the poll component is to initiate a request based
> > on
> > > a
> > > >>>>>> clock instead of a user click.  You still need some way to
> display
> > > the
> > > >>>>>> information..
> > > >>>>>>
> > > >>>>>> Hakon,
> > > >>>>>>
> > > >>>>>> The partial trigger in this case should be on the output text
> > > although
> > > >>>>>> having it on the status indicator should also work (you'll just
> > get
> > > a
> > > >>>>>> larger payload).
> > > >>>>>>
> > > >>>>>> Try this.  Remove the status indicator and only have the output
> > > text.
> > > >>>>>> Make sure your outputText is located inside the form (possible
> > your
> > > >>>>>> getting a scoping issue).
> > > >>>>>>
> > > >>>>>> Does that work?  It should.
> > > >>>>>>
> > > >>>>>> On Mar 3, 2011, at 9:06 AM, Richard Yee<richard.k.yee@gmail.com
> >
> > > >>>>>> wrote:
> > > >>>>>>
> > > >>>>>> You don't want statusIndicator, use tr:poll instead
> > > >>>>>>>
> > > >>>>>>> Richard
> > > >>>>>>>
> > > >>>>>>> Sent from my iPhone
> > > >>>>>>>
> > > >>>>>>> On Mar 3, 2011, at 7:48 AM, Håkon Sagehaug<
> hakon.sagehaug@uni.no
> > >
> > > >>>>>>>
> > > >>>>>> wrote:
> > > >>>>>>
> > > >>>>>>> Hi
> > > >>>>>>>>
> > > >>>>>>>> Yes, that was an old cut and past mistake, I've got
> loginButton
> > as
> > > id
> > > >>>>>>>>
> > > >>>>>>> for
> > > >>>>>>
> > > >>>>>>> the button. The latest test are with loginButton, not button2.
> So
> > > this
> > > >>>>>>>>
> > > >>>>>>> way
> > > >>>>>>
> > > >>>>>>> of doing it should normally work?
> > > >>>>>>>>
> > > >>>>>>>> cheers, Håkon
> > > >>>>>>>>
> > > >>>>>>>> On 3 March 2011 16:35, Scott O'Bryan<da...@gmail.com>
> >  wrote:
> > > >>>>>>>>
> > > >>>>>>>> Umm.  Considering the id of your button is button2, I'm not
> sure
> > > why
> > > >>>>>>>>> your partialTrigger is loginButton.  Can you explain?
> > > >>>>>>>>>
> > > >>>>>>>>> On Mar 3, 2011, at 6:46 AM, "Håkon Sagehaug"<
> > > hakon.sagehaug@uni.no>
> > > >>>>>>>>> wrote:
> > > >>>>>>>>>
> > > >>>>>>>>> Hi all,
> > > >>>>>>>>>>
> > > >>>>>>>>>> I might not get the full point here ;). Here is what I
> tried,
> > > put
> > > >>>>>>>>>>
> > > >>>>>>>>> trigger
> > > >>>>>>
> > > >>>>>>> on
> > > >>>>>>>>>
> > > >>>>>>>>>> the statusIndicator like here
> > > >>>>>>>>>>
> > > >>>>>>>>>> <tr:statusIndicator partialTriggers="loginButton">
> > > >>>>>>>>>>                <f:facet name="busy">
> > > >>>>>>>>>>                    <tr:outputText
> > > >>>>>>>>>>
> > > >>>>>>>>> value="#{helloWorldBacking.pollText}"
> > > >>>>>>>>>
> > > >>>>>>>>>> />
> > > >>>>>>>>>>                </f:facet>
> > > >>>>>>>>>>            </tr:statusIndicator>
> > > >>>>>>>>>>
> > > >>>>>>>>>> And on the outputText like here
> > > >>>>>>>>>>
> > > >>>>>>>>>> <tr:statusIndicator partialTriggers="loginButton">
> > > >>>>>>>>>>                <f:facet name="busy">
> > > >>>>>>>>>>                    <tr:outputText
> > > >>>>>>>>>>
> > > >>>>>>>>> value="#{helloWorldBacking.pollText}"
> > > >>>>>>>>>
> > > >>>>>>>>>> partialTriggers="loginButton"/>
> > > >>>>>>>>>>                </f:facet>
> > > >>>>>>>>>>            </tr:statusIndicator>
> > > >>>>>>>>>>
> > > >>>>>>>>>> Where loginButton is
> > > >>>>>>>>>>
> > > >>>>>>>>>> <tr:commandButton id="button2" text="Login"
> > > partialSubmit="true"/>
> > > >>>>>>>>>>
> > > >>>>>>>>>> But nothing seems to have the wanted effect. I looks like it
> > > picks
> > > >>>>>>>>>>
> > > >>>>>>>>> up
> > > >>>>>
> > > >>>>>> the
> > > >>>>>>
> > > >>>>>>> initial value for the helloWorldBacking.pollText, but when this
> > > >>>>>>>>>>
> > > >>>>>>>>> value
> > > >>>>>
> > > >>>>>> changes it's it not propagated in the UI. Maybe this can't be
> done
> > > >>>>>>>>>>
> > > >>>>>>>>> like
> > > >>>>>>
> > > >>>>>>> I've
> > > >>>>>>>>>
> > > >>>>>>>>>> sketched out. The backing code is the same as sent in a
> > earlier
> > > >>>>>>>>>>
> > > >>>>>>>>> email.
> > > >>>>>
> > > >>>>>> Other tips?
> > > >>>>>>>>>>
> > > >>>>>>>>>> Cheers, Håkon
> > > >>>>>>>>>>
> > > >>>>>>>>>>
> > > >>>>>>>>>> On 3 March 2011 05:23, Richard Yee<ri...@gmail.com>
> > >  wrote:
> > > >>>>>>>>>>
> > > >>>>>>>>>> Try putting it inside the tr:form or inside your panelPage
> > > >>>>>>>>>>>
> > > >>>>>>>>>>>
> > > >>>>>>>>>>> -Richard
> > > >>>>>>>>>>>
> > > >>>>>>>>>>> 2011/3/1 Håkon Sagehaug<ha...@uni.no>
> > > >>>>>>>>>>>
> > > >>>>>>>>>>> Hi
> > > >>>>>>>>>>>>
> > > >>>>>>>>>>>> Thanks for the reply, here is my xhtml, with a simple
> login
> > > form
> > > >>>>>>>>>>>>
> > > >>>>>>>>>>>> <tr:document title="Login Demo">
> > > >>>>>>>>>>>>   <tr:statusIndicator>
> > > >>>>>>>>>>>>       <f:facet name="busy">
> > > >>>>>>>>>>>>           <tr:outputText
> > value="#{helloWorldBacking.pollText}"
> > > >>>>>>>>>>>>
> > > >>>>>>>>>>> />
> > > >>>>>
> > > >>>>>>       </f:facet>
> > > >>>>>>>>>>>>   </tr:statusIndicator>
> > > >>>>>>>>>>>>   <tr:form>
> > > >>>>>>>>>>>>
> > > >>>>>>>>>>>>       <tr:panelPage>
> > > >>>>>>>>>>>>           <f:facet name="infoStatus">
> > > >>>>>>>>>>>>               <tr:legend name="required" />
> > > >>>>>>>>>>>>           </f:facet>
> > > >>>>>>>>>>>>
> > > >>>>>>>>>>>>           <tr:inputText label="Username" id="username"
> > > >>>>>>>>>>>>               value="#{helloWorldBacking.username}"
> > > >>>>>>>>>>>>
> > > >>>>>>>>>>> required="true"
> > > >>>>>>
> > > >>>>>>> />
> > > >>>>>>>>>>>
> > > >>>>>>>>>>>>           <tr:inputText label="Password" id="password"
> > > >>>>>>>>>>>>               value="#{helloWorldBacking.password}"
> > > >>>>>>>>>>>>
> > > >>>>>>>>>>> required="true"
> > > >>>>>>
> > > >>>>>>> secret="true" />
> > > >>>>>>>>>>>>           <tr:commandButton id="button2" text="Login"
> > > >>>>>>>>>>>> partialSubmit="true"
> > > >>>>>>>>>>>>               action="#{helloWorldBacking.send}" />
> > > >>>>>>>>>>>>       </tr:panelPage>
> > > >>>>>>>>>>>>
> > > >>>>>>>>>>>>   </tr:form>
> > > >>>>>>>>>>>>
> > > >>>>>>>>>>>> </tr:document>
> > > >>>>>>>>>>>>
> > > >>>>>>>>>>>> And parts of the backing bean
> > > >>>>>>>>>>>>
> > > >>>>>>>>>>>> public String send() {
> > > >>>>>>>>>>>>   FacesContext facesContext =
> > > FacesContext.getCurrentInstance();
> > > >>>>>>>>>>>>
> > > >>>>>>>>>>>>   System.out.println("user name " + username + " is logged
> > in
> > > "
> > > >>>>>>>>>>>>           + userLoggedIn);
> > > >>>>>>>>>>>>
> > > >>>>>>>>>>>>   try {
> > > >>>>>>>>>>>>       Thread.sleep(5000);
> > > >>>>>>>>>>>>       Token tok = tokenMgr.getToken(username, password,
> > true);
> > > >>>>>>>>>>>>      Thread.sleep(2000);
> > > >>>>>>>>>>>>       pollText = "Token fetched";
> > > >>>>>>>>>>>>       if (tok != null) {
> > > >>>>>>>>>>>>           userLoggedIn = true;
> > > >>>>>>>>>>>>           return ("success");
> > > >>>>>>>>>>>>       }
> > > >>>>>>>>>>>>       username = "";
> > > >>>>>>>>>>>>       password = "";
> > > >>>>>>>>>>>>   } catch (TrustException e1) {
> > > >>>>>>>>>>>>       e1.printStackTrace();
> > > >>>>>>>>>>>>   } catch (AxisFault e) {
> > > >>>>>>>>>>>>       e.printStackTrace();
> > > >>>>>>>>>>>>   } catch (FileNotFoundException e) {
> > > >>>>>>>>>>>>       e.printStackTrace();
> > > >>>>>>>>>>>>   } catch (XMLStreamException e) {
> > > >>>>>>>>>>>>       e.printStackTrace();
> > > >>>>>>>>>>>>   } catch (InterruptedException e) {
> > > >>>>>>>>>>>>
> > > >>>>>>>>>>>>       e.printStackTrace();
> > > >>>>>>>>>>>>   }
> > > >>>>>>>>>>>>   FacesMessage message = new FacesMessage("Login failed");
> > > >>>>>>>>>>>>
> > > >>>>>>>>>>>>   facesContext.addMessage("username", message);
> > > >>>>>>>>>>>>
> > > >>>>>>>>>>>>   username = "";
> > > >>>>>>>>>>>>   password = "";
> > > >>>>>>>>>>>>
> > > >>>>>>>>>>>>   return ("error");
> > > >>>>>>>>>>>>
> > > >>>>>>>>>>>> }
> > > >>>>>>>>>>>> As you can see I sleep the thread to simulate the
> operations
> > > >>>>>>>>>>>>
> > > >>>>>>>>>>> needed
> > > >>>>>
> > > >>>>>> to
> > > >>>>>>
> > > >>>>>>> log
> > > >>>>>>>>>>>
> > > >>>>>>>>>>>> in the user, for now I'm only getting the token. After
> that
> > > I'll
> > > >>>>>>>>>>>>
> > > >>>>>>>>>>> fetch
> > > >>>>>>
> > > >>>>>>> the
> > > >>>>>>>>>>>
> > > >>>>>>>>>>>> project, data etc...
> > > >>>>>>>>>>>>
> > > >>>>>>>>>>>> So I wanted the pollText to apear  dynmically in the
> status
> > > >>>>>>>>>>>>
> > > >>>>>>>>>>> indicator,
> > > >>>>>>
> > > >>>>>>> but
> > > >>>>>>>>>>>
> > > >>>>>>>>>>>> can get it to update,.
> > > >>>>>>>>>>>>
> > > >>>>>>>>>>>> Any tips?
> > > >>>>>>>>>>>>
> > > >>>>>>>>>>>> cheers, Håkon
> > > >>>>>>>>>>>>
> > > >>>>>>>>>>>> On 1 March 2011 23:23, Scott O'Bryan<da...@gmail.com>
> > >  wrote:
> > > >>>>>>>>>>>>
> > > >>>>>>>>>>>> I see no reason why this wouldn't work..  What
> specifically
> > is
> > > >>>>>>>>>>>>>
> > > >>>>>>>>>>>> failing
> > > >>>>>>
> > > >>>>>>> for you and perhaps a code snipi might help me visualize your
> > > >>>>>>>>>>>>>
> > > >>>>>>>>>>>> issue.
> > > >>>>>>
> > > >>>>>>> On Mar 1, 2011, at 3:04 PM, "Håkon Sagehaug"<
> > > >>>>>>>>>>>>>
> > > >>>>>>>>>>>> hakon.sagehaug@uni.no>
> > > >>>>>>
> > > >>>>>>> wrote:
> > > >>>>>>>>>>>>>
> > > >>>>>>>>>>>>> Hi all,
> > > >>>>>>>>>>>>>>
> > > >>>>>>>>>>>>>> I've just stared using Trinidad and myFaces, and had a
> > > question.
> > > >>>>>>>>>>>>>>
> > > >>>>>>>>>>>>> I'm
> > > >>>>>>
> > > >>>>>>> implementing a login in page for uses, and wanted to use the
> > > >>>>>>>>>>>>>> statusIndicator, to give back messages for the user like
> > > >>>>>>>>>>>>>>
> > > >>>>>>>>>>>>>> 1. Got user information
> > > >>>>>>>>>>>>>> 2. Loading datasets
> > > >>>>>>>>>>>>>> 3. Logged in
> > > >>>>>>>>>>>>>>
> > > >>>>>>>>>>>>>> And tried to have a  tr:outputText within the
> > > statusIndicator.
> > > >>>>>>>>>>>>>>
> > > >>>>>>>>>>>>> The
> > > >>>>>
> > > >>>>>> value
> > > >>>>>>>>>>>>
> > > >>>>>>>>>>>>> for
> > > >>>>>>>>>>>>>
> > > >>>>>>>>>>>>>> the outPuttext would be linked to a backing bean, but I
> > was
> > > not
> > > >>>>>>>>>>>>>>
> > > >>>>>>>>>>>>> very
> > > >>>>>>
> > > >>>>>>> successful, do you have any other tips?
> > > >>>>>>>>>>>>>>
> > > >>>>>>>>>>>>>> I guess one can use the progressIndicator, but I would
> > like
> > > text
> > > >>>>>>>>>>>>>>
> > > >>>>>>>>>>>>> to
> > > >>>>>>
> > > >>>>>>> be
> > > >>>>>>>>>>>
> > > >>>>>>>>>>>> returned not a procentage progress.
> > > >>>>>>>>>>>>>>
> > > >>>>>>>>>>>>>> cheers, Håkon
> > > >>>>>>>>>>>>>>
> > > >>>>>>>>>>>>>
> > > >>>
> > >
> >
>

Re: Using statusIndicator

Posted by Richard Yee <ri...@gmail.com>.
enable it on the server as a result of pressing the commandButton. can you
answer some of the questions I posed earlier?
If we see the whole picture, then perhaps we can come up with a complete
solution.

-Richard

2011/3/4 Håkon Sagehaug <ha...@uni.no>

> Hi
>
> Thanks for the tips and holding out this thread.  To kick of the poll do I
> use rendered=true/false, it should have had a enable/disable. Or can I set
> the interval to 0 or -1.
>
> Cheers, Håkon
>
> On 4 March 2011 14:18, Scott O'Bryan <da...@gmail.com> wrote:
>
> > Yeah, I agree with Richard now that I know your trying to dynamically
> > update it.  The poll components will kick off the AJAX request and
> > your partialTrigger (set to the poll component) will allow the text to
> > change.
> >
> > I would also suggest disabling the poll component when you don't
> > expect any changes (ie. Maybe it doesn't start until the login is
> > submitted and then it turns off after the login successfully
> > completed).
> >
> > Does anyone know of "Streaming Requests" are handled in the next
> > servlet spec?  If so, it would be cool for JSF to
> > Do something with them, allow renderkits like Trinidad to stream
> > updates in a more generic fashion.
> >
> > On Mar 4, 2011, at 5:53 AM, Richard Yee <ri...@gmail.com> wrote:
> >
> > > Hakon,
> > > See my email from yesterday.  That is why I suggested using the tr:poll
> > component. How many different status messages will you have? What period
> of
> > time will the messages be changing? Depending on these answers, the
> tr:poll
> > component or the statusIndicator will work. Can you list the sequence of
> > events the timing (ie. 2 seconds or 2 minutes later xxx happens on the
> > server.) are you starting a separate thread that eventually updates a
> status
> > message?
> > >
> > > Richard
> > >
> > > Sent from my iPhone
> > >
> > > On Mar 4, 2011, at 1:34 AM, Håkon Sagehaug <ha...@uni.no>
> > wrote:
> > >
> > >> Hi
> > >>
> > >> I put the form in various places, but I could not get the wanted
> effect.
> > >> Just curious, since this is an update of a value on the server side.
> The
> > >> clients somehow needs to know if the value have changed or not.  I
> guess
> > >> this is somewhere referred to as server push. My impression of the
> > >> partialTriggers is that an action is taken on the client side, and
> then
> > >> something is triggered on the client side.
> > >> So in my case the the value form the backing bean id read, but only
> when
> > the
> > >> button is clicked, not the hole "login session". Is this correct? I
> > guess
> > >> what to me sounds correct is to have some sort of value change
> listener
> > on
> > >> the value for the output text, but I guess that's more for input text
> > etc
> > >>
> > >> Did this make sense?
> > >>
> > >> Cheers, Håkon
> > >>
> > >>
> > >> On 3 March 2011 18:18, Scott O'Bryan <da...@gmail.com> wrote:
> > >>
> > >>> Hakkon, put the form around everything and see if it changes the PPR
> > >>>
> > >>>
> > >>>
> > >>> On 03/03/2011 10:00 AM, Richard Yee wrote:
> > >>>
> > >>>> what is the initial value of pollText in your backing bean? If it is
> > "",
> > >>>> you
> > >>>> should set it to something else, ie. "Processing".
> > >>>>
> > >>>> The outputText inside statusIndicator will only show during the time
> > the
> > >>>> Ajax request is being made. Once the response is returned, it will
> > >>>> disappear.
> > >>>>
> > >>>> -Richard
> > >>>>
> > >>>>
> > >>>>
> > >>>> 2011/3/3 Håkon Sagehaug<ha...@uni.no>
> > >>>>
> > >>>> Hi
> > >>>>>
> > >>>>> I now have my login page like this
> > >>>>>
> > >>>>> <?xml version="1.0" encoding="UTF-8"?>
> > >>>>> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> > >>>>> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> > >>>>> <html xmlns="http://www.w3.org/1999/xhtml"
> > >>>>>  xmlns:f="http://java.sun.com/jsf/core"
> > >>>>>  xmlns:h="http://java.sun.com/jsf/html"
> > >>>>>  xmlns:tr="http://myfaces.apache.org/trinidad">
> > >>>>>
> > >>>>> <f:view>
> > >>>>>  <tr:document title="eSysbio-myFaces-Trinidad">
> > >>>>>
> > >>>>>      <tr:panelPage>
> > >>>>>          <f:facet name="infoStatus">
> > >>>>>              <tr:legend name="required" />
> > >>>>>          </f:facet>
> > >>>>>          <tr:form>
> > >>>>>              <h:panelGrid colums="2">
> > >>>>>                  <tr:outputLabel value="Username" />
> > >>>>>                  <tr:inputText id="username"
> > >>>>> value="#{helloWorldBacking.username}"
> > >>>>>                      required="true" />
> > >>>>>                  <tr:outputLabel value="Password" />
> > >>>>>                  <tr:inputText id="password"
> > >>>>> value="#{helloWorldBacking.password}"
> > >>>>>                      required="true" secret="true" />
> > >>>>>
> > >>>>>              </h:panelGrid>
> > >>>>>              <tr:commandButton id="loginButton" text="Login"
> > >>>>> partialSubmit="true"
> > >>>>>                  actionListener="#{helloWorldBacking.send}" />
> > >>>>>
> > >>>>>
> > >>>>>              <!--
> > >>>>>              <tr:statusIndicator>
> > >>>>>                  <tr:outputText
> value="#{helloWorldBacking.pollText}"
> > >>>>> />
> > >>>>>              </tr:statusIndicator>
> > >>>>>               -->
> > >>>>>              <tr:outputText value="#{helloWorldBacking.pollText}"
> > >>>>>                  partialTriggers="loginButton" />
> > >>>>>          </tr:form>
> > >>>>>      </tr:panelPage>
> > >>>>>
> > >>>>>  </tr:document>
> > >>>>> </f:view>
> > >>>>> </html>
> > >>>>>
> > >>>>> But then I got nothing in the outPutText field. Any other hint/tips
> > or
> > >>>>> tricks. I really appreciate the help
> > >>>>>
> > >>>>> Cheers, Håkon
> > >>>>>
> > >>>>> On 3 March 2011 17:25, Scott O'Bryan<da...@gmail.com>  wrote:
> > >>>>>
> > >>>>> That doesn't seem to make any sense to me Richard.  The poll
> > component
> > >>>>>> does not replace statusIndicator, they simply do two different
> > things.
> > >>>>>> The purpose of the poll component is to initiate a request based
> on
> > a
> > >>>>>> clock instead of a user click.  You still need some way to display
> > the
> > >>>>>> information..
> > >>>>>>
> > >>>>>> Hakon,
> > >>>>>>
> > >>>>>> The partial trigger in this case should be on the output text
> > although
> > >>>>>> having it on the status indicator should also work (you'll just
> get
> > a
> > >>>>>> larger payload).
> > >>>>>>
> > >>>>>> Try this.  Remove the status indicator and only have the output
> > text.
> > >>>>>> Make sure your outputText is located inside the form (possible
> your
> > >>>>>> getting a scoping issue).
> > >>>>>>
> > >>>>>> Does that work?  It should.
> > >>>>>>
> > >>>>>> On Mar 3, 2011, at 9:06 AM, Richard Yee<ri...@gmail.com>
> > >>>>>> wrote:
> > >>>>>>
> > >>>>>> You don't want statusIndicator, use tr:poll instead
> > >>>>>>>
> > >>>>>>> Richard
> > >>>>>>>
> > >>>>>>> Sent from my iPhone
> > >>>>>>>
> > >>>>>>> On Mar 3, 2011, at 7:48 AM, Håkon Sagehaug<hakon.sagehaug@uni.no
> >
> > >>>>>>>
> > >>>>>> wrote:
> > >>>>>>
> > >>>>>>> Hi
> > >>>>>>>>
> > >>>>>>>> Yes, that was an old cut and past mistake, I've got loginButton
> as
> > id
> > >>>>>>>>
> > >>>>>>> for
> > >>>>>>
> > >>>>>>> the button. The latest test are with loginButton, not button2. So
> > this
> > >>>>>>>>
> > >>>>>>> way
> > >>>>>>
> > >>>>>>> of doing it should normally work?
> > >>>>>>>>
> > >>>>>>>> cheers, Håkon
> > >>>>>>>>
> > >>>>>>>> On 3 March 2011 16:35, Scott O'Bryan<da...@gmail.com>
>  wrote:
> > >>>>>>>>
> > >>>>>>>> Umm.  Considering the id of your button is button2, I'm not sure
> > why
> > >>>>>>>>> your partialTrigger is loginButton.  Can you explain?
> > >>>>>>>>>
> > >>>>>>>>> On Mar 3, 2011, at 6:46 AM, "Håkon Sagehaug"<
> > hakon.sagehaug@uni.no>
> > >>>>>>>>> wrote:
> > >>>>>>>>>
> > >>>>>>>>> Hi all,
> > >>>>>>>>>>
> > >>>>>>>>>> I might not get the full point here ;). Here is what I tried,
> > put
> > >>>>>>>>>>
> > >>>>>>>>> trigger
> > >>>>>>
> > >>>>>>> on
> > >>>>>>>>>
> > >>>>>>>>>> the statusIndicator like here
> > >>>>>>>>>>
> > >>>>>>>>>> <tr:statusIndicator partialTriggers="loginButton">
> > >>>>>>>>>>                <f:facet name="busy">
> > >>>>>>>>>>                    <tr:outputText
> > >>>>>>>>>>
> > >>>>>>>>> value="#{helloWorldBacking.pollText}"
> > >>>>>>>>>
> > >>>>>>>>>> />
> > >>>>>>>>>>                </f:facet>
> > >>>>>>>>>>            </tr:statusIndicator>
> > >>>>>>>>>>
> > >>>>>>>>>> And on the outputText like here
> > >>>>>>>>>>
> > >>>>>>>>>> <tr:statusIndicator partialTriggers="loginButton">
> > >>>>>>>>>>                <f:facet name="busy">
> > >>>>>>>>>>                    <tr:outputText
> > >>>>>>>>>>
> > >>>>>>>>> value="#{helloWorldBacking.pollText}"
> > >>>>>>>>>
> > >>>>>>>>>> partialTriggers="loginButton"/>
> > >>>>>>>>>>                </f:facet>
> > >>>>>>>>>>            </tr:statusIndicator>
> > >>>>>>>>>>
> > >>>>>>>>>> Where loginButton is
> > >>>>>>>>>>
> > >>>>>>>>>> <tr:commandButton id="button2" text="Login"
> > partialSubmit="true"/>
> > >>>>>>>>>>
> > >>>>>>>>>> But nothing seems to have the wanted effect. I looks like it
> > picks
> > >>>>>>>>>>
> > >>>>>>>>> up
> > >>>>>
> > >>>>>> the
> > >>>>>>
> > >>>>>>> initial value for the helloWorldBacking.pollText, but when this
> > >>>>>>>>>>
> > >>>>>>>>> value
> > >>>>>
> > >>>>>> changes it's it not propagated in the UI. Maybe this can't be done
> > >>>>>>>>>>
> > >>>>>>>>> like
> > >>>>>>
> > >>>>>>> I've
> > >>>>>>>>>
> > >>>>>>>>>> sketched out. The backing code is the same as sent in a
> earlier
> > >>>>>>>>>>
> > >>>>>>>>> email.
> > >>>>>
> > >>>>>> Other tips?
> > >>>>>>>>>>
> > >>>>>>>>>> Cheers, Håkon
> > >>>>>>>>>>
> > >>>>>>>>>>
> > >>>>>>>>>> On 3 March 2011 05:23, Richard Yee<ri...@gmail.com>
> >  wrote:
> > >>>>>>>>>>
> > >>>>>>>>>> Try putting it inside the tr:form or inside your panelPage
> > >>>>>>>>>>>
> > >>>>>>>>>>>
> > >>>>>>>>>>> -Richard
> > >>>>>>>>>>>
> > >>>>>>>>>>> 2011/3/1 Håkon Sagehaug<ha...@uni.no>
> > >>>>>>>>>>>
> > >>>>>>>>>>> Hi
> > >>>>>>>>>>>>
> > >>>>>>>>>>>> Thanks for the reply, here is my xhtml, with a simple login
> > form
> > >>>>>>>>>>>>
> > >>>>>>>>>>>> <tr:document title="Login Demo">
> > >>>>>>>>>>>>   <tr:statusIndicator>
> > >>>>>>>>>>>>       <f:facet name="busy">
> > >>>>>>>>>>>>           <tr:outputText
> value="#{helloWorldBacking.pollText}"
> > >>>>>>>>>>>>
> > >>>>>>>>>>> />
> > >>>>>
> > >>>>>>       </f:facet>
> > >>>>>>>>>>>>   </tr:statusIndicator>
> > >>>>>>>>>>>>   <tr:form>
> > >>>>>>>>>>>>
> > >>>>>>>>>>>>       <tr:panelPage>
> > >>>>>>>>>>>>           <f:facet name="infoStatus">
> > >>>>>>>>>>>>               <tr:legend name="required" />
> > >>>>>>>>>>>>           </f:facet>
> > >>>>>>>>>>>>
> > >>>>>>>>>>>>           <tr:inputText label="Username" id="username"
> > >>>>>>>>>>>>               value="#{helloWorldBacking.username}"
> > >>>>>>>>>>>>
> > >>>>>>>>>>> required="true"
> > >>>>>>
> > >>>>>>> />
> > >>>>>>>>>>>
> > >>>>>>>>>>>>           <tr:inputText label="Password" id="password"
> > >>>>>>>>>>>>               value="#{helloWorldBacking.password}"
> > >>>>>>>>>>>>
> > >>>>>>>>>>> required="true"
> > >>>>>>
> > >>>>>>> secret="true" />
> > >>>>>>>>>>>>           <tr:commandButton id="button2" text="Login"
> > >>>>>>>>>>>> partialSubmit="true"
> > >>>>>>>>>>>>               action="#{helloWorldBacking.send}" />
> > >>>>>>>>>>>>       </tr:panelPage>
> > >>>>>>>>>>>>
> > >>>>>>>>>>>>   </tr:form>
> > >>>>>>>>>>>>
> > >>>>>>>>>>>> </tr:document>
> > >>>>>>>>>>>>
> > >>>>>>>>>>>> And parts of the backing bean
> > >>>>>>>>>>>>
> > >>>>>>>>>>>> public String send() {
> > >>>>>>>>>>>>   FacesContext facesContext =
> > FacesContext.getCurrentInstance();
> > >>>>>>>>>>>>
> > >>>>>>>>>>>>   System.out.println("user name " + username + " is logged
> in
> > "
> > >>>>>>>>>>>>           + userLoggedIn);
> > >>>>>>>>>>>>
> > >>>>>>>>>>>>   try {
> > >>>>>>>>>>>>       Thread.sleep(5000);
> > >>>>>>>>>>>>       Token tok = tokenMgr.getToken(username, password,
> true);
> > >>>>>>>>>>>>      Thread.sleep(2000);
> > >>>>>>>>>>>>       pollText = "Token fetched";
> > >>>>>>>>>>>>       if (tok != null) {
> > >>>>>>>>>>>>           userLoggedIn = true;
> > >>>>>>>>>>>>           return ("success");
> > >>>>>>>>>>>>       }
> > >>>>>>>>>>>>       username = "";
> > >>>>>>>>>>>>       password = "";
> > >>>>>>>>>>>>   } catch (TrustException e1) {
> > >>>>>>>>>>>>       e1.printStackTrace();
> > >>>>>>>>>>>>   } catch (AxisFault e) {
> > >>>>>>>>>>>>       e.printStackTrace();
> > >>>>>>>>>>>>   } catch (FileNotFoundException e) {
> > >>>>>>>>>>>>       e.printStackTrace();
> > >>>>>>>>>>>>   } catch (XMLStreamException e) {
> > >>>>>>>>>>>>       e.printStackTrace();
> > >>>>>>>>>>>>   } catch (InterruptedException e) {
> > >>>>>>>>>>>>
> > >>>>>>>>>>>>       e.printStackTrace();
> > >>>>>>>>>>>>   }
> > >>>>>>>>>>>>   FacesMessage message = new FacesMessage("Login failed");
> > >>>>>>>>>>>>
> > >>>>>>>>>>>>   facesContext.addMessage("username", message);
> > >>>>>>>>>>>>
> > >>>>>>>>>>>>   username = "";
> > >>>>>>>>>>>>   password = "";
> > >>>>>>>>>>>>
> > >>>>>>>>>>>>   return ("error");
> > >>>>>>>>>>>>
> > >>>>>>>>>>>> }
> > >>>>>>>>>>>> As you can see I sleep the thread to simulate the operations
> > >>>>>>>>>>>>
> > >>>>>>>>>>> needed
> > >>>>>
> > >>>>>> to
> > >>>>>>
> > >>>>>>> log
> > >>>>>>>>>>>
> > >>>>>>>>>>>> in the user, for now I'm only getting the token. After that
> > I'll
> > >>>>>>>>>>>>
> > >>>>>>>>>>> fetch
> > >>>>>>
> > >>>>>>> the
> > >>>>>>>>>>>
> > >>>>>>>>>>>> project, data etc...
> > >>>>>>>>>>>>
> > >>>>>>>>>>>> So I wanted the pollText to apear  dynmically in the status
> > >>>>>>>>>>>>
> > >>>>>>>>>>> indicator,
> > >>>>>>
> > >>>>>>> but
> > >>>>>>>>>>>
> > >>>>>>>>>>>> can get it to update,.
> > >>>>>>>>>>>>
> > >>>>>>>>>>>> Any tips?
> > >>>>>>>>>>>>
> > >>>>>>>>>>>> cheers, Håkon
> > >>>>>>>>>>>>
> > >>>>>>>>>>>> On 1 March 2011 23:23, Scott O'Bryan<da...@gmail.com>
> >  wrote:
> > >>>>>>>>>>>>
> > >>>>>>>>>>>> I see no reason why this wouldn't work..  What specifically
> is
> > >>>>>>>>>>>>>
> > >>>>>>>>>>>> failing
> > >>>>>>
> > >>>>>>> for you and perhaps a code snipi might help me visualize your
> > >>>>>>>>>>>>>
> > >>>>>>>>>>>> issue.
> > >>>>>>
> > >>>>>>> On Mar 1, 2011, at 3:04 PM, "Håkon Sagehaug"<
> > >>>>>>>>>>>>>
> > >>>>>>>>>>>> hakon.sagehaug@uni.no>
> > >>>>>>
> > >>>>>>> wrote:
> > >>>>>>>>>>>>>
> > >>>>>>>>>>>>> Hi all,
> > >>>>>>>>>>>>>>
> > >>>>>>>>>>>>>> I've just stared using Trinidad and myFaces, and had a
> > question.
> > >>>>>>>>>>>>>>
> > >>>>>>>>>>>>> I'm
> > >>>>>>
> > >>>>>>> implementing a login in page for uses, and wanted to use the
> > >>>>>>>>>>>>>> statusIndicator, to give back messages for the user like
> > >>>>>>>>>>>>>>
> > >>>>>>>>>>>>>> 1. Got user information
> > >>>>>>>>>>>>>> 2. Loading datasets
> > >>>>>>>>>>>>>> 3. Logged in
> > >>>>>>>>>>>>>>
> > >>>>>>>>>>>>>> And tried to have a  tr:outputText within the
> > statusIndicator.
> > >>>>>>>>>>>>>>
> > >>>>>>>>>>>>> The
> > >>>>>
> > >>>>>> value
> > >>>>>>>>>>>>
> > >>>>>>>>>>>>> for
> > >>>>>>>>>>>>>
> > >>>>>>>>>>>>>> the outPuttext would be linked to a backing bean, but I
> was
> > not
> > >>>>>>>>>>>>>>
> > >>>>>>>>>>>>> very
> > >>>>>>
> > >>>>>>> successful, do you have any other tips?
> > >>>>>>>>>>>>>>
> > >>>>>>>>>>>>>> I guess one can use the progressIndicator, but I would
> like
> > text
> > >>>>>>>>>>>>>>
> > >>>>>>>>>>>>> to
> > >>>>>>
> > >>>>>>> be
> > >>>>>>>>>>>
> > >>>>>>>>>>>> returned not a procentage progress.
> > >>>>>>>>>>>>>>
> > >>>>>>>>>>>>>> cheers, Håkon
> > >>>>>>>>>>>>>>
> > >>>>>>>>>>>>>
> > >>>
> >
>

Re: Using statusIndicator

Posted by Håkon Sagehaug <ha...@uni.no>.
Hi

Thanks for the tips and holding out this thread.  To kick of the poll do I
use rendered=true/false, it should have had a enable/disable. Or can I set
the interval to 0 or -1.

Cheers, Håkon

On 4 March 2011 14:18, Scott O'Bryan <da...@gmail.com> wrote:

> Yeah, I agree with Richard now that I know your trying to dynamically
> update it.  The poll components will kick off the AJAX request and
> your partialTrigger (set to the poll component) will allow the text to
> change.
>
> I would also suggest disabling the poll component when you don't
> expect any changes (ie. Maybe it doesn't start until the login is
> submitted and then it turns off after the login successfully
> completed).
>
> Does anyone know of "Streaming Requests" are handled in the next
> servlet spec?  If so, it would be cool for JSF to
> Do something with them, allow renderkits like Trinidad to stream
> updates in a more generic fashion.
>
> On Mar 4, 2011, at 5:53 AM, Richard Yee <ri...@gmail.com> wrote:
>
> > Hakon,
> > See my email from yesterday.  That is why I suggested using the tr:poll
> component. How many different status messages will you have? What period of
> time will the messages be changing? Depending on these answers, the tr:poll
> component or the statusIndicator will work. Can you list the sequence of
> events the timing (ie. 2 seconds or 2 minutes later xxx happens on the
> server.) are you starting a separate thread that eventually updates a status
> message?
> >
> > Richard
> >
> > Sent from my iPhone
> >
> > On Mar 4, 2011, at 1:34 AM, Håkon Sagehaug <ha...@uni.no>
> wrote:
> >
> >> Hi
> >>
> >> I put the form in various places, but I could not get the wanted effect.
> >> Just curious, since this is an update of a value on the server side. The
> >> clients somehow needs to know if the value have changed or not.  I guess
> >> this is somewhere referred to as server push. My impression of the
> >> partialTriggers is that an action is taken on the client side, and then
> >> something is triggered on the client side.
> >> So in my case the the value form the backing bean id read, but only when
> the
> >> button is clicked, not the hole "login session". Is this correct? I
> guess
> >> what to me sounds correct is to have some sort of value change listener
> on
> >> the value for the output text, but I guess that's more for input text
> etc
> >>
> >> Did this make sense?
> >>
> >> Cheers, Håkon
> >>
> >>
> >> On 3 March 2011 18:18, Scott O'Bryan <da...@gmail.com> wrote:
> >>
> >>> Hakkon, put the form around everything and see if it changes the PPR
> >>>
> >>>
> >>>
> >>> On 03/03/2011 10:00 AM, Richard Yee wrote:
> >>>
> >>>> what is the initial value of pollText in your backing bean? If it is
> "",
> >>>> you
> >>>> should set it to something else, ie. "Processing".
> >>>>
> >>>> The outputText inside statusIndicator will only show during the time
> the
> >>>> Ajax request is being made. Once the response is returned, it will
> >>>> disappear.
> >>>>
> >>>> -Richard
> >>>>
> >>>>
> >>>>
> >>>> 2011/3/3 Håkon Sagehaug<ha...@uni.no>
> >>>>
> >>>> Hi
> >>>>>
> >>>>> I now have my login page like this
> >>>>>
> >>>>> <?xml version="1.0" encoding="UTF-8"?>
> >>>>> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> >>>>> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> >>>>> <html xmlns="http://www.w3.org/1999/xhtml"
> >>>>>  xmlns:f="http://java.sun.com/jsf/core"
> >>>>>  xmlns:h="http://java.sun.com/jsf/html"
> >>>>>  xmlns:tr="http://myfaces.apache.org/trinidad">
> >>>>>
> >>>>> <f:view>
> >>>>>  <tr:document title="eSysbio-myFaces-Trinidad">
> >>>>>
> >>>>>      <tr:panelPage>
> >>>>>          <f:facet name="infoStatus">
> >>>>>              <tr:legend name="required" />
> >>>>>          </f:facet>
> >>>>>          <tr:form>
> >>>>>              <h:panelGrid colums="2">
> >>>>>                  <tr:outputLabel value="Username" />
> >>>>>                  <tr:inputText id="username"
> >>>>> value="#{helloWorldBacking.username}"
> >>>>>                      required="true" />
> >>>>>                  <tr:outputLabel value="Password" />
> >>>>>                  <tr:inputText id="password"
> >>>>> value="#{helloWorldBacking.password}"
> >>>>>                      required="true" secret="true" />
> >>>>>
> >>>>>              </h:panelGrid>
> >>>>>              <tr:commandButton id="loginButton" text="Login"
> >>>>> partialSubmit="true"
> >>>>>                  actionListener="#{helloWorldBacking.send}" />
> >>>>>
> >>>>>
> >>>>>              <!--
> >>>>>              <tr:statusIndicator>
> >>>>>                  <tr:outputText value="#{helloWorldBacking.pollText}"
> >>>>> />
> >>>>>              </tr:statusIndicator>
> >>>>>               -->
> >>>>>              <tr:outputText value="#{helloWorldBacking.pollText}"
> >>>>>                  partialTriggers="loginButton" />
> >>>>>          </tr:form>
> >>>>>      </tr:panelPage>
> >>>>>
> >>>>>  </tr:document>
> >>>>> </f:view>
> >>>>> </html>
> >>>>>
> >>>>> But then I got nothing in the outPutText field. Any other hint/tips
> or
> >>>>> tricks. I really appreciate the help
> >>>>>
> >>>>> Cheers, Håkon
> >>>>>
> >>>>> On 3 March 2011 17:25, Scott O'Bryan<da...@gmail.com>  wrote:
> >>>>>
> >>>>> That doesn't seem to make any sense to me Richard.  The poll
> component
> >>>>>> does not replace statusIndicator, they simply do two different
> things.
> >>>>>> The purpose of the poll component is to initiate a request based on
> a
> >>>>>> clock instead of a user click.  You still need some way to display
> the
> >>>>>> information..
> >>>>>>
> >>>>>> Hakon,
> >>>>>>
> >>>>>> The partial trigger in this case should be on the output text
> although
> >>>>>> having it on the status indicator should also work (you'll just get
> a
> >>>>>> larger payload).
> >>>>>>
> >>>>>> Try this.  Remove the status indicator and only have the output
> text.
> >>>>>> Make sure your outputText is located inside the form (possible your
> >>>>>> getting a scoping issue).
> >>>>>>
> >>>>>> Does that work?  It should.
> >>>>>>
> >>>>>> On Mar 3, 2011, at 9:06 AM, Richard Yee<ri...@gmail.com>
> >>>>>> wrote:
> >>>>>>
> >>>>>> You don't want statusIndicator, use tr:poll instead
> >>>>>>>
> >>>>>>> Richard
> >>>>>>>
> >>>>>>> Sent from my iPhone
> >>>>>>>
> >>>>>>> On Mar 3, 2011, at 7:48 AM, Håkon Sagehaug<ha...@uni.no>
> >>>>>>>
> >>>>>> wrote:
> >>>>>>
> >>>>>>> Hi
> >>>>>>>>
> >>>>>>>> Yes, that was an old cut and past mistake, I've got loginButton as
> id
> >>>>>>>>
> >>>>>>> for
> >>>>>>
> >>>>>>> the button. The latest test are with loginButton, not button2. So
> this
> >>>>>>>>
> >>>>>>> way
> >>>>>>
> >>>>>>> of doing it should normally work?
> >>>>>>>>
> >>>>>>>> cheers, Håkon
> >>>>>>>>
> >>>>>>>> On 3 March 2011 16:35, Scott O'Bryan<da...@gmail.com>  wrote:
> >>>>>>>>
> >>>>>>>> Umm.  Considering the id of your button is button2, I'm not sure
> why
> >>>>>>>>> your partialTrigger is loginButton.  Can you explain?
> >>>>>>>>>
> >>>>>>>>> On Mar 3, 2011, at 6:46 AM, "Håkon Sagehaug"<
> hakon.sagehaug@uni.no>
> >>>>>>>>> wrote:
> >>>>>>>>>
> >>>>>>>>> Hi all,
> >>>>>>>>>>
> >>>>>>>>>> I might not get the full point here ;). Here is what I tried,
> put
> >>>>>>>>>>
> >>>>>>>>> trigger
> >>>>>>
> >>>>>>> on
> >>>>>>>>>
> >>>>>>>>>> the statusIndicator like here
> >>>>>>>>>>
> >>>>>>>>>> <tr:statusIndicator partialTriggers="loginButton">
> >>>>>>>>>>                <f:facet name="busy">
> >>>>>>>>>>                    <tr:outputText
> >>>>>>>>>>
> >>>>>>>>> value="#{helloWorldBacking.pollText}"
> >>>>>>>>>
> >>>>>>>>>> />
> >>>>>>>>>>                </f:facet>
> >>>>>>>>>>            </tr:statusIndicator>
> >>>>>>>>>>
> >>>>>>>>>> And on the outputText like here
> >>>>>>>>>>
> >>>>>>>>>> <tr:statusIndicator partialTriggers="loginButton">
> >>>>>>>>>>                <f:facet name="busy">
> >>>>>>>>>>                    <tr:outputText
> >>>>>>>>>>
> >>>>>>>>> value="#{helloWorldBacking.pollText}"
> >>>>>>>>>
> >>>>>>>>>> partialTriggers="loginButton"/>
> >>>>>>>>>>                </f:facet>
> >>>>>>>>>>            </tr:statusIndicator>
> >>>>>>>>>>
> >>>>>>>>>> Where loginButton is
> >>>>>>>>>>
> >>>>>>>>>> <tr:commandButton id="button2" text="Login"
> partialSubmit="true"/>
> >>>>>>>>>>
> >>>>>>>>>> But nothing seems to have the wanted effect. I looks like it
> picks
> >>>>>>>>>>
> >>>>>>>>> up
> >>>>>
> >>>>>> the
> >>>>>>
> >>>>>>> initial value for the helloWorldBacking.pollText, but when this
> >>>>>>>>>>
> >>>>>>>>> value
> >>>>>
> >>>>>> changes it's it not propagated in the UI. Maybe this can't be done
> >>>>>>>>>>
> >>>>>>>>> like
> >>>>>>
> >>>>>>> I've
> >>>>>>>>>
> >>>>>>>>>> sketched out. The backing code is the same as sent in a earlier
> >>>>>>>>>>
> >>>>>>>>> email.
> >>>>>
> >>>>>> Other tips?
> >>>>>>>>>>
> >>>>>>>>>> Cheers, Håkon
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>> On 3 March 2011 05:23, Richard Yee<ri...@gmail.com>
>  wrote:
> >>>>>>>>>>
> >>>>>>>>>> Try putting it inside the tr:form or inside your panelPage
> >>>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>>>> -Richard
> >>>>>>>>>>>
> >>>>>>>>>>> 2011/3/1 Håkon Sagehaug<ha...@uni.no>
> >>>>>>>>>>>
> >>>>>>>>>>> Hi
> >>>>>>>>>>>>
> >>>>>>>>>>>> Thanks for the reply, here is my xhtml, with a simple login
> form
> >>>>>>>>>>>>
> >>>>>>>>>>>> <tr:document title="Login Demo">
> >>>>>>>>>>>>   <tr:statusIndicator>
> >>>>>>>>>>>>       <f:facet name="busy">
> >>>>>>>>>>>>           <tr:outputText value="#{helloWorldBacking.pollText}"
> >>>>>>>>>>>>
> >>>>>>>>>>> />
> >>>>>
> >>>>>>       </f:facet>
> >>>>>>>>>>>>   </tr:statusIndicator>
> >>>>>>>>>>>>   <tr:form>
> >>>>>>>>>>>>
> >>>>>>>>>>>>       <tr:panelPage>
> >>>>>>>>>>>>           <f:facet name="infoStatus">
> >>>>>>>>>>>>               <tr:legend name="required" />
> >>>>>>>>>>>>           </f:facet>
> >>>>>>>>>>>>
> >>>>>>>>>>>>           <tr:inputText label="Username" id="username"
> >>>>>>>>>>>>               value="#{helloWorldBacking.username}"
> >>>>>>>>>>>>
> >>>>>>>>>>> required="true"
> >>>>>>
> >>>>>>> />
> >>>>>>>>>>>
> >>>>>>>>>>>>           <tr:inputText label="Password" id="password"
> >>>>>>>>>>>>               value="#{helloWorldBacking.password}"
> >>>>>>>>>>>>
> >>>>>>>>>>> required="true"
> >>>>>>
> >>>>>>> secret="true" />
> >>>>>>>>>>>>           <tr:commandButton id="button2" text="Login"
> >>>>>>>>>>>> partialSubmit="true"
> >>>>>>>>>>>>               action="#{helloWorldBacking.send}" />
> >>>>>>>>>>>>       </tr:panelPage>
> >>>>>>>>>>>>
> >>>>>>>>>>>>   </tr:form>
> >>>>>>>>>>>>
> >>>>>>>>>>>> </tr:document>
> >>>>>>>>>>>>
> >>>>>>>>>>>> And parts of the backing bean
> >>>>>>>>>>>>
> >>>>>>>>>>>> public String send() {
> >>>>>>>>>>>>   FacesContext facesContext =
> FacesContext.getCurrentInstance();
> >>>>>>>>>>>>
> >>>>>>>>>>>>   System.out.println("user name " + username + " is logged in
> "
> >>>>>>>>>>>>           + userLoggedIn);
> >>>>>>>>>>>>
> >>>>>>>>>>>>   try {
> >>>>>>>>>>>>       Thread.sleep(5000);
> >>>>>>>>>>>>       Token tok = tokenMgr.getToken(username, password, true);
> >>>>>>>>>>>>      Thread.sleep(2000);
> >>>>>>>>>>>>       pollText = "Token fetched";
> >>>>>>>>>>>>       if (tok != null) {
> >>>>>>>>>>>>           userLoggedIn = true;
> >>>>>>>>>>>>           return ("success");
> >>>>>>>>>>>>       }
> >>>>>>>>>>>>       username = "";
> >>>>>>>>>>>>       password = "";
> >>>>>>>>>>>>   } catch (TrustException e1) {
> >>>>>>>>>>>>       e1.printStackTrace();
> >>>>>>>>>>>>   } catch (AxisFault e) {
> >>>>>>>>>>>>       e.printStackTrace();
> >>>>>>>>>>>>   } catch (FileNotFoundException e) {
> >>>>>>>>>>>>       e.printStackTrace();
> >>>>>>>>>>>>   } catch (XMLStreamException e) {
> >>>>>>>>>>>>       e.printStackTrace();
> >>>>>>>>>>>>   } catch (InterruptedException e) {
> >>>>>>>>>>>>
> >>>>>>>>>>>>       e.printStackTrace();
> >>>>>>>>>>>>   }
> >>>>>>>>>>>>   FacesMessage message = new FacesMessage("Login failed");
> >>>>>>>>>>>>
> >>>>>>>>>>>>   facesContext.addMessage("username", message);
> >>>>>>>>>>>>
> >>>>>>>>>>>>   username = "";
> >>>>>>>>>>>>   password = "";
> >>>>>>>>>>>>
> >>>>>>>>>>>>   return ("error");
> >>>>>>>>>>>>
> >>>>>>>>>>>> }
> >>>>>>>>>>>> As you can see I sleep the thread to simulate the operations
> >>>>>>>>>>>>
> >>>>>>>>>>> needed
> >>>>>
> >>>>>> to
> >>>>>>
> >>>>>>> log
> >>>>>>>>>>>
> >>>>>>>>>>>> in the user, for now I'm only getting the token. After that
> I'll
> >>>>>>>>>>>>
> >>>>>>>>>>> fetch
> >>>>>>
> >>>>>>> the
> >>>>>>>>>>>
> >>>>>>>>>>>> project, data etc...
> >>>>>>>>>>>>
> >>>>>>>>>>>> So I wanted the pollText to apear  dynmically in the status
> >>>>>>>>>>>>
> >>>>>>>>>>> indicator,
> >>>>>>
> >>>>>>> but
> >>>>>>>>>>>
> >>>>>>>>>>>> can get it to update,.
> >>>>>>>>>>>>
> >>>>>>>>>>>> Any tips?
> >>>>>>>>>>>>
> >>>>>>>>>>>> cheers, Håkon
> >>>>>>>>>>>>
> >>>>>>>>>>>> On 1 March 2011 23:23, Scott O'Bryan<da...@gmail.com>
>  wrote:
> >>>>>>>>>>>>
> >>>>>>>>>>>> I see no reason why this wouldn't work..  What specifically is
> >>>>>>>>>>>>>
> >>>>>>>>>>>> failing
> >>>>>>
> >>>>>>> for you and perhaps a code snipi might help me visualize your
> >>>>>>>>>>>>>
> >>>>>>>>>>>> issue.
> >>>>>>
> >>>>>>> On Mar 1, 2011, at 3:04 PM, "Håkon Sagehaug"<
> >>>>>>>>>>>>>
> >>>>>>>>>>>> hakon.sagehaug@uni.no>
> >>>>>>
> >>>>>>> wrote:
> >>>>>>>>>>>>>
> >>>>>>>>>>>>> Hi all,
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> I've just stared using Trinidad and myFaces, and had a
> question.
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>> I'm
> >>>>>>
> >>>>>>> implementing a login in page for uses, and wanted to use the
> >>>>>>>>>>>>>> statusIndicator, to give back messages for the user like
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> 1. Got user information
> >>>>>>>>>>>>>> 2. Loading datasets
> >>>>>>>>>>>>>> 3. Logged in
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> And tried to have a  tr:outputText within the
> statusIndicator.
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>> The
> >>>>>
> >>>>>> value
> >>>>>>>>>>>>
> >>>>>>>>>>>>> for
> >>>>>>>>>>>>>
> >>>>>>>>>>>>>> the outPuttext would be linked to a backing bean, but I was
> not
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>> very
> >>>>>>
> >>>>>>> successful, do you have any other tips?
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> I guess one can use the progressIndicator, but I would like
> text
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>> to
> >>>>>>
> >>>>>>> be
> >>>>>>>>>>>
> >>>>>>>>>>>> returned not a procentage progress.
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> cheers, Håkon
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>
> >>>
>

Re: Using statusIndicator

Posted by Scott O'Bryan <da...@gmail.com>.
Yeah, I agree with Richard now that I know your trying to dynamically
update it.  The poll components will kick off the AJAX request and
your partialTrigger (set to the poll component) will allow the text to
change.

I would also suggest disabling the poll component when you don't
expect any changes (ie. Maybe it doesn't start until the login is
submitted and then it turns off after the login successfully
completed).

Does anyone know of "Streaming Requests" are handled in the next
servlet spec?  If so, it would be cool for JSF to
Do something with them, allow renderkits like Trinidad to stream
updates in a more generic fashion.

On Mar 4, 2011, at 5:53 AM, Richard Yee <ri...@gmail.com> wrote:

> Hakon,
> See my email from yesterday.  That is why I suggested using the tr:poll component. How many different status messages will you have? What period of time will the messages be changing? Depending on these answers, the tr:poll component or the statusIndicator will work. Can you list the sequence of events the timing (ie. 2 seconds or 2 minutes later xxx happens on the server.) are you starting a separate thread that eventually updates a status message?
>
> Richard
>
> Sent from my iPhone
>
> On Mar 4, 2011, at 1:34 AM, Håkon Sagehaug <ha...@uni.no> wrote:
>
>> Hi
>>
>> I put the form in various places, but I could not get the wanted effect.
>> Just curious, since this is an update of a value on the server side. The
>> clients somehow needs to know if the value have changed or not.  I guess
>> this is somewhere referred to as server push. My impression of the
>> partialTriggers is that an action is taken on the client side, and then
>> something is triggered on the client side.
>> So in my case the the value form the backing bean id read, but only when the
>> button is clicked, not the hole "login session". Is this correct? I guess
>> what to me sounds correct is to have some sort of value change listener on
>> the value for the output text, but I guess that's more for input text etc
>>
>> Did this make sense?
>>
>> Cheers, Håkon
>>
>>
>> On 3 March 2011 18:18, Scott O'Bryan <da...@gmail.com> wrote:
>>
>>> Hakkon, put the form around everything and see if it changes the PPR
>>>
>>>
>>>
>>> On 03/03/2011 10:00 AM, Richard Yee wrote:
>>>
>>>> what is the initial value of pollText in your backing bean? If it is "",
>>>> you
>>>> should set it to something else, ie. "Processing".
>>>>
>>>> The outputText inside statusIndicator will only show during the time the
>>>> Ajax request is being made. Once the response is returned, it will
>>>> disappear.
>>>>
>>>> -Richard
>>>>
>>>>
>>>>
>>>> 2011/3/3 Håkon Sagehaug<ha...@uni.no>
>>>>
>>>> Hi
>>>>>
>>>>> I now have my login page like this
>>>>>
>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
>>>>> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
>>>>> <html xmlns="http://www.w3.org/1999/xhtml"
>>>>>  xmlns:f="http://java.sun.com/jsf/core"
>>>>>  xmlns:h="http://java.sun.com/jsf/html"
>>>>>  xmlns:tr="http://myfaces.apache.org/trinidad">
>>>>>
>>>>> <f:view>
>>>>>  <tr:document title="eSysbio-myFaces-Trinidad">
>>>>>
>>>>>      <tr:panelPage>
>>>>>          <f:facet name="infoStatus">
>>>>>              <tr:legend name="required" />
>>>>>          </f:facet>
>>>>>          <tr:form>
>>>>>              <h:panelGrid colums="2">
>>>>>                  <tr:outputLabel value="Username" />
>>>>>                  <tr:inputText id="username"
>>>>> value="#{helloWorldBacking.username}"
>>>>>                      required="true" />
>>>>>                  <tr:outputLabel value="Password" />
>>>>>                  <tr:inputText id="password"
>>>>> value="#{helloWorldBacking.password}"
>>>>>                      required="true" secret="true" />
>>>>>
>>>>>              </h:panelGrid>
>>>>>              <tr:commandButton id="loginButton" text="Login"
>>>>> partialSubmit="true"
>>>>>                  actionListener="#{helloWorldBacking.send}" />
>>>>>
>>>>>
>>>>>              <!--
>>>>>              <tr:statusIndicator>
>>>>>                  <tr:outputText value="#{helloWorldBacking.pollText}"
>>>>> />
>>>>>              </tr:statusIndicator>
>>>>>               -->
>>>>>              <tr:outputText value="#{helloWorldBacking.pollText}"
>>>>>                  partialTriggers="loginButton" />
>>>>>          </tr:form>
>>>>>      </tr:panelPage>
>>>>>
>>>>>  </tr:document>
>>>>> </f:view>
>>>>> </html>
>>>>>
>>>>> But then I got nothing in the outPutText field. Any other hint/tips or
>>>>> tricks. I really appreciate the help
>>>>>
>>>>> Cheers, Håkon
>>>>>
>>>>> On 3 March 2011 17:25, Scott O'Bryan<da...@gmail.com>  wrote:
>>>>>
>>>>> That doesn't seem to make any sense to me Richard.  The poll component
>>>>>> does not replace statusIndicator, they simply do two different things.
>>>>>> The purpose of the poll component is to initiate a request based on a
>>>>>> clock instead of a user click.  You still need some way to display the
>>>>>> information..
>>>>>>
>>>>>> Hakon,
>>>>>>
>>>>>> The partial trigger in this case should be on the output text although
>>>>>> having it on the status indicator should also work (you'll just get a
>>>>>> larger payload).
>>>>>>
>>>>>> Try this.  Remove the status indicator and only have the output text.
>>>>>> Make sure your outputText is located inside the form (possible your
>>>>>> getting a scoping issue).
>>>>>>
>>>>>> Does that work?  It should.
>>>>>>
>>>>>> On Mar 3, 2011, at 9:06 AM, Richard Yee<ri...@gmail.com>
>>>>>> wrote:
>>>>>>
>>>>>> You don't want statusIndicator, use tr:poll instead
>>>>>>>
>>>>>>> Richard
>>>>>>>
>>>>>>> Sent from my iPhone
>>>>>>>
>>>>>>> On Mar 3, 2011, at 7:48 AM, Håkon Sagehaug<ha...@uni.no>
>>>>>>>
>>>>>> wrote:
>>>>>>
>>>>>>> Hi
>>>>>>>>
>>>>>>>> Yes, that was an old cut and past mistake, I've got loginButton as id
>>>>>>>>
>>>>>>> for
>>>>>>
>>>>>>> the button. The latest test are with loginButton, not button2. So this
>>>>>>>>
>>>>>>> way
>>>>>>
>>>>>>> of doing it should normally work?
>>>>>>>>
>>>>>>>> cheers, Håkon
>>>>>>>>
>>>>>>>> On 3 March 2011 16:35, Scott O'Bryan<da...@gmail.com>  wrote:
>>>>>>>>
>>>>>>>> Umm.  Considering the id of your button is button2, I'm not sure why
>>>>>>>>> your partialTrigger is loginButton.  Can you explain?
>>>>>>>>>
>>>>>>>>> On Mar 3, 2011, at 6:46 AM, "Håkon Sagehaug"<ha...@uni.no>
>>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>> Hi all,
>>>>>>>>>>
>>>>>>>>>> I might not get the full point here ;). Here is what I tried, put
>>>>>>>>>>
>>>>>>>>> trigger
>>>>>>
>>>>>>> on
>>>>>>>>>
>>>>>>>>>> the statusIndicator like here
>>>>>>>>>>
>>>>>>>>>> <tr:statusIndicator partialTriggers="loginButton">
>>>>>>>>>>                <f:facet name="busy">
>>>>>>>>>>                    <tr:outputText
>>>>>>>>>>
>>>>>>>>> value="#{helloWorldBacking.pollText}"
>>>>>>>>>
>>>>>>>>>> />
>>>>>>>>>>                </f:facet>
>>>>>>>>>>            </tr:statusIndicator>
>>>>>>>>>>
>>>>>>>>>> And on the outputText like here
>>>>>>>>>>
>>>>>>>>>> <tr:statusIndicator partialTriggers="loginButton">
>>>>>>>>>>                <f:facet name="busy">
>>>>>>>>>>                    <tr:outputText
>>>>>>>>>>
>>>>>>>>> value="#{helloWorldBacking.pollText}"
>>>>>>>>>
>>>>>>>>>> partialTriggers="loginButton"/>
>>>>>>>>>>                </f:facet>
>>>>>>>>>>            </tr:statusIndicator>
>>>>>>>>>>
>>>>>>>>>> Where loginButton is
>>>>>>>>>>
>>>>>>>>>> <tr:commandButton id="button2" text="Login" partialSubmit="true"/>
>>>>>>>>>>
>>>>>>>>>> But nothing seems to have the wanted effect. I looks like it picks
>>>>>>>>>>
>>>>>>>>> up
>>>>>
>>>>>> the
>>>>>>
>>>>>>> initial value for the helloWorldBacking.pollText, but when this
>>>>>>>>>>
>>>>>>>>> value
>>>>>
>>>>>> changes it's it not propagated in the UI. Maybe this can't be done
>>>>>>>>>>
>>>>>>>>> like
>>>>>>
>>>>>>> I've
>>>>>>>>>
>>>>>>>>>> sketched out. The backing code is the same as sent in a earlier
>>>>>>>>>>
>>>>>>>>> email.
>>>>>
>>>>>> Other tips?
>>>>>>>>>>
>>>>>>>>>> Cheers, Håkon
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On 3 March 2011 05:23, Richard Yee<ri...@gmail.com>  wrote:
>>>>>>>>>>
>>>>>>>>>> Try putting it inside the tr:form or inside your panelPage
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> -Richard
>>>>>>>>>>>
>>>>>>>>>>> 2011/3/1 Håkon Sagehaug<ha...@uni.no>
>>>>>>>>>>>
>>>>>>>>>>> Hi
>>>>>>>>>>>>
>>>>>>>>>>>> Thanks for the reply, here is my xhtml, with a simple login form
>>>>>>>>>>>>
>>>>>>>>>>>> <tr:document title="Login Demo">
>>>>>>>>>>>>   <tr:statusIndicator>
>>>>>>>>>>>>       <f:facet name="busy">
>>>>>>>>>>>>           <tr:outputText value="#{helloWorldBacking.pollText}"
>>>>>>>>>>>>
>>>>>>>>>>> />
>>>>>
>>>>>>       </f:facet>
>>>>>>>>>>>>   </tr:statusIndicator>
>>>>>>>>>>>>   <tr:form>
>>>>>>>>>>>>
>>>>>>>>>>>>       <tr:panelPage>
>>>>>>>>>>>>           <f:facet name="infoStatus">
>>>>>>>>>>>>               <tr:legend name="required" />
>>>>>>>>>>>>           </f:facet>
>>>>>>>>>>>>
>>>>>>>>>>>>           <tr:inputText label="Username" id="username"
>>>>>>>>>>>>               value="#{helloWorldBacking.username}"
>>>>>>>>>>>>
>>>>>>>>>>> required="true"
>>>>>>
>>>>>>> />
>>>>>>>>>>>
>>>>>>>>>>>>           <tr:inputText label="Password" id="password"
>>>>>>>>>>>>               value="#{helloWorldBacking.password}"
>>>>>>>>>>>>
>>>>>>>>>>> required="true"
>>>>>>
>>>>>>> secret="true" />
>>>>>>>>>>>>           <tr:commandButton id="button2" text="Login"
>>>>>>>>>>>> partialSubmit="true"
>>>>>>>>>>>>               action="#{helloWorldBacking.send}" />
>>>>>>>>>>>>       </tr:panelPage>
>>>>>>>>>>>>
>>>>>>>>>>>>   </tr:form>
>>>>>>>>>>>>
>>>>>>>>>>>> </tr:document>
>>>>>>>>>>>>
>>>>>>>>>>>> And parts of the backing bean
>>>>>>>>>>>>
>>>>>>>>>>>> public String send() {
>>>>>>>>>>>>   FacesContext facesContext = FacesContext.getCurrentInstance();
>>>>>>>>>>>>
>>>>>>>>>>>>   System.out.println("user name " + username + " is logged in "
>>>>>>>>>>>>           + userLoggedIn);
>>>>>>>>>>>>
>>>>>>>>>>>>   try {
>>>>>>>>>>>>       Thread.sleep(5000);
>>>>>>>>>>>>       Token tok = tokenMgr.getToken(username, password, true);
>>>>>>>>>>>>      Thread.sleep(2000);
>>>>>>>>>>>>       pollText = "Token fetched";
>>>>>>>>>>>>       if (tok != null) {
>>>>>>>>>>>>           userLoggedIn = true;
>>>>>>>>>>>>           return ("success");
>>>>>>>>>>>>       }
>>>>>>>>>>>>       username = "";
>>>>>>>>>>>>       password = "";
>>>>>>>>>>>>   } catch (TrustException e1) {
>>>>>>>>>>>>       e1.printStackTrace();
>>>>>>>>>>>>   } catch (AxisFault e) {
>>>>>>>>>>>>       e.printStackTrace();
>>>>>>>>>>>>   } catch (FileNotFoundException e) {
>>>>>>>>>>>>       e.printStackTrace();
>>>>>>>>>>>>   } catch (XMLStreamException e) {
>>>>>>>>>>>>       e.printStackTrace();
>>>>>>>>>>>>   } catch (InterruptedException e) {
>>>>>>>>>>>>
>>>>>>>>>>>>       e.printStackTrace();
>>>>>>>>>>>>   }
>>>>>>>>>>>>   FacesMessage message = new FacesMessage("Login failed");
>>>>>>>>>>>>
>>>>>>>>>>>>   facesContext.addMessage("username", message);
>>>>>>>>>>>>
>>>>>>>>>>>>   username = "";
>>>>>>>>>>>>   password = "";
>>>>>>>>>>>>
>>>>>>>>>>>>   return ("error");
>>>>>>>>>>>>
>>>>>>>>>>>> }
>>>>>>>>>>>> As you can see I sleep the thread to simulate the operations
>>>>>>>>>>>>
>>>>>>>>>>> needed
>>>>>
>>>>>> to
>>>>>>
>>>>>>> log
>>>>>>>>>>>
>>>>>>>>>>>> in the user, for now I'm only getting the token. After that I'll
>>>>>>>>>>>>
>>>>>>>>>>> fetch
>>>>>>
>>>>>>> the
>>>>>>>>>>>
>>>>>>>>>>>> project, data etc...
>>>>>>>>>>>>
>>>>>>>>>>>> So I wanted the pollText to apear  dynmically in the status
>>>>>>>>>>>>
>>>>>>>>>>> indicator,
>>>>>>
>>>>>>> but
>>>>>>>>>>>
>>>>>>>>>>>> can get it to update,.
>>>>>>>>>>>>
>>>>>>>>>>>> Any tips?
>>>>>>>>>>>>
>>>>>>>>>>>> cheers, Håkon
>>>>>>>>>>>>
>>>>>>>>>>>> On 1 March 2011 23:23, Scott O'Bryan<da...@gmail.com>  wrote:
>>>>>>>>>>>>
>>>>>>>>>>>> I see no reason why this wouldn't work..  What specifically is
>>>>>>>>>>>>>
>>>>>>>>>>>> failing
>>>>>>
>>>>>>> for you and perhaps a code snipi might help me visualize your
>>>>>>>>>>>>>
>>>>>>>>>>>> issue.
>>>>>>
>>>>>>> On Mar 1, 2011, at 3:04 PM, "Håkon Sagehaug"<
>>>>>>>>>>>>>
>>>>>>>>>>>> hakon.sagehaug@uni.no>
>>>>>>
>>>>>>> wrote:
>>>>>>>>>>>>>
>>>>>>>>>>>>> Hi all,
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> I've just stared using Trinidad and myFaces, and had a question.
>>>>>>>>>>>>>>
>>>>>>>>>>>>> I'm
>>>>>>
>>>>>>> implementing a login in page for uses, and wanted to use the
>>>>>>>>>>>>>> statusIndicator, to give back messages for the user like
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> 1. Got user information
>>>>>>>>>>>>>> 2. Loading datasets
>>>>>>>>>>>>>> 3. Logged in
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> And tried to have a  tr:outputText within the statusIndicator.
>>>>>>>>>>>>>>
>>>>>>>>>>>>> The
>>>>>
>>>>>> value
>>>>>>>>>>>>
>>>>>>>>>>>>> for
>>>>>>>>>>>>>
>>>>>>>>>>>>>> the outPuttext would be linked to a backing bean, but I was not
>>>>>>>>>>>>>>
>>>>>>>>>>>>> very
>>>>>>
>>>>>>> successful, do you have any other tips?
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> I guess one can use the progressIndicator, but I would like text
>>>>>>>>>>>>>>
>>>>>>>>>>>>> to
>>>>>>
>>>>>>> be
>>>>>>>>>>>
>>>>>>>>>>>> returned not a procentage progress.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> cheers, Håkon
>>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>

Re: Using statusIndicator

Posted by Richard Yee <ri...@gmail.com>.
Hakon,
See my email from yesterday.  That is why I suggested using the tr:poll component. How many different status messages will you have? What period of time will the messages be changing? Depending on these answers, the tr:poll component or the statusIndicator will work. Can you list the sequence of events the timing (ie. 2 seconds or 2 minutes later xxx happens on the server.) are you starting a separate thread that eventually updates a status message?

Richard

Sent from my iPhone

On Mar 4, 2011, at 1:34 AM, Håkon Sagehaug <ha...@uni.no> wrote:

> Hi
> 
> I put the form in various places, but I could not get the wanted effect.
> Just curious, since this is an update of a value on the server side. The
> clients somehow needs to know if the value have changed or not.  I guess
> this is somewhere referred to as server push. My impression of the
> partialTriggers is that an action is taken on the client side, and then
> something is triggered on the client side.
> So in my case the the value form the backing bean id read, but only when the
> button is clicked, not the hole "login session". Is this correct? I guess
> what to me sounds correct is to have some sort of value change listener on
> the value for the output text, but I guess that's more for input text etc
> 
> Did this make sense?
> 
> Cheers, Håkon
> 
> 
> On 3 March 2011 18:18, Scott O'Bryan <da...@gmail.com> wrote:
> 
>> Hakkon, put the form around everything and see if it changes the PPR
>> 
>> 
>> 
>> On 03/03/2011 10:00 AM, Richard Yee wrote:
>> 
>>> what is the initial value of pollText in your backing bean? If it is "",
>>> you
>>> should set it to something else, ie. "Processing".
>>> 
>>> The outputText inside statusIndicator will only show during the time the
>>> Ajax request is being made. Once the response is returned, it will
>>> disappear.
>>> 
>>> -Richard
>>> 
>>> 
>>> 
>>> 2011/3/3 Håkon Sagehaug<ha...@uni.no>
>>> 
>>> Hi
>>>> 
>>>> I now have my login page like this
>>>> 
>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
>>>> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
>>>> <html xmlns="http://www.w3.org/1999/xhtml"
>>>>   xmlns:f="http://java.sun.com/jsf/core"
>>>>   xmlns:h="http://java.sun.com/jsf/html"
>>>>   xmlns:tr="http://myfaces.apache.org/trinidad">
>>>> 
>>>> <f:view>
>>>>   <tr:document title="eSysbio-myFaces-Trinidad">
>>>> 
>>>>       <tr:panelPage>
>>>>           <f:facet name="infoStatus">
>>>>               <tr:legend name="required" />
>>>>           </f:facet>
>>>>           <tr:form>
>>>>               <h:panelGrid colums="2">
>>>>                   <tr:outputLabel value="Username" />
>>>>                   <tr:inputText id="username"
>>>> value="#{helloWorldBacking.username}"
>>>>                       required="true" />
>>>>                   <tr:outputLabel value="Password" />
>>>>                   <tr:inputText id="password"
>>>> value="#{helloWorldBacking.password}"
>>>>                       required="true" secret="true" />
>>>> 
>>>>               </h:panelGrid>
>>>>               <tr:commandButton id="loginButton" text="Login"
>>>> partialSubmit="true"
>>>>                   actionListener="#{helloWorldBacking.send}" />
>>>> 
>>>> 
>>>>               <!--
>>>>               <tr:statusIndicator>
>>>>                   <tr:outputText value="#{helloWorldBacking.pollText}"
>>>> />
>>>>               </tr:statusIndicator>
>>>>                -->
>>>>               <tr:outputText value="#{helloWorldBacking.pollText}"
>>>>                   partialTriggers="loginButton" />
>>>>           </tr:form>
>>>>       </tr:panelPage>
>>>> 
>>>>   </tr:document>
>>>> </f:view>
>>>> </html>
>>>> 
>>>> But then I got nothing in the outPutText field. Any other hint/tips or
>>>> tricks. I really appreciate the help
>>>> 
>>>> Cheers, Håkon
>>>> 
>>>> On 3 March 2011 17:25, Scott O'Bryan<da...@gmail.com>  wrote:
>>>> 
>>>> That doesn't seem to make any sense to me Richard.  The poll component
>>>>> does not replace statusIndicator, they simply do two different things.
>>>>> The purpose of the poll component is to initiate a request based on a
>>>>> clock instead of a user click.  You still need some way to display the
>>>>> information..
>>>>> 
>>>>> Hakon,
>>>>> 
>>>>> The partial trigger in this case should be on the output text although
>>>>> having it on the status indicator should also work (you'll just get a
>>>>> larger payload).
>>>>> 
>>>>> Try this.  Remove the status indicator and only have the output text.
>>>>> Make sure your outputText is located inside the form (possible your
>>>>> getting a scoping issue).
>>>>> 
>>>>> Does that work?  It should.
>>>>> 
>>>>> On Mar 3, 2011, at 9:06 AM, Richard Yee<ri...@gmail.com>
>>>>> wrote:
>>>>> 
>>>>> You don't want statusIndicator, use tr:poll instead
>>>>>> 
>>>>>> Richard
>>>>>> 
>>>>>> Sent from my iPhone
>>>>>> 
>>>>>> On Mar 3, 2011, at 7:48 AM, Håkon Sagehaug<ha...@uni.no>
>>>>>> 
>>>>> wrote:
>>>>> 
>>>>>> Hi
>>>>>>> 
>>>>>>> Yes, that was an old cut and past mistake, I've got loginButton as id
>>>>>>> 
>>>>>> for
>>>>> 
>>>>>> the button. The latest test are with loginButton, not button2. So this
>>>>>>> 
>>>>>> way
>>>>> 
>>>>>> of doing it should normally work?
>>>>>>> 
>>>>>>> cheers, Håkon
>>>>>>> 
>>>>>>> On 3 March 2011 16:35, Scott O'Bryan<da...@gmail.com>  wrote:
>>>>>>> 
>>>>>>> Umm.  Considering the id of your button is button2, I'm not sure why
>>>>>>>> your partialTrigger is loginButton.  Can you explain?
>>>>>>>> 
>>>>>>>> On Mar 3, 2011, at 6:46 AM, "Håkon Sagehaug"<ha...@uni.no>
>>>>>>>> wrote:
>>>>>>>> 
>>>>>>>> Hi all,
>>>>>>>>> 
>>>>>>>>> I might not get the full point here ;). Here is what I tried, put
>>>>>>>>> 
>>>>>>>> trigger
>>>>> 
>>>>>> on
>>>>>>>> 
>>>>>>>>> the statusIndicator like here
>>>>>>>>> 
>>>>>>>>> <tr:statusIndicator partialTriggers="loginButton">
>>>>>>>>>                 <f:facet name="busy">
>>>>>>>>>                     <tr:outputText
>>>>>>>>> 
>>>>>>>> value="#{helloWorldBacking.pollText}"
>>>>>>>> 
>>>>>>>>> />
>>>>>>>>>                 </f:facet>
>>>>>>>>>             </tr:statusIndicator>
>>>>>>>>> 
>>>>>>>>> And on the outputText like here
>>>>>>>>> 
>>>>>>>>> <tr:statusIndicator partialTriggers="loginButton">
>>>>>>>>>                 <f:facet name="busy">
>>>>>>>>>                     <tr:outputText
>>>>>>>>> 
>>>>>>>> value="#{helloWorldBacking.pollText}"
>>>>>>>> 
>>>>>>>>> partialTriggers="loginButton"/>
>>>>>>>>>                 </f:facet>
>>>>>>>>>             </tr:statusIndicator>
>>>>>>>>> 
>>>>>>>>> Where loginButton is
>>>>>>>>> 
>>>>>>>>> <tr:commandButton id="button2" text="Login" partialSubmit="true"/>
>>>>>>>>> 
>>>>>>>>> But nothing seems to have the wanted effect. I looks like it picks
>>>>>>>>> 
>>>>>>>> up
>>>> 
>>>>> the
>>>>> 
>>>>>> initial value for the helloWorldBacking.pollText, but when this
>>>>>>>>> 
>>>>>>>> value
>>>> 
>>>>> changes it's it not propagated in the UI. Maybe this can't be done
>>>>>>>>> 
>>>>>>>> like
>>>>> 
>>>>>> I've
>>>>>>>> 
>>>>>>>>> sketched out. The backing code is the same as sent in a earlier
>>>>>>>>> 
>>>>>>>> email.
>>>> 
>>>>> Other tips?
>>>>>>>>> 
>>>>>>>>> Cheers, Håkon
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> On 3 March 2011 05:23, Richard Yee<ri...@gmail.com>  wrote:
>>>>>>>>> 
>>>>>>>>> Try putting it inside the tr:form or inside your panelPage
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> -Richard
>>>>>>>>>> 
>>>>>>>>>> 2011/3/1 Håkon Sagehaug<ha...@uni.no>
>>>>>>>>>> 
>>>>>>>>>> Hi
>>>>>>>>>>> 
>>>>>>>>>>> Thanks for the reply, here is my xhtml, with a simple login form
>>>>>>>>>>> 
>>>>>>>>>>> <tr:document title="Login Demo">
>>>>>>>>>>>    <tr:statusIndicator>
>>>>>>>>>>>        <f:facet name="busy">
>>>>>>>>>>>            <tr:outputText value="#{helloWorldBacking.pollText}"
>>>>>>>>>>> 
>>>>>>>>>> />
>>>> 
>>>>>        </f:facet>
>>>>>>>>>>>    </tr:statusIndicator>
>>>>>>>>>>>    <tr:form>
>>>>>>>>>>> 
>>>>>>>>>>>        <tr:panelPage>
>>>>>>>>>>>            <f:facet name="infoStatus">
>>>>>>>>>>>                <tr:legend name="required" />
>>>>>>>>>>>            </f:facet>
>>>>>>>>>>> 
>>>>>>>>>>>            <tr:inputText label="Username" id="username"
>>>>>>>>>>>                value="#{helloWorldBacking.username}"
>>>>>>>>>>> 
>>>>>>>>>> required="true"
>>>>> 
>>>>>> />
>>>>>>>>>> 
>>>>>>>>>>>            <tr:inputText label="Password" id="password"
>>>>>>>>>>>                value="#{helloWorldBacking.password}"
>>>>>>>>>>> 
>>>>>>>>>> required="true"
>>>>> 
>>>>>> secret="true" />
>>>>>>>>>>>            <tr:commandButton id="button2" text="Login"
>>>>>>>>>>> partialSubmit="true"
>>>>>>>>>>>                action="#{helloWorldBacking.send}" />
>>>>>>>>>>>        </tr:panelPage>
>>>>>>>>>>> 
>>>>>>>>>>>    </tr:form>
>>>>>>>>>>> 
>>>>>>>>>>> </tr:document>
>>>>>>>>>>> 
>>>>>>>>>>> And parts of the backing bean
>>>>>>>>>>> 
>>>>>>>>>>> public String send() {
>>>>>>>>>>>    FacesContext facesContext = FacesContext.getCurrentInstance();
>>>>>>>>>>> 
>>>>>>>>>>>    System.out.println("user name " + username + " is logged in "
>>>>>>>>>>>            + userLoggedIn);
>>>>>>>>>>> 
>>>>>>>>>>>    try {
>>>>>>>>>>>        Thread.sleep(5000);
>>>>>>>>>>>        Token tok = tokenMgr.getToken(username, password, true);
>>>>>>>>>>>       Thread.sleep(2000);
>>>>>>>>>>>        pollText = "Token fetched";
>>>>>>>>>>>        if (tok != null) {
>>>>>>>>>>>            userLoggedIn = true;
>>>>>>>>>>>            return ("success");
>>>>>>>>>>>        }
>>>>>>>>>>>        username = "";
>>>>>>>>>>>        password = "";
>>>>>>>>>>>    } catch (TrustException e1) {
>>>>>>>>>>>        e1.printStackTrace();
>>>>>>>>>>>    } catch (AxisFault e) {
>>>>>>>>>>>        e.printStackTrace();
>>>>>>>>>>>    } catch (FileNotFoundException e) {
>>>>>>>>>>>        e.printStackTrace();
>>>>>>>>>>>    } catch (XMLStreamException e) {
>>>>>>>>>>>        e.printStackTrace();
>>>>>>>>>>>    } catch (InterruptedException e) {
>>>>>>>>>>> 
>>>>>>>>>>>        e.printStackTrace();
>>>>>>>>>>>    }
>>>>>>>>>>>    FacesMessage message = new FacesMessage("Login failed");
>>>>>>>>>>> 
>>>>>>>>>>>    facesContext.addMessage("username", message);
>>>>>>>>>>> 
>>>>>>>>>>>    username = "";
>>>>>>>>>>>    password = "";
>>>>>>>>>>> 
>>>>>>>>>>>    return ("error");
>>>>>>>>>>> 
>>>>>>>>>>> }
>>>>>>>>>>> As you can see I sleep the thread to simulate the operations
>>>>>>>>>>> 
>>>>>>>>>> needed
>>>> 
>>>>> to
>>>>> 
>>>>>> log
>>>>>>>>>> 
>>>>>>>>>>> in the user, for now I'm only getting the token. After that I'll
>>>>>>>>>>> 
>>>>>>>>>> fetch
>>>>> 
>>>>>> the
>>>>>>>>>> 
>>>>>>>>>>> project, data etc...
>>>>>>>>>>> 
>>>>>>>>>>> So I wanted the pollText to apear  dynmically in the status
>>>>>>>>>>> 
>>>>>>>>>> indicator,
>>>>> 
>>>>>> but
>>>>>>>>>> 
>>>>>>>>>>> can get it to update,.
>>>>>>>>>>> 
>>>>>>>>>>> Any tips?
>>>>>>>>>>> 
>>>>>>>>>>> cheers, Håkon
>>>>>>>>>>> 
>>>>>>>>>>> On 1 March 2011 23:23, Scott O'Bryan<da...@gmail.com>  wrote:
>>>>>>>>>>> 
>>>>>>>>>>> I see no reason why this wouldn't work..  What specifically is
>>>>>>>>>>>> 
>>>>>>>>>>> failing
>>>>> 
>>>>>> for you and perhaps a code snipi might help me visualize your
>>>>>>>>>>>> 
>>>>>>>>>>> issue.
>>>>> 
>>>>>> On Mar 1, 2011, at 3:04 PM, "Håkon Sagehaug"<
>>>>>>>>>>>> 
>>>>>>>>>>> hakon.sagehaug@uni.no>
>>>>> 
>>>>>> wrote:
>>>>>>>>>>>> 
>>>>>>>>>>>> Hi all,
>>>>>>>>>>>>> 
>>>>>>>>>>>>> I've just stared using Trinidad and myFaces, and had a question.
>>>>>>>>>>>>> 
>>>>>>>>>>>> I'm
>>>>> 
>>>>>> implementing a login in page for uses, and wanted to use the
>>>>>>>>>>>>> statusIndicator, to give back messages for the user like
>>>>>>>>>>>>> 
>>>>>>>>>>>>> 1. Got user information
>>>>>>>>>>>>> 2. Loading datasets
>>>>>>>>>>>>> 3. Logged in
>>>>>>>>>>>>> 
>>>>>>>>>>>>> And tried to have a  tr:outputText within the statusIndicator.
>>>>>>>>>>>>> 
>>>>>>>>>>>> The
>>>> 
>>>>> value
>>>>>>>>>>> 
>>>>>>>>>>>> for
>>>>>>>>>>>> 
>>>>>>>>>>>>> the outPuttext would be linked to a backing bean, but I was not
>>>>>>>>>>>>> 
>>>>>>>>>>>> very
>>>>> 
>>>>>> successful, do you have any other tips?
>>>>>>>>>>>>> 
>>>>>>>>>>>>> I guess one can use the progressIndicator, but I would like text
>>>>>>>>>>>>> 
>>>>>>>>>>>> to
>>>>> 
>>>>>> be
>>>>>>>>>> 
>>>>>>>>>>> returned not a procentage progress.
>>>>>>>>>>>>> 
>>>>>>>>>>>>> cheers, Håkon
>>>>>>>>>>>>> 
>>>>>>>>>>>> 
>> 

Re: Using statusIndicator

Posted by Scott O'Bryan <da...@gmail.com>.
Hakon,

Maybe your usecase wasn't clear to me.  You expect to change the
button in response to a button click right?  Or are you truly looking
to update the value at an arbitrary time when the bean changes.

If the latter, your talking a much more complex system.  You need,
essentially, some sort of sever push or, as Richard suggested, a poll
component.

Some renderkits like Oracle's ADFFaces have active data and streaming
requests that use legacy app-server API's to stream changing content,
but these are not built into Trinidad and not consistently available
since they are extensions to the current servlet spec.

Scott

On Mar 4, 2011, at 2:35 AM, "Håkon Sagehaug" <ha...@uni.no> wrote:

> Hi
>
> I put the form in various places, but I could not get the wanted effect.
> Just curious, since this is an update of a value on the server side. The
> clients somehow needs to know if the value have changed or not.  I guess
> this is somewhere referred to as server push. My impression of the
> partialTriggers is that an action is taken on the client side, and then
> something is triggered on the client side.
> So in my case the the value form the backing bean id read, but only when the
> button is clicked, not the hole "login session". Is this correct? I guess
> what to me sounds correct is to have some sort of value change listener on
> the value for the output text, but I guess that's more for input text etc
>
> Did this make sense?
>
> Cheers, Håkon
>
>
> On 3 March 2011 18:18, Scott O'Bryan <da...@gmail.com> wrote:
>
>> Hakkon, put the form around everything and see if it changes the PPR
>>
>>
>>
>> On 03/03/2011 10:00 AM, Richard Yee wrote:
>>
>>> what is the initial value of pollText in your backing bean? If it is "",
>>> you
>>> should set it to something else, ie. "Processing".
>>>
>>> The outputText inside statusIndicator will only show during the time the
>>> Ajax request is being made. Once the response is returned, it will
>>> disappear.
>>>
>>> -Richard
>>>
>>>
>>>
>>> 2011/3/3 Håkon Sagehaug<ha...@uni.no>
>>>
>>> Hi
>>>>
>>>> I now have my login page like this
>>>>
>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
>>>> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
>>>> <html xmlns="http://www.w3.org/1999/xhtml"
>>>>   xmlns:f="http://java.sun.com/jsf/core"
>>>>   xmlns:h="http://java.sun.com/jsf/html"
>>>>   xmlns:tr="http://myfaces.apache.org/trinidad">
>>>>
>>>> <f:view>
>>>>   <tr:document title="eSysbio-myFaces-Trinidad">
>>>>
>>>>       <tr:panelPage>
>>>>           <f:facet name="infoStatus">
>>>>               <tr:legend name="required" />
>>>>           </f:facet>
>>>>           <tr:form>
>>>>               <h:panelGrid colums="2">
>>>>                   <tr:outputLabel value="Username" />
>>>>                   <tr:inputText id="username"
>>>> value="#{helloWorldBacking.username}"
>>>>                       required="true" />
>>>>                   <tr:outputLabel value="Password" />
>>>>                   <tr:inputText id="password"
>>>> value="#{helloWorldBacking.password}"
>>>>                       required="true" secret="true" />
>>>>
>>>>               </h:panelGrid>
>>>>               <tr:commandButton id="loginButton" text="Login"
>>>> partialSubmit="true"
>>>>                   actionListener="#{helloWorldBacking.send}" />
>>>>
>>>>
>>>>               <!--
>>>>               <tr:statusIndicator>
>>>>                   <tr:outputText value="#{helloWorldBacking.pollText}"
>>>> />
>>>>               </tr:statusIndicator>
>>>>                -->
>>>>               <tr:outputText value="#{helloWorldBacking.pollText}"
>>>>                   partialTriggers="loginButton" />
>>>>           </tr:form>
>>>>       </tr:panelPage>
>>>>
>>>>   </tr:document>
>>>> </f:view>
>>>> </html>
>>>>
>>>> But then I got nothing in the outPutText field. Any other hint/tips or
>>>> tricks. I really appreciate the help
>>>>
>>>> Cheers, Håkon
>>>>
>>>> On 3 March 2011 17:25, Scott O'Bryan<da...@gmail.com>  wrote:
>>>>
>>>> That doesn't seem to make any sense to me Richard.  The poll component
>>>>> does not replace statusIndicator, they simply do two different things.
>>>>> The purpose of the poll component is to initiate a request based on a
>>>>> clock instead of a user click.  You still need some way to display the
>>>>> information..
>>>>>
>>>>> Hakon,
>>>>>
>>>>> The partial trigger in this case should be on the output text although
>>>>> having it on the status indicator should also work (you'll just get a
>>>>> larger payload).
>>>>>
>>>>> Try this.  Remove the status indicator and only have the output text.
>>>>> Make sure your outputText is located inside the form (possible your
>>>>> getting a scoping issue).
>>>>>
>>>>> Does that work?  It should.
>>>>>
>>>>> On Mar 3, 2011, at 9:06 AM, Richard Yee<ri...@gmail.com>
>>>>> wrote:
>>>>>
>>>>> You don't want statusIndicator, use tr:poll instead
>>>>>>
>>>>>> Richard
>>>>>>
>>>>>> Sent from my iPhone
>>>>>>
>>>>>> On Mar 3, 2011, at 7:48 AM, Håkon Sagehaug<ha...@uni.no>
>>>>>>
>>>>> wrote:
>>>>>
>>>>>> Hi
>>>>>>>
>>>>>>> Yes, that was an old cut and past mistake, I've got loginButton as id
>>>>>>>
>>>>>> for
>>>>>
>>>>>> the button. The latest test are with loginButton, not button2. So this
>>>>>>>
>>>>>> way
>>>>>
>>>>>> of doing it should normally work?
>>>>>>>
>>>>>>> cheers, Håkon
>>>>>>>
>>>>>>> On 3 March 2011 16:35, Scott O'Bryan<da...@gmail.com>  wrote:
>>>>>>>
>>>>>>> Umm.  Considering the id of your button is button2, I'm not sure why
>>>>>>>> your partialTrigger is loginButton.  Can you explain?
>>>>>>>>
>>>>>>>> On Mar 3, 2011, at 6:46 AM, "Håkon Sagehaug"<ha...@uni.no>
>>>>>>>> wrote:
>>>>>>>>
>>>>>>>> Hi all,
>>>>>>>>>
>>>>>>>>> I might not get the full point here ;). Here is what I tried, put
>>>>>>>>>
>>>>>>>> trigger
>>>>>
>>>>>> on
>>>>>>>>
>>>>>>>>> the statusIndicator like here
>>>>>>>>>
>>>>>>>>> <tr:statusIndicator partialTriggers="loginButton">
>>>>>>>>>                 <f:facet name="busy">
>>>>>>>>>                     <tr:outputText
>>>>>>>>>
>>>>>>>> value="#{helloWorldBacking.pollText}"
>>>>>>>>
>>>>>>>>> />
>>>>>>>>>                 </f:facet>
>>>>>>>>>             </tr:statusIndicator>
>>>>>>>>>
>>>>>>>>> And on the outputText like here
>>>>>>>>>
>>>>>>>>> <tr:statusIndicator partialTriggers="loginButton">
>>>>>>>>>                 <f:facet name="busy">
>>>>>>>>>                     <tr:outputText
>>>>>>>>>
>>>>>>>> value="#{helloWorldBacking.pollText}"
>>>>>>>>
>>>>>>>>> partialTriggers="loginButton"/>
>>>>>>>>>                 </f:facet>
>>>>>>>>>             </tr:statusIndicator>
>>>>>>>>>
>>>>>>>>> Where loginButton is
>>>>>>>>>
>>>>>>>>> <tr:commandButton id="button2" text="Login" partialSubmit="true"/>
>>>>>>>>>
>>>>>>>>> But nothing seems to have the wanted effect. I looks like it picks
>>>>>>>>>
>>>>>>>> up
>>>>
>>>>> the
>>>>>
>>>>>> initial value for the helloWorldBacking.pollText, but when this
>>>>>>>>>
>>>>>>>> value
>>>>
>>>>> changes it's it not propagated in the UI. Maybe this can't be done
>>>>>>>>>
>>>>>>>> like
>>>>>
>>>>>> I've
>>>>>>>>
>>>>>>>>> sketched out. The backing code is the same as sent in a earlier
>>>>>>>>>
>>>>>>>> email.
>>>>
>>>>> Other tips?
>>>>>>>>>
>>>>>>>>> Cheers, Håkon
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On 3 March 2011 05:23, Richard Yee<ri...@gmail.com>  wrote:
>>>>>>>>>
>>>>>>>>> Try putting it inside the tr:form or inside your panelPage
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> -Richard
>>>>>>>>>>
>>>>>>>>>> 2011/3/1 Håkon Sagehaug<ha...@uni.no>
>>>>>>>>>>
>>>>>>>>>> Hi
>>>>>>>>>>>
>>>>>>>>>>> Thanks for the reply, here is my xhtml, with a simple login form
>>>>>>>>>>>
>>>>>>>>>>> <tr:document title="Login Demo">
>>>>>>>>>>>    <tr:statusIndicator>
>>>>>>>>>>>        <f:facet name="busy">
>>>>>>>>>>>            <tr:outputText value="#{helloWorldBacking.pollText}"
>>>>>>>>>>>
>>>>>>>>>> />
>>>>
>>>>>        </f:facet>
>>>>>>>>>>>    </tr:statusIndicator>
>>>>>>>>>>>    <tr:form>
>>>>>>>>>>>
>>>>>>>>>>>        <tr:panelPage>
>>>>>>>>>>>            <f:facet name="infoStatus">
>>>>>>>>>>>                <tr:legend name="required" />
>>>>>>>>>>>            </f:facet>
>>>>>>>>>>>
>>>>>>>>>>>            <tr:inputText label="Username" id="username"
>>>>>>>>>>>                value="#{helloWorldBacking.username}"
>>>>>>>>>>>
>>>>>>>>>> required="true"
>>>>>
>>>>>> />
>>>>>>>>>>
>>>>>>>>>>>            <tr:inputText label="Password" id="password"
>>>>>>>>>>>                value="#{helloWorldBacking.password}"
>>>>>>>>>>>
>>>>>>>>>> required="true"
>>>>>
>>>>>> secret="true" />
>>>>>>>>>>>            <tr:commandButton id="button2" text="Login"
>>>>>>>>>>> partialSubmit="true"
>>>>>>>>>>>                action="#{helloWorldBacking.send}" />
>>>>>>>>>>>        </tr:panelPage>
>>>>>>>>>>>
>>>>>>>>>>>    </tr:form>
>>>>>>>>>>>
>>>>>>>>>>> </tr:document>
>>>>>>>>>>>
>>>>>>>>>>> And parts of the backing bean
>>>>>>>>>>>
>>>>>>>>>>> public String send() {
>>>>>>>>>>>    FacesContext facesContext = FacesContext.getCurrentInstance();
>>>>>>>>>>>
>>>>>>>>>>>    System.out.println("user name " + username + " is logged in "
>>>>>>>>>>>            + userLoggedIn);
>>>>>>>>>>>
>>>>>>>>>>>    try {
>>>>>>>>>>>        Thread.sleep(5000);
>>>>>>>>>>>        Token tok = tokenMgr.getToken(username, password, true);
>>>>>>>>>>>       Thread.sleep(2000);
>>>>>>>>>>>        pollText = "Token fetched";
>>>>>>>>>>>        if (tok != null) {
>>>>>>>>>>>            userLoggedIn = true;
>>>>>>>>>>>            return ("success");
>>>>>>>>>>>        }
>>>>>>>>>>>        username = "";
>>>>>>>>>>>        password = "";
>>>>>>>>>>>    } catch (TrustException e1) {
>>>>>>>>>>>        e1.printStackTrace();
>>>>>>>>>>>    } catch (AxisFault e) {
>>>>>>>>>>>        e.printStackTrace();
>>>>>>>>>>>    } catch (FileNotFoundException e) {
>>>>>>>>>>>        e.printStackTrace();
>>>>>>>>>>>    } catch (XMLStreamException e) {
>>>>>>>>>>>        e.printStackTrace();
>>>>>>>>>>>    } catch (InterruptedException e) {
>>>>>>>>>>>
>>>>>>>>>>>        e.printStackTrace();
>>>>>>>>>>>    }
>>>>>>>>>>>    FacesMessage message = new FacesMessage("Login failed");
>>>>>>>>>>>
>>>>>>>>>>>    facesContext.addMessage("username", message);
>>>>>>>>>>>
>>>>>>>>>>>    username = "";
>>>>>>>>>>>    password = "";
>>>>>>>>>>>
>>>>>>>>>>>    return ("error");
>>>>>>>>>>>
>>>>>>>>>>> }
>>>>>>>>>>> As you can see I sleep the thread to simulate the operations
>>>>>>>>>>>
>>>>>>>>>> needed
>>>>
>>>>> to
>>>>>
>>>>>> log
>>>>>>>>>>
>>>>>>>>>>> in the user, for now I'm only getting the token. After that I'll
>>>>>>>>>>>
>>>>>>>>>> fetch
>>>>>
>>>>>> the
>>>>>>>>>>
>>>>>>>>>>> project, data etc...
>>>>>>>>>>>
>>>>>>>>>>> So I wanted the pollText to apear  dynmically in the status
>>>>>>>>>>>
>>>>>>>>>> indicator,
>>>>>
>>>>>> but
>>>>>>>>>>
>>>>>>>>>>> can get it to update,.
>>>>>>>>>>>
>>>>>>>>>>> Any tips?
>>>>>>>>>>>
>>>>>>>>>>> cheers, Håkon
>>>>>>>>>>>
>>>>>>>>>>> On 1 March 2011 23:23, Scott O'Bryan<da...@gmail.com>  wrote:
>>>>>>>>>>>
>>>>>>>>>>> I see no reason why this wouldn't work..  What specifically is
>>>>>>>>>>>>
>>>>>>>>>>> failing
>>>>>
>>>>>> for you and perhaps a code snipi might help me visualize your
>>>>>>>>>>>>
>>>>>>>>>>> issue.
>>>>>
>>>>>> On Mar 1, 2011, at 3:04 PM, "Håkon Sagehaug"<
>>>>>>>>>>>>
>>>>>>>>>>> hakon.sagehaug@uni.no>
>>>>>
>>>>>> wrote:
>>>>>>>>>>>>
>>>>>>>>>>>> Hi all,
>>>>>>>>>>>>>
>>>>>>>>>>>>> I've just stared using Trinidad and myFaces, and had a question.
>>>>>>>>>>>>>
>>>>>>>>>>>> I'm
>>>>>
>>>>>> implementing a login in page for uses, and wanted to use the
>>>>>>>>>>>>> statusIndicator, to give back messages for the user like
>>>>>>>>>>>>>
>>>>>>>>>>>>> 1. Got user information
>>>>>>>>>>>>> 2. Loading datasets
>>>>>>>>>>>>> 3. Logged in
>>>>>>>>>>>>>
>>>>>>>>>>>>> And tried to have a  tr:outputText within the statusIndicator.
>>>>>>>>>>>>>
>>>>>>>>>>>> The
>>>>
>>>>> value
>>>>>>>>>>>
>>>>>>>>>>>> for
>>>>>>>>>>>>
>>>>>>>>>>>>> the outPuttext would be linked to a backing bean, but I was not
>>>>>>>>>>>>>
>>>>>>>>>>>> very
>>>>>
>>>>>> successful, do you have any other tips?
>>>>>>>>>>>>>
>>>>>>>>>>>>> I guess one can use the progressIndicator, but I would like text
>>>>>>>>>>>>>
>>>>>>>>>>>> to
>>>>>
>>>>>> be
>>>>>>>>>>
>>>>>>>>>>> returned not a procentage progress.
>>>>>>>>>>>>>
>>>>>>>>>>>>> cheers, Håkon
>>>>>>>>>>>>>
>>>>>>>>>>>>
>>

Re: Using statusIndicator

Posted by Håkon Sagehaug <ha...@uni.no>.
Hi

I put the form in various places, but I could not get the wanted effect.
Just curious, since this is an update of a value on the server side. The
clients somehow needs to know if the value have changed or not.  I guess
this is somewhere referred to as server push. My impression of the
partialTriggers is that an action is taken on the client side, and then
something is triggered on the client side.
So in my case the the value form the backing bean id read, but only when the
button is clicked, not the hole "login session". Is this correct? I guess
what to me sounds correct is to have some sort of value change listener on
the value for the output text, but I guess that's more for input text etc

Did this make sense?

Cheers, Håkon


On 3 March 2011 18:18, Scott O'Bryan <da...@gmail.com> wrote:

> Hakkon, put the form around everything and see if it changes the PPR
>
>
>
> On 03/03/2011 10:00 AM, Richard Yee wrote:
>
>> what is the initial value of pollText in your backing bean? If it is "",
>> you
>> should set it to something else, ie. "Processing".
>>
>> The outputText inside statusIndicator will only show during the time the
>> Ajax request is being made. Once the response is returned, it will
>> disappear.
>>
>> -Richard
>>
>>
>>
>> 2011/3/3 Håkon Sagehaug<ha...@uni.no>
>>
>>  Hi
>>>
>>> I now have my login page like this
>>>
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
>>> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
>>> <html xmlns="http://www.w3.org/1999/xhtml"
>>>    xmlns:f="http://java.sun.com/jsf/core"
>>>    xmlns:h="http://java.sun.com/jsf/html"
>>>    xmlns:tr="http://myfaces.apache.org/trinidad">
>>>
>>> <f:view>
>>>    <tr:document title="eSysbio-myFaces-Trinidad">
>>>
>>>        <tr:panelPage>
>>>            <f:facet name="infoStatus">
>>>                <tr:legend name="required" />
>>>            </f:facet>
>>>            <tr:form>
>>>                <h:panelGrid colums="2">
>>>                    <tr:outputLabel value="Username" />
>>>                    <tr:inputText id="username"
>>> value="#{helloWorldBacking.username}"
>>>                        required="true" />
>>>                    <tr:outputLabel value="Password" />
>>>                    <tr:inputText id="password"
>>> value="#{helloWorldBacking.password}"
>>>                        required="true" secret="true" />
>>>
>>>                </h:panelGrid>
>>>                <tr:commandButton id="loginButton" text="Login"
>>> partialSubmit="true"
>>>                    actionListener="#{helloWorldBacking.send}" />
>>>
>>>
>>>                <!--
>>>                <tr:statusIndicator>
>>>                    <tr:outputText value="#{helloWorldBacking.pollText}"
>>> />
>>>                </tr:statusIndicator>
>>>                 -->
>>>                <tr:outputText value="#{helloWorldBacking.pollText}"
>>>                    partialTriggers="loginButton" />
>>>            </tr:form>
>>>        </tr:panelPage>
>>>
>>>    </tr:document>
>>> </f:view>
>>> </html>
>>>
>>> But then I got nothing in the outPutText field. Any other hint/tips or
>>> tricks. I really appreciate the help
>>>
>>> Cheers, Håkon
>>>
>>> On 3 March 2011 17:25, Scott O'Bryan<da...@gmail.com>  wrote:
>>>
>>>  That doesn't seem to make any sense to me Richard.  The poll component
>>>> does not replace statusIndicator, they simply do two different things.
>>>>  The purpose of the poll component is to initiate a request based on a
>>>> clock instead of a user click.  You still need some way to display the
>>>> information..
>>>>
>>>> Hakon,
>>>>
>>>> The partial trigger in this case should be on the output text although
>>>> having it on the status indicator should also work (you'll just get a
>>>> larger payload).
>>>>
>>>> Try this.  Remove the status indicator and only have the output text.
>>>> Make sure your outputText is located inside the form (possible your
>>>> getting a scoping issue).
>>>>
>>>> Does that work?  It should.
>>>>
>>>> On Mar 3, 2011, at 9:06 AM, Richard Yee<ri...@gmail.com>
>>>>  wrote:
>>>>
>>>>  You don't want statusIndicator, use tr:poll instead
>>>>>
>>>>> Richard
>>>>>
>>>>> Sent from my iPhone
>>>>>
>>>>> On Mar 3, 2011, at 7:48 AM, Håkon Sagehaug<ha...@uni.no>
>>>>>
>>>> wrote:
>>>>
>>>>> Hi
>>>>>>
>>>>>> Yes, that was an old cut and past mistake, I've got loginButton as id
>>>>>>
>>>>> for
>>>>
>>>>> the button. The latest test are with loginButton, not button2. So this
>>>>>>
>>>>> way
>>>>
>>>>> of doing it should normally work?
>>>>>>
>>>>>> cheers, Håkon
>>>>>>
>>>>>> On 3 March 2011 16:35, Scott O'Bryan<da...@gmail.com>  wrote:
>>>>>>
>>>>>>  Umm.  Considering the id of your button is button2, I'm not sure why
>>>>>>> your partialTrigger is loginButton.  Can you explain?
>>>>>>>
>>>>>>> On Mar 3, 2011, at 6:46 AM, "Håkon Sagehaug"<ha...@uni.no>
>>>>>>> wrote:
>>>>>>>
>>>>>>>  Hi all,
>>>>>>>>
>>>>>>>> I might not get the full point here ;). Here is what I tried, put
>>>>>>>>
>>>>>>> trigger
>>>>
>>>>> on
>>>>>>>
>>>>>>>> the statusIndicator like here
>>>>>>>>
>>>>>>>> <tr:statusIndicator partialTriggers="loginButton">
>>>>>>>>                  <f:facet name="busy">
>>>>>>>>                      <tr:outputText
>>>>>>>>
>>>>>>> value="#{helloWorldBacking.pollText}"
>>>>>>>
>>>>>>>> />
>>>>>>>>                  </f:facet>
>>>>>>>>              </tr:statusIndicator>
>>>>>>>>
>>>>>>>> And on the outputText like here
>>>>>>>>
>>>>>>>> <tr:statusIndicator partialTriggers="loginButton">
>>>>>>>>                  <f:facet name="busy">
>>>>>>>>                      <tr:outputText
>>>>>>>>
>>>>>>> value="#{helloWorldBacking.pollText}"
>>>>>>>
>>>>>>>> partialTriggers="loginButton"/>
>>>>>>>>                  </f:facet>
>>>>>>>>              </tr:statusIndicator>
>>>>>>>>
>>>>>>>> Where loginButton is
>>>>>>>>
>>>>>>>> <tr:commandButton id="button2" text="Login" partialSubmit="true"/>
>>>>>>>>
>>>>>>>> But nothing seems to have the wanted effect. I looks like it picks
>>>>>>>>
>>>>>>> up
>>>
>>>> the
>>>>
>>>>> initial value for the helloWorldBacking.pollText, but when this
>>>>>>>>
>>>>>>> value
>>>
>>>> changes it's it not propagated in the UI. Maybe this can't be done
>>>>>>>>
>>>>>>> like
>>>>
>>>>> I've
>>>>>>>
>>>>>>>> sketched out. The backing code is the same as sent in a earlier
>>>>>>>>
>>>>>>> email.
>>>
>>>> Other tips?
>>>>>>>>
>>>>>>>> Cheers, Håkon
>>>>>>>>
>>>>>>>>
>>>>>>>> On 3 March 2011 05:23, Richard Yee<ri...@gmail.com>  wrote:
>>>>>>>>
>>>>>>>>  Try putting it inside the tr:form or inside your panelPage
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> -Richard
>>>>>>>>>
>>>>>>>>> 2011/3/1 Håkon Sagehaug<ha...@uni.no>
>>>>>>>>>
>>>>>>>>>  Hi
>>>>>>>>>>
>>>>>>>>>> Thanks for the reply, here is my xhtml, with a simple login form
>>>>>>>>>>
>>>>>>>>>> <tr:document title="Login Demo">
>>>>>>>>>>     <tr:statusIndicator>
>>>>>>>>>>         <f:facet name="busy">
>>>>>>>>>>             <tr:outputText value="#{helloWorldBacking.pollText}"
>>>>>>>>>>
>>>>>>>>> />
>>>
>>>>         </f:facet>
>>>>>>>>>>     </tr:statusIndicator>
>>>>>>>>>>     <tr:form>
>>>>>>>>>>
>>>>>>>>>>         <tr:panelPage>
>>>>>>>>>>             <f:facet name="infoStatus">
>>>>>>>>>>                 <tr:legend name="required" />
>>>>>>>>>>             </f:facet>
>>>>>>>>>>
>>>>>>>>>>             <tr:inputText label="Username" id="username"
>>>>>>>>>>                 value="#{helloWorldBacking.username}"
>>>>>>>>>>
>>>>>>>>> required="true"
>>>>
>>>>> />
>>>>>>>>>
>>>>>>>>>>             <tr:inputText label="Password" id="password"
>>>>>>>>>>                 value="#{helloWorldBacking.password}"
>>>>>>>>>>
>>>>>>>>> required="true"
>>>>
>>>>> secret="true" />
>>>>>>>>>>             <tr:commandButton id="button2" text="Login"
>>>>>>>>>> partialSubmit="true"
>>>>>>>>>>                 action="#{helloWorldBacking.send}" />
>>>>>>>>>>         </tr:panelPage>
>>>>>>>>>>
>>>>>>>>>>     </tr:form>
>>>>>>>>>>
>>>>>>>>>> </tr:document>
>>>>>>>>>>
>>>>>>>>>> And parts of the backing bean
>>>>>>>>>>
>>>>>>>>>> public String send() {
>>>>>>>>>>     FacesContext facesContext = FacesContext.getCurrentInstance();
>>>>>>>>>>
>>>>>>>>>>     System.out.println("user name " + username + " is logged in "
>>>>>>>>>>             + userLoggedIn);
>>>>>>>>>>
>>>>>>>>>>     try {
>>>>>>>>>>         Thread.sleep(5000);
>>>>>>>>>>         Token tok = tokenMgr.getToken(username, password, true);
>>>>>>>>>>        Thread.sleep(2000);
>>>>>>>>>>         pollText = "Token fetched";
>>>>>>>>>>         if (tok != null) {
>>>>>>>>>>             userLoggedIn = true;
>>>>>>>>>>             return ("success");
>>>>>>>>>>         }
>>>>>>>>>>         username = "";
>>>>>>>>>>         password = "";
>>>>>>>>>>     } catch (TrustException e1) {
>>>>>>>>>>         e1.printStackTrace();
>>>>>>>>>>     } catch (AxisFault e) {
>>>>>>>>>>         e.printStackTrace();
>>>>>>>>>>     } catch (FileNotFoundException e) {
>>>>>>>>>>         e.printStackTrace();
>>>>>>>>>>     } catch (XMLStreamException e) {
>>>>>>>>>>         e.printStackTrace();
>>>>>>>>>>     } catch (InterruptedException e) {
>>>>>>>>>>
>>>>>>>>>>         e.printStackTrace();
>>>>>>>>>>     }
>>>>>>>>>>     FacesMessage message = new FacesMessage("Login failed");
>>>>>>>>>>
>>>>>>>>>>     facesContext.addMessage("username", message);
>>>>>>>>>>
>>>>>>>>>>     username = "";
>>>>>>>>>>     password = "";
>>>>>>>>>>
>>>>>>>>>>     return ("error");
>>>>>>>>>>
>>>>>>>>>> }
>>>>>>>>>> As you can see I sleep the thread to simulate the operations
>>>>>>>>>>
>>>>>>>>> needed
>>>
>>>> to
>>>>
>>>>> log
>>>>>>>>>
>>>>>>>>>> in the user, for now I'm only getting the token. After that I'll
>>>>>>>>>>
>>>>>>>>> fetch
>>>>
>>>>> the
>>>>>>>>>
>>>>>>>>>> project, data etc...
>>>>>>>>>>
>>>>>>>>>> So I wanted the pollText to apear  dynmically in the status
>>>>>>>>>>
>>>>>>>>> indicator,
>>>>
>>>>> but
>>>>>>>>>
>>>>>>>>>> can get it to update,.
>>>>>>>>>>
>>>>>>>>>> Any tips?
>>>>>>>>>>
>>>>>>>>>> cheers, Håkon
>>>>>>>>>>
>>>>>>>>>> On 1 March 2011 23:23, Scott O'Bryan<da...@gmail.com>  wrote:
>>>>>>>>>>
>>>>>>>>>>  I see no reason why this wouldn't work..  What specifically is
>>>>>>>>>>>
>>>>>>>>>> failing
>>>>
>>>>> for you and perhaps a code snipi might help me visualize your
>>>>>>>>>>>
>>>>>>>>>> issue.
>>>>
>>>>> On Mar 1, 2011, at 3:04 PM, "Håkon Sagehaug"<
>>>>>>>>>>>
>>>>>>>>>> hakon.sagehaug@uni.no>
>>>>
>>>>> wrote:
>>>>>>>>>>>
>>>>>>>>>>>  Hi all,
>>>>>>>>>>>>
>>>>>>>>>>>> I've just stared using Trinidad and myFaces, and had a question.
>>>>>>>>>>>>
>>>>>>>>>>> I'm
>>>>
>>>>> implementing a login in page for uses, and wanted to use the
>>>>>>>>>>>> statusIndicator, to give back messages for the user like
>>>>>>>>>>>>
>>>>>>>>>>>> 1. Got user information
>>>>>>>>>>>> 2. Loading datasets
>>>>>>>>>>>> 3. Logged in
>>>>>>>>>>>>
>>>>>>>>>>>> And tried to have a  tr:outputText within the statusIndicator.
>>>>>>>>>>>>
>>>>>>>>>>> The
>>>
>>>> value
>>>>>>>>>>
>>>>>>>>>>> for
>>>>>>>>>>>
>>>>>>>>>>>> the outPuttext would be linked to a backing bean, but I was not
>>>>>>>>>>>>
>>>>>>>>>>> very
>>>>
>>>>> successful, do you have any other tips?
>>>>>>>>>>>>
>>>>>>>>>>>> I guess one can use the progressIndicator, but I would like text
>>>>>>>>>>>>
>>>>>>>>>>> to
>>>>
>>>>> be
>>>>>>>>>
>>>>>>>>>> returned not a procentage progress.
>>>>>>>>>>>>
>>>>>>>>>>>> cheers, Håkon
>>>>>>>>>>>>
>>>>>>>>>>>
>

Re: Using statusIndicator

Posted by Scott O'Bryan <da...@gmail.com>.
Hakkon, put the form around everything and see if it changes the PPR


On 03/03/2011 10:00 AM, Richard Yee wrote:
> what is the initial value of pollText in your backing bean? If it is "", you
> should set it to something else, ie. "Processing".
>
> The outputText inside statusIndicator will only show during the time the
> Ajax request is being made. Once the response is returned, it will
> disappear.
>
> -Richard
>
>
>
> 2011/3/3 Håkon Sagehaug<ha...@uni.no>
>
>> Hi
>>
>> I now have my login page like this
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
>> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
>> <html xmlns="http://www.w3.org/1999/xhtml"
>>     xmlns:f="http://java.sun.com/jsf/core"
>>     xmlns:h="http://java.sun.com/jsf/html"
>>     xmlns:tr="http://myfaces.apache.org/trinidad">
>>
>> <f:view>
>>     <tr:document title="eSysbio-myFaces-Trinidad">
>>
>>         <tr:panelPage>
>>             <f:facet name="infoStatus">
>>                 <tr:legend name="required" />
>>             </f:facet>
>>             <tr:form>
>>                 <h:panelGrid colums="2">
>>                     <tr:outputLabel value="Username" />
>>                     <tr:inputText id="username"
>> value="#{helloWorldBacking.username}"
>>                         required="true" />
>>                     <tr:outputLabel value="Password" />
>>                     <tr:inputText id="password"
>> value="#{helloWorldBacking.password}"
>>                         required="true" secret="true" />
>>
>>                 </h:panelGrid>
>>                 <tr:commandButton id="loginButton" text="Login"
>> partialSubmit="true"
>>                     actionListener="#{helloWorldBacking.send}" />
>>
>>
>>                 <!--
>>                 <tr:statusIndicator>
>>                     <tr:outputText value="#{helloWorldBacking.pollText}" />
>>                 </tr:statusIndicator>
>>                  -->
>>                 <tr:outputText value="#{helloWorldBacking.pollText}"
>>                     partialTriggers="loginButton" />
>>             </tr:form>
>>         </tr:panelPage>
>>
>>     </tr:document>
>> </f:view>
>> </html>
>>
>> But then I got nothing in the outPutText field. Any other hint/tips or
>> tricks. I really appreciate the help
>>
>> Cheers, Håkon
>>
>> On 3 March 2011 17:25, Scott O'Bryan<da...@gmail.com>  wrote:
>>
>>> That doesn't seem to make any sense to me Richard.  The poll component
>>> does not replace statusIndicator, they simply do two different things.
>>>   The purpose of the poll component is to initiate a request based on a
>>> clock instead of a user click.  You still need some way to display the
>>> information..
>>>
>>> Hakon,
>>>
>>> The partial trigger in this case should be on the output text although
>>> having it on the status indicator should also work (you'll just get a
>>> larger payload).
>>>
>>> Try this.  Remove the status indicator and only have the output text.
>>> Make sure your outputText is located inside the form (possible your
>>> getting a scoping issue).
>>>
>>> Does that work?  It should.
>>>
>>> On Mar 3, 2011, at 9:06 AM, Richard Yee<ri...@gmail.com>  wrote:
>>>
>>>> You don't want statusIndicator, use tr:poll instead
>>>>
>>>> Richard
>>>>
>>>> Sent from my iPhone
>>>>
>>>> On Mar 3, 2011, at 7:48 AM, Håkon Sagehaug<ha...@uni.no>
>>> wrote:
>>>>> Hi
>>>>>
>>>>> Yes, that was an old cut and past mistake, I've got loginButton as id
>>> for
>>>>> the button. The latest test are with loginButton, not button2. So this
>>> way
>>>>> of doing it should normally work?
>>>>>
>>>>> cheers, Håkon
>>>>>
>>>>> On 3 March 2011 16:35, Scott O'Bryan<da...@gmail.com>  wrote:
>>>>>
>>>>>> Umm.  Considering the id of your button is button2, I'm not sure why
>>>>>> your partialTrigger is loginButton.  Can you explain?
>>>>>>
>>>>>> On Mar 3, 2011, at 6:46 AM, "Håkon Sagehaug"<ha...@uni.no>
>>>>>> wrote:
>>>>>>
>>>>>>> Hi all,
>>>>>>>
>>>>>>> I might not get the full point here ;). Here is what I tried, put
>>> trigger
>>>>>> on
>>>>>>> the statusIndicator like here
>>>>>>>
>>>>>>> <tr:statusIndicator partialTriggers="loginButton">
>>>>>>>                   <f:facet name="busy">
>>>>>>>                       <tr:outputText
>>>>>> value="#{helloWorldBacking.pollText}"
>>>>>>> />
>>>>>>>                   </f:facet>
>>>>>>>               </tr:statusIndicator>
>>>>>>>
>>>>>>> And on the outputText like here
>>>>>>>
>>>>>>> <tr:statusIndicator partialTriggers="loginButton">
>>>>>>>                   <f:facet name="busy">
>>>>>>>                       <tr:outputText
>>>>>> value="#{helloWorldBacking.pollText}"
>>>>>>> partialTriggers="loginButton"/>
>>>>>>>                   </f:facet>
>>>>>>>               </tr:statusIndicator>
>>>>>>>
>>>>>>> Where loginButton is
>>>>>>>
>>>>>>> <tr:commandButton id="button2" text="Login" partialSubmit="true"/>
>>>>>>>
>>>>>>> But nothing seems to have the wanted effect. I looks like it picks
>> up
>>> the
>>>>>>> initial value for the helloWorldBacking.pollText, but when this
>> value
>>>>>>> changes it's it not propagated in the UI. Maybe this can't be done
>>> like
>>>>>> I've
>>>>>>> sketched out. The backing code is the same as sent in a earlier
>> email.
>>>>>>> Other tips?
>>>>>>>
>>>>>>> Cheers, Håkon
>>>>>>>
>>>>>>>
>>>>>>> On 3 March 2011 05:23, Richard Yee<ri...@gmail.com>  wrote:
>>>>>>>
>>>>>>>> Try putting it inside the tr:form or inside your panelPage
>>>>>>>>
>>>>>>>>
>>>>>>>> -Richard
>>>>>>>>
>>>>>>>> 2011/3/1 Håkon Sagehaug<ha...@uni.no>
>>>>>>>>
>>>>>>>>> Hi
>>>>>>>>>
>>>>>>>>> Thanks for the reply, here is my xhtml, with a simple login form
>>>>>>>>>
>>>>>>>>> <tr:document title="Login Demo">
>>>>>>>>>      <tr:statusIndicator>
>>>>>>>>>          <f:facet name="busy">
>>>>>>>>>              <tr:outputText value="#{helloWorldBacking.pollText}"
>> />
>>>>>>>>>          </f:facet>
>>>>>>>>>      </tr:statusIndicator>
>>>>>>>>>      <tr:form>
>>>>>>>>>
>>>>>>>>>          <tr:panelPage>
>>>>>>>>>              <f:facet name="infoStatus">
>>>>>>>>>                  <tr:legend name="required" />
>>>>>>>>>              </f:facet>
>>>>>>>>>
>>>>>>>>>              <tr:inputText label="Username" id="username"
>>>>>>>>>                  value="#{helloWorldBacking.username}"
>>> required="true"
>>>>>>>> />
>>>>>>>>>              <tr:inputText label="Password" id="password"
>>>>>>>>>                  value="#{helloWorldBacking.password}"
>>> required="true"
>>>>>>>>> secret="true" />
>>>>>>>>>              <tr:commandButton id="button2" text="Login"
>>>>>>>>> partialSubmit="true"
>>>>>>>>>                  action="#{helloWorldBacking.send}" />
>>>>>>>>>          </tr:panelPage>
>>>>>>>>>
>>>>>>>>>      </tr:form>
>>>>>>>>>
>>>>>>>>> </tr:document>
>>>>>>>>>
>>>>>>>>> And parts of the backing bean
>>>>>>>>>
>>>>>>>>> public String send() {
>>>>>>>>>      FacesContext facesContext = FacesContext.getCurrentInstance();
>>>>>>>>>
>>>>>>>>>      System.out.println("user name " + username + " is logged in "
>>>>>>>>>              + userLoggedIn);
>>>>>>>>>
>>>>>>>>>      try {
>>>>>>>>>          Thread.sleep(5000);
>>>>>>>>>          Token tok = tokenMgr.getToken(username, password, true);
>>>>>>>>>         Thread.sleep(2000);
>>>>>>>>>          pollText = "Token fetched";
>>>>>>>>>          if (tok != null) {
>>>>>>>>>              userLoggedIn = true;
>>>>>>>>>              return ("success");
>>>>>>>>>          }
>>>>>>>>>          username = "";
>>>>>>>>>          password = "";
>>>>>>>>>      } catch (TrustException e1) {
>>>>>>>>>          e1.printStackTrace();
>>>>>>>>>      } catch (AxisFault e) {
>>>>>>>>>          e.printStackTrace();
>>>>>>>>>      } catch (FileNotFoundException e) {
>>>>>>>>>          e.printStackTrace();
>>>>>>>>>      } catch (XMLStreamException e) {
>>>>>>>>>          e.printStackTrace();
>>>>>>>>>      } catch (InterruptedException e) {
>>>>>>>>>
>>>>>>>>>          e.printStackTrace();
>>>>>>>>>      }
>>>>>>>>>      FacesMessage message = new FacesMessage("Login failed");
>>>>>>>>>
>>>>>>>>>      facesContext.addMessage("username", message);
>>>>>>>>>
>>>>>>>>>      username = "";
>>>>>>>>>      password = "";
>>>>>>>>>
>>>>>>>>>      return ("error");
>>>>>>>>>
>>>>>>>>> }
>>>>>>>>> As you can see I sleep the thread to simulate the operations
>> needed
>>> to
>>>>>>>> log
>>>>>>>>> in the user, for now I'm only getting the token. After that I'll
>>> fetch
>>>>>>>> the
>>>>>>>>> project, data etc...
>>>>>>>>>
>>>>>>>>> So I wanted the pollText to apear  dynmically in the status
>>> indicator,
>>>>>>>> but
>>>>>>>>> can get it to update,.
>>>>>>>>>
>>>>>>>>> Any tips?
>>>>>>>>>
>>>>>>>>> cheers, Håkon
>>>>>>>>>
>>>>>>>>> On 1 March 2011 23:23, Scott O'Bryan<da...@gmail.com>  wrote:
>>>>>>>>>
>>>>>>>>>> I see no reason why this wouldn't work..  What specifically is
>>> failing
>>>>>>>>>> for you and perhaps a code snipi might help me visualize your
>>> issue.
>>>>>>>>>> On Mar 1, 2011, at 3:04 PM, "Håkon Sagehaug"<
>>> hakon.sagehaug@uni.no>
>>>>>>>>>> wrote:
>>>>>>>>>>
>>>>>>>>>>> Hi all,
>>>>>>>>>>>
>>>>>>>>>>> I've just stared using Trinidad and myFaces, and had a question.
>>> I'm
>>>>>>>>>>> implementing a login in page for uses, and wanted to use the
>>>>>>>>>>> statusIndicator, to give back messages for the user like
>>>>>>>>>>>
>>>>>>>>>>> 1. Got user information
>>>>>>>>>>> 2. Loading datasets
>>>>>>>>>>> 3. Logged in
>>>>>>>>>>>
>>>>>>>>>>> And tried to have a  tr:outputText within the statusIndicator.
>> The
>>>>>>>>> value
>>>>>>>>>> for
>>>>>>>>>>> the outPuttext would be linked to a backing bean, but I was not
>>> very
>>>>>>>>>>> successful, do you have any other tips?
>>>>>>>>>>>
>>>>>>>>>>> I guess one can use the progressIndicator, but I would like text
>>> to
>>>>>>>> be
>>>>>>>>>>> returned not a procentage progress.
>>>>>>>>>>>
>>>>>>>>>>> cheers, Håkon


Re: Using statusIndicator

Posted by Richard Yee <ri...@gmail.com>.
what is the initial value of pollText in your backing bean? If it is "", you
should set it to something else, ie. "Processing".

The outputText inside statusIndicator will only show during the time the
Ajax request is being made. Once the response is returned, it will
disappear.

-Richard



2011/3/3 Håkon Sagehaug <ha...@uni.no>

> Hi
>
> I now have my login page like this
>
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml"
>    xmlns:f="http://java.sun.com/jsf/core"
>    xmlns:h="http://java.sun.com/jsf/html"
>    xmlns:tr="http://myfaces.apache.org/trinidad">
>
> <f:view>
>    <tr:document title="eSysbio-myFaces-Trinidad">
>
>        <tr:panelPage>
>            <f:facet name="infoStatus">
>                <tr:legend name="required" />
>            </f:facet>
>            <tr:form>
>                <h:panelGrid colums="2">
>                    <tr:outputLabel value="Username" />
>                    <tr:inputText id="username"
> value="#{helloWorldBacking.username}"
>                        required="true" />
>                    <tr:outputLabel value="Password" />
>                    <tr:inputText id="password"
> value="#{helloWorldBacking.password}"
>                        required="true" secret="true" />
>
>                </h:panelGrid>
>                <tr:commandButton id="loginButton" text="Login"
> partialSubmit="true"
>                    actionListener="#{helloWorldBacking.send}" />
>
>
>                <!--
>                <tr:statusIndicator>
>                    <tr:outputText value="#{helloWorldBacking.pollText}" />
>                </tr:statusIndicator>
>                 -->
>                <tr:outputText value="#{helloWorldBacking.pollText}"
>                    partialTriggers="loginButton" />
>            </tr:form>
>        </tr:panelPage>
>
>    </tr:document>
> </f:view>
> </html>
>
> But then I got nothing in the outPutText field. Any other hint/tips or
> tricks. I really appreciate the help
>
> Cheers, Håkon
>
> On 3 March 2011 17:25, Scott O'Bryan <da...@gmail.com> wrote:
>
> > That doesn't seem to make any sense to me Richard.  The poll component
> > does not replace statusIndicator, they simply do two different things.
> >  The purpose of the poll component is to initiate a request based on a
> > clock instead of a user click.  You still need some way to display the
> > information..
> >
> > Hakon,
> >
> > The partial trigger in this case should be on the output text although
> > having it on the status indicator should also work (you'll just get a
> > larger payload).
> >
> > Try this.  Remove the status indicator and only have the output text.
> > Make sure your outputText is located inside the form (possible your
> > getting a scoping issue).
> >
> > Does that work?  It should.
> >
> > On Mar 3, 2011, at 9:06 AM, Richard Yee <ri...@gmail.com> wrote:
> >
> > > You don't want statusIndicator, use tr:poll instead
> > >
> > > Richard
> > >
> > > Sent from my iPhone
> > >
> > > On Mar 3, 2011, at 7:48 AM, Håkon Sagehaug <ha...@uni.no>
> > wrote:
> > >
> > >> Hi
> > >>
> > >> Yes, that was an old cut and past mistake, I've got loginButton as id
> > for
> > >> the button. The latest test are with loginButton, not button2. So this
> > way
> > >> of doing it should normally work?
> > >>
> > >> cheers, Håkon
> > >>
> > >> On 3 March 2011 16:35, Scott O'Bryan <da...@gmail.com> wrote:
> > >>
> > >>> Umm.  Considering the id of your button is button2, I'm not sure why
> > >>> your partialTrigger is loginButton.  Can you explain?
> > >>>
> > >>> On Mar 3, 2011, at 6:46 AM, "Håkon Sagehaug" <ha...@uni.no>
> > >>> wrote:
> > >>>
> > >>>> Hi all,
> > >>>>
> > >>>> I might not get the full point here ;). Here is what I tried, put
> > trigger
> > >>> on
> > >>>> the statusIndicator like here
> > >>>>
> > >>>> <tr:statusIndicator partialTriggers="loginButton">
> > >>>>                  <f:facet name="busy">
> > >>>>                      <tr:outputText
> > >>> value="#{helloWorldBacking.pollText}"
> > >>>> />
> > >>>>                  </f:facet>
> > >>>>              </tr:statusIndicator>
> > >>>>
> > >>>> And on the outputText like here
> > >>>>
> > >>>> <tr:statusIndicator partialTriggers="loginButton">
> > >>>>                  <f:facet name="busy">
> > >>>>                      <tr:outputText
> > >>> value="#{helloWorldBacking.pollText}"
> > >>>> partialTriggers="loginButton"/>
> > >>>>                  </f:facet>
> > >>>>              </tr:statusIndicator>
> > >>>>
> > >>>> Where loginButton is
> > >>>>
> > >>>> <tr:commandButton id="button2" text="Login" partialSubmit="true"/>
> > >>>>
> > >>>> But nothing seems to have the wanted effect. I looks like it picks
> up
> > the
> > >>>> initial value for the helloWorldBacking.pollText, but when this
> value
> > >>>> changes it's it not propagated in the UI. Maybe this can't be done
> > like
> > >>> I've
> > >>>> sketched out. The backing code is the same as sent in a earlier
> email.
> > >>>>
> > >>>> Other tips?
> > >>>>
> > >>>> Cheers, Håkon
> > >>>>
> > >>>>
> > >>>> On 3 March 2011 05:23, Richard Yee <ri...@gmail.com> wrote:
> > >>>>
> > >>>>> Try putting it inside the tr:form or inside your panelPage
> > >>>>>
> > >>>>>
> > >>>>> -Richard
> > >>>>>
> > >>>>> 2011/3/1 Håkon Sagehaug <ha...@uni.no>
> > >>>>>
> > >>>>>> Hi
> > >>>>>>
> > >>>>>> Thanks for the reply, here is my xhtml, with a simple login form
> > >>>>>>
> > >>>>>> <tr:document title="Login Demo">
> > >>>>>>     <tr:statusIndicator>
> > >>>>>>         <f:facet name="busy">
> > >>>>>>             <tr:outputText value="#{helloWorldBacking.pollText}"
> />
> > >>>>>>         </f:facet>
> > >>>>>>     </tr:statusIndicator>
> > >>>>>>     <tr:form>
> > >>>>>>
> > >>>>>>         <tr:panelPage>
> > >>>>>>             <f:facet name="infoStatus">
> > >>>>>>                 <tr:legend name="required" />
> > >>>>>>             </f:facet>
> > >>>>>>
> > >>>>>>             <tr:inputText label="Username" id="username"
> > >>>>>>                 value="#{helloWorldBacking.username}"
> > required="true"
> > >>>>> />
> > >>>>>>
> > >>>>>>             <tr:inputText label="Password" id="password"
> > >>>>>>                 value="#{helloWorldBacking.password}"
> > required="true"
> > >>>>>> secret="true" />
> > >>>>>>             <tr:commandButton id="button2" text="Login"
> > >>>>>> partialSubmit="true"
> > >>>>>>                 action="#{helloWorldBacking.send}" />
> > >>>>>>         </tr:panelPage>
> > >>>>>>
> > >>>>>>     </tr:form>
> > >>>>>>
> > >>>>>> </tr:document>
> > >>>>>>
> > >>>>>> And parts of the backing bean
> > >>>>>>
> > >>>>>> public String send() {
> > >>>>>>     FacesContext facesContext = FacesContext.getCurrentInstance();
> > >>>>>>
> > >>>>>>     System.out.println("user name " + username + " is logged in "
> > >>>>>>             + userLoggedIn);
> > >>>>>>
> > >>>>>>     try {
> > >>>>>>         Thread.sleep(5000);
> > >>>>>>         Token tok = tokenMgr.getToken(username, password, true);
> > >>>>>>        Thread.sleep(2000);
> > >>>>>>         pollText = "Token fetched";
> > >>>>>>         if (tok != null) {
> > >>>>>>             userLoggedIn = true;
> > >>>>>>             return ("success");
> > >>>>>>         }
> > >>>>>>         username = "";
> > >>>>>>         password = "";
> > >>>>>>     } catch (TrustException e1) {
> > >>>>>>         e1.printStackTrace();
> > >>>>>>     } catch (AxisFault e) {
> > >>>>>>         e.printStackTrace();
> > >>>>>>     } catch (FileNotFoundException e) {
> > >>>>>>         e.printStackTrace();
> > >>>>>>     } catch (XMLStreamException e) {
> > >>>>>>         e.printStackTrace();
> > >>>>>>     } catch (InterruptedException e) {
> > >>>>>>
> > >>>>>>         e.printStackTrace();
> > >>>>>>     }
> > >>>>>>     FacesMessage message = new FacesMessage("Login failed");
> > >>>>>>
> > >>>>>>     facesContext.addMessage("username", message);
> > >>>>>>
> > >>>>>>     username = "";
> > >>>>>>     password = "";
> > >>>>>>
> > >>>>>>     return ("error");
> > >>>>>>
> > >>>>>> }
> > >>>>>> As you can see I sleep the thread to simulate the operations
> needed
> > to
> > >>>>> log
> > >>>>>> in the user, for now I'm only getting the token. After that I'll
> > fetch
> > >>>>> the
> > >>>>>> project, data etc...
> > >>>>>>
> > >>>>>> So I wanted the pollText to apear  dynmically in the status
> > indicator,
> > >>>>> but
> > >>>>>> can get it to update,.
> > >>>>>>
> > >>>>>> Any tips?
> > >>>>>>
> > >>>>>> cheers, Håkon
> > >>>>>>
> > >>>>>> On 1 March 2011 23:23, Scott O'Bryan <da...@gmail.com> wrote:
> > >>>>>>
> > >>>>>>> I see no reason why this wouldn't work..  What specifically is
> > failing
> > >>>>>>> for you and perhaps a code snipi might help me visualize your
> > issue.
> > >>>>>>>
> > >>>>>>> On Mar 1, 2011, at 3:04 PM, "Håkon Sagehaug" <
> > hakon.sagehaug@uni.no>
> > >>>>>>> wrote:
> > >>>>>>>
> > >>>>>>>> Hi all,
> > >>>>>>>>
> > >>>>>>>> I've just stared using Trinidad and myFaces, and had a question.
> > I'm
> > >>>>>>>> implementing a login in page for uses, and wanted to use the
> > >>>>>>>> statusIndicator, to give back messages for the user like
> > >>>>>>>>
> > >>>>>>>> 1. Got user information
> > >>>>>>>> 2. Loading datasets
> > >>>>>>>> 3. Logged in
> > >>>>>>>>
> > >>>>>>>> And tried to have a  tr:outputText within the statusIndicator.
> The
> > >>>>>> value
> > >>>>>>> for
> > >>>>>>>> the outPuttext would be linked to a backing bean, but I was not
> > very
> > >>>>>>>> successful, do you have any other tips?
> > >>>>>>>>
> > >>>>>>>> I guess one can use the progressIndicator, but I would like text
> > to
> > >>>>> be
> > >>>>>>>> returned not a procentage progress.
> > >>>>>>>>
> > >>>>>>>> cheers, Håkon
> > >>>>>>>
> > >>>>>>
> > >>>>>
> > >>>
> >
>

Re: Using statusIndicator

Posted by Håkon Sagehaug <ha...@uni.no>.
Hi

I now have my login page like this

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:tr="http://myfaces.apache.org/trinidad">

<f:view>
    <tr:document title="eSysbio-myFaces-Trinidad">

        <tr:panelPage>
            <f:facet name="infoStatus">
                <tr:legend name="required" />
            </f:facet>
            <tr:form>
                <h:panelGrid colums="2">
                    <tr:outputLabel value="Username" />
                    <tr:inputText id="username"
value="#{helloWorldBacking.username}"
                        required="true" />
                    <tr:outputLabel value="Password" />
                    <tr:inputText id="password"
value="#{helloWorldBacking.password}"
                        required="true" secret="true" />

                </h:panelGrid>
                <tr:commandButton id="loginButton" text="Login"
partialSubmit="true"
                    actionListener="#{helloWorldBacking.send}" />


                <!--
                <tr:statusIndicator>
                    <tr:outputText value="#{helloWorldBacking.pollText}" />
                </tr:statusIndicator>
                 -->
                <tr:outputText value="#{helloWorldBacking.pollText}"
                    partialTriggers="loginButton" />
            </tr:form>
        </tr:panelPage>

    </tr:document>
</f:view>
</html>

But then I got nothing in the outPutText field. Any other hint/tips or
tricks. I really appreciate the help

Cheers, Håkon

On 3 March 2011 17:25, Scott O'Bryan <da...@gmail.com> wrote:

> That doesn't seem to make any sense to me Richard.  The poll component
> does not replace statusIndicator, they simply do two different things.
>  The purpose of the poll component is to initiate a request based on a
> clock instead of a user click.  You still need some way to display the
> information..
>
> Hakon,
>
> The partial trigger in this case should be on the output text although
> having it on the status indicator should also work (you'll just get a
> larger payload).
>
> Try this.  Remove the status indicator and only have the output text.
> Make sure your outputText is located inside the form (possible your
> getting a scoping issue).
>
> Does that work?  It should.
>
> On Mar 3, 2011, at 9:06 AM, Richard Yee <ri...@gmail.com> wrote:
>
> > You don't want statusIndicator, use tr:poll instead
> >
> > Richard
> >
> > Sent from my iPhone
> >
> > On Mar 3, 2011, at 7:48 AM, Håkon Sagehaug <ha...@uni.no>
> wrote:
> >
> >> Hi
> >>
> >> Yes, that was an old cut and past mistake, I've got loginButton as id
> for
> >> the button. The latest test are with loginButton, not button2. So this
> way
> >> of doing it should normally work?
> >>
> >> cheers, Håkon
> >>
> >> On 3 March 2011 16:35, Scott O'Bryan <da...@gmail.com> wrote:
> >>
> >>> Umm.  Considering the id of your button is button2, I'm not sure why
> >>> your partialTrigger is loginButton.  Can you explain?
> >>>
> >>> On Mar 3, 2011, at 6:46 AM, "Håkon Sagehaug" <ha...@uni.no>
> >>> wrote:
> >>>
> >>>> Hi all,
> >>>>
> >>>> I might not get the full point here ;). Here is what I tried, put
> trigger
> >>> on
> >>>> the statusIndicator like here
> >>>>
> >>>> <tr:statusIndicator partialTriggers="loginButton">
> >>>>                  <f:facet name="busy">
> >>>>                      <tr:outputText
> >>> value="#{helloWorldBacking.pollText}"
> >>>> />
> >>>>                  </f:facet>
> >>>>              </tr:statusIndicator>
> >>>>
> >>>> And on the outputText like here
> >>>>
> >>>> <tr:statusIndicator partialTriggers="loginButton">
> >>>>                  <f:facet name="busy">
> >>>>                      <tr:outputText
> >>> value="#{helloWorldBacking.pollText}"
> >>>> partialTriggers="loginButton"/>
> >>>>                  </f:facet>
> >>>>              </tr:statusIndicator>
> >>>>
> >>>> Where loginButton is
> >>>>
> >>>> <tr:commandButton id="button2" text="Login" partialSubmit="true"/>
> >>>>
> >>>> But nothing seems to have the wanted effect. I looks like it picks up
> the
> >>>> initial value for the helloWorldBacking.pollText, but when this value
> >>>> changes it's it not propagated in the UI. Maybe this can't be done
> like
> >>> I've
> >>>> sketched out. The backing code is the same as sent in a earlier email.
> >>>>
> >>>> Other tips?
> >>>>
> >>>> Cheers, Håkon
> >>>>
> >>>>
> >>>> On 3 March 2011 05:23, Richard Yee <ri...@gmail.com> wrote:
> >>>>
> >>>>> Try putting it inside the tr:form or inside your panelPage
> >>>>>
> >>>>>
> >>>>> -Richard
> >>>>>
> >>>>> 2011/3/1 Håkon Sagehaug <ha...@uni.no>
> >>>>>
> >>>>>> Hi
> >>>>>>
> >>>>>> Thanks for the reply, here is my xhtml, with a simple login form
> >>>>>>
> >>>>>> <tr:document title="Login Demo">
> >>>>>>     <tr:statusIndicator>
> >>>>>>         <f:facet name="busy">
> >>>>>>             <tr:outputText value="#{helloWorldBacking.pollText}" />
> >>>>>>         </f:facet>
> >>>>>>     </tr:statusIndicator>
> >>>>>>     <tr:form>
> >>>>>>
> >>>>>>         <tr:panelPage>
> >>>>>>             <f:facet name="infoStatus">
> >>>>>>                 <tr:legend name="required" />
> >>>>>>             </f:facet>
> >>>>>>
> >>>>>>             <tr:inputText label="Username" id="username"
> >>>>>>                 value="#{helloWorldBacking.username}"
> required="true"
> >>>>> />
> >>>>>>
> >>>>>>             <tr:inputText label="Password" id="password"
> >>>>>>                 value="#{helloWorldBacking.password}"
> required="true"
> >>>>>> secret="true" />
> >>>>>>             <tr:commandButton id="button2" text="Login"
> >>>>>> partialSubmit="true"
> >>>>>>                 action="#{helloWorldBacking.send}" />
> >>>>>>         </tr:panelPage>
> >>>>>>
> >>>>>>     </tr:form>
> >>>>>>
> >>>>>> </tr:document>
> >>>>>>
> >>>>>> And parts of the backing bean
> >>>>>>
> >>>>>> public String send() {
> >>>>>>     FacesContext facesContext = FacesContext.getCurrentInstance();
> >>>>>>
> >>>>>>     System.out.println("user name " + username + " is logged in "
> >>>>>>             + userLoggedIn);
> >>>>>>
> >>>>>>     try {
> >>>>>>         Thread.sleep(5000);
> >>>>>>         Token tok = tokenMgr.getToken(username, password, true);
> >>>>>>        Thread.sleep(2000);
> >>>>>>         pollText = "Token fetched";
> >>>>>>         if (tok != null) {
> >>>>>>             userLoggedIn = true;
> >>>>>>             return ("success");
> >>>>>>         }
> >>>>>>         username = "";
> >>>>>>         password = "";
> >>>>>>     } catch (TrustException e1) {
> >>>>>>         e1.printStackTrace();
> >>>>>>     } catch (AxisFault e) {
> >>>>>>         e.printStackTrace();
> >>>>>>     } catch (FileNotFoundException e) {
> >>>>>>         e.printStackTrace();
> >>>>>>     } catch (XMLStreamException e) {
> >>>>>>         e.printStackTrace();
> >>>>>>     } catch (InterruptedException e) {
> >>>>>>
> >>>>>>         e.printStackTrace();
> >>>>>>     }
> >>>>>>     FacesMessage message = new FacesMessage("Login failed");
> >>>>>>
> >>>>>>     facesContext.addMessage("username", message);
> >>>>>>
> >>>>>>     username = "";
> >>>>>>     password = "";
> >>>>>>
> >>>>>>     return ("error");
> >>>>>>
> >>>>>> }
> >>>>>> As you can see I sleep the thread to simulate the operations needed
> to
> >>>>> log
> >>>>>> in the user, for now I'm only getting the token. After that I'll
> fetch
> >>>>> the
> >>>>>> project, data etc...
> >>>>>>
> >>>>>> So I wanted the pollText to apear  dynmically in the status
> indicator,
> >>>>> but
> >>>>>> can get it to update,.
> >>>>>>
> >>>>>> Any tips?
> >>>>>>
> >>>>>> cheers, Håkon
> >>>>>>
> >>>>>> On 1 March 2011 23:23, Scott O'Bryan <da...@gmail.com> wrote:
> >>>>>>
> >>>>>>> I see no reason why this wouldn't work..  What specifically is
> failing
> >>>>>>> for you and perhaps a code snipi might help me visualize your
> issue.
> >>>>>>>
> >>>>>>> On Mar 1, 2011, at 3:04 PM, "Håkon Sagehaug" <
> hakon.sagehaug@uni.no>
> >>>>>>> wrote:
> >>>>>>>
> >>>>>>>> Hi all,
> >>>>>>>>
> >>>>>>>> I've just stared using Trinidad and myFaces, and had a question.
> I'm
> >>>>>>>> implementing a login in page for uses, and wanted to use the
> >>>>>>>> statusIndicator, to give back messages for the user like
> >>>>>>>>
> >>>>>>>> 1. Got user information
> >>>>>>>> 2. Loading datasets
> >>>>>>>> 3. Logged in
> >>>>>>>>
> >>>>>>>> And tried to have a  tr:outputText within the statusIndicator. The
> >>>>>> value
> >>>>>>> for
> >>>>>>>> the outPuttext would be linked to a backing bean, but I was not
> very
> >>>>>>>> successful, do you have any other tips?
> >>>>>>>>
> >>>>>>>> I guess one can use the progressIndicator, but I would like text
> to
> >>>>> be
> >>>>>>>> returned not a procentage progress.
> >>>>>>>>
> >>>>>>>> cheers, Håkon
> >>>>>>>
> >>>>>>
> >>>>>
> >>>
>

Re: Using statusIndicator

Posted by Scott O'Bryan <da...@gmail.com>.
That doesn't seem to make any sense to me Richard.  The poll component
does not replace statusIndicator, they simply do two different things.
 The purpose of the poll component is to initiate a request based on a
clock instead of a user click.  You still need some way to display the
information..

Hakon,

The partial trigger in this case should be on the output text although
having it on the status indicator should also work (you'll just get a
larger payload).

Try this.  Remove the status indicator and only have the output text.
Make sure your outputText is located inside the form (possible your
getting a scoping issue).

Does that work?  It should.

On Mar 3, 2011, at 9:06 AM, Richard Yee <ri...@gmail.com> wrote:

> You don't want statusIndicator, use tr:poll instead
>
> Richard
>
> Sent from my iPhone
>
> On Mar 3, 2011, at 7:48 AM, Håkon Sagehaug <ha...@uni.no> wrote:
>
>> Hi
>>
>> Yes, that was an old cut and past mistake, I've got loginButton as id for
>> the button. The latest test are with loginButton, not button2. So this way
>> of doing it should normally work?
>>
>> cheers, Håkon
>>
>> On 3 March 2011 16:35, Scott O'Bryan <da...@gmail.com> wrote:
>>
>>> Umm.  Considering the id of your button is button2, I'm not sure why
>>> your partialTrigger is loginButton.  Can you explain?
>>>
>>> On Mar 3, 2011, at 6:46 AM, "Håkon Sagehaug" <ha...@uni.no>
>>> wrote:
>>>
>>>> Hi all,
>>>>
>>>> I might not get the full point here ;). Here is what I tried, put trigger
>>> on
>>>> the statusIndicator like here
>>>>
>>>> <tr:statusIndicator partialTriggers="loginButton">
>>>>                  <f:facet name="busy">
>>>>                      <tr:outputText
>>> value="#{helloWorldBacking.pollText}"
>>>> />
>>>>                  </f:facet>
>>>>              </tr:statusIndicator>
>>>>
>>>> And on the outputText like here
>>>>
>>>> <tr:statusIndicator partialTriggers="loginButton">
>>>>                  <f:facet name="busy">
>>>>                      <tr:outputText
>>> value="#{helloWorldBacking.pollText}"
>>>> partialTriggers="loginButton"/>
>>>>                  </f:facet>
>>>>              </tr:statusIndicator>
>>>>
>>>> Where loginButton is
>>>>
>>>> <tr:commandButton id="button2" text="Login" partialSubmit="true"/>
>>>>
>>>> But nothing seems to have the wanted effect. I looks like it picks up the
>>>> initial value for the helloWorldBacking.pollText, but when this value
>>>> changes it's it not propagated in the UI. Maybe this can't be done like
>>> I've
>>>> sketched out. The backing code is the same as sent in a earlier email.
>>>>
>>>> Other tips?
>>>>
>>>> Cheers, Håkon
>>>>
>>>>
>>>> On 3 March 2011 05:23, Richard Yee <ri...@gmail.com> wrote:
>>>>
>>>>> Try putting it inside the tr:form or inside your panelPage
>>>>>
>>>>>
>>>>> -Richard
>>>>>
>>>>> 2011/3/1 Håkon Sagehaug <ha...@uni.no>
>>>>>
>>>>>> Hi
>>>>>>
>>>>>> Thanks for the reply, here is my xhtml, with a simple login form
>>>>>>
>>>>>> <tr:document title="Login Demo">
>>>>>>     <tr:statusIndicator>
>>>>>>         <f:facet name="busy">
>>>>>>             <tr:outputText value="#{helloWorldBacking.pollText}" />
>>>>>>         </f:facet>
>>>>>>     </tr:statusIndicator>
>>>>>>     <tr:form>
>>>>>>
>>>>>>         <tr:panelPage>
>>>>>>             <f:facet name="infoStatus">
>>>>>>                 <tr:legend name="required" />
>>>>>>             </f:facet>
>>>>>>
>>>>>>             <tr:inputText label="Username" id="username"
>>>>>>                 value="#{helloWorldBacking.username}" required="true"
>>>>> />
>>>>>>
>>>>>>             <tr:inputText label="Password" id="password"
>>>>>>                 value="#{helloWorldBacking.password}" required="true"
>>>>>> secret="true" />
>>>>>>             <tr:commandButton id="button2" text="Login"
>>>>>> partialSubmit="true"
>>>>>>                 action="#{helloWorldBacking.send}" />
>>>>>>         </tr:panelPage>
>>>>>>
>>>>>>     </tr:form>
>>>>>>
>>>>>> </tr:document>
>>>>>>
>>>>>> And parts of the backing bean
>>>>>>
>>>>>> public String send() {
>>>>>>     FacesContext facesContext = FacesContext.getCurrentInstance();
>>>>>>
>>>>>>     System.out.println("user name " + username + " is logged in "
>>>>>>             + userLoggedIn);
>>>>>>
>>>>>>     try {
>>>>>>         Thread.sleep(5000);
>>>>>>         Token tok = tokenMgr.getToken(username, password, true);
>>>>>>        Thread.sleep(2000);
>>>>>>         pollText = "Token fetched";
>>>>>>         if (tok != null) {
>>>>>>             userLoggedIn = true;
>>>>>>             return ("success");
>>>>>>         }
>>>>>>         username = "";
>>>>>>         password = "";
>>>>>>     } catch (TrustException e1) {
>>>>>>         e1.printStackTrace();
>>>>>>     } catch (AxisFault e) {
>>>>>>         e.printStackTrace();
>>>>>>     } catch (FileNotFoundException e) {
>>>>>>         e.printStackTrace();
>>>>>>     } catch (XMLStreamException e) {
>>>>>>         e.printStackTrace();
>>>>>>     } catch (InterruptedException e) {
>>>>>>
>>>>>>         e.printStackTrace();
>>>>>>     }
>>>>>>     FacesMessage message = new FacesMessage("Login failed");
>>>>>>
>>>>>>     facesContext.addMessage("username", message);
>>>>>>
>>>>>>     username = "";
>>>>>>     password = "";
>>>>>>
>>>>>>     return ("error");
>>>>>>
>>>>>> }
>>>>>> As you can see I sleep the thread to simulate the operations needed to
>>>>> log
>>>>>> in the user, for now I'm only getting the token. After that I'll fetch
>>>>> the
>>>>>> project, data etc...
>>>>>>
>>>>>> So I wanted the pollText to apear  dynmically in the status indicator,
>>>>> but
>>>>>> can get it to update,.
>>>>>>
>>>>>> Any tips?
>>>>>>
>>>>>> cheers, Håkon
>>>>>>
>>>>>> On 1 March 2011 23:23, Scott O'Bryan <da...@gmail.com> wrote:
>>>>>>
>>>>>>> I see no reason why this wouldn't work..  What specifically is failing
>>>>>>> for you and perhaps a code snipi might help me visualize your issue.
>>>>>>>
>>>>>>> On Mar 1, 2011, at 3:04 PM, "Håkon Sagehaug" <ha...@uni.no>
>>>>>>> wrote:
>>>>>>>
>>>>>>>> Hi all,
>>>>>>>>
>>>>>>>> I've just stared using Trinidad and myFaces, and had a question. I'm
>>>>>>>> implementing a login in page for uses, and wanted to use the
>>>>>>>> statusIndicator, to give back messages for the user like
>>>>>>>>
>>>>>>>> 1. Got user information
>>>>>>>> 2. Loading datasets
>>>>>>>> 3. Logged in
>>>>>>>>
>>>>>>>> And tried to have a  tr:outputText within the statusIndicator. The
>>>>>> value
>>>>>>> for
>>>>>>>> the outPuttext would be linked to a backing bean, but I was not very
>>>>>>>> successful, do you have any other tips?
>>>>>>>>
>>>>>>>> I guess one can use the progressIndicator, but I would like text to
>>>>> be
>>>>>>>> returned not a procentage progress.
>>>>>>>>
>>>>>>>> cheers, Håkon
>>>>>>>
>>>>>>
>>>>>
>>>

Re: Using statusIndicator

Posted by Richard Yee <ri...@gmail.com>.
You don't want statusIndicator, use tr:poll instead

Richard

Sent from my iPhone

On Mar 3, 2011, at 7:48 AM, Håkon Sagehaug <ha...@uni.no> wrote:

> Hi
> 
> Yes, that was an old cut and past mistake, I've got loginButton as id for
> the button. The latest test are with loginButton, not button2. So this way
> of doing it should normally work?
> 
> cheers, Håkon
> 
> On 3 March 2011 16:35, Scott O'Bryan <da...@gmail.com> wrote:
> 
>> Umm.  Considering the id of your button is button2, I'm not sure why
>> your partialTrigger is loginButton.  Can you explain?
>> 
>> On Mar 3, 2011, at 6:46 AM, "Håkon Sagehaug" <ha...@uni.no>
>> wrote:
>> 
>>> Hi all,
>>> 
>>> I might not get the full point here ;). Here is what I tried, put trigger
>> on
>>> the statusIndicator like here
>>> 
>>> <tr:statusIndicator partialTriggers="loginButton">
>>>                   <f:facet name="busy">
>>>                       <tr:outputText
>> value="#{helloWorldBacking.pollText}"
>>> />
>>>                   </f:facet>
>>>               </tr:statusIndicator>
>>> 
>>> And on the outputText like here
>>> 
>>> <tr:statusIndicator partialTriggers="loginButton">
>>>                   <f:facet name="busy">
>>>                       <tr:outputText
>> value="#{helloWorldBacking.pollText}"
>>> partialTriggers="loginButton"/>
>>>                   </f:facet>
>>>               </tr:statusIndicator>
>>> 
>>> Where loginButton is
>>> 
>>> <tr:commandButton id="button2" text="Login" partialSubmit="true"/>
>>> 
>>> But nothing seems to have the wanted effect. I looks like it picks up the
>>> initial value for the helloWorldBacking.pollText, but when this value
>>> changes it's it not propagated in the UI. Maybe this can't be done like
>> I've
>>> sketched out. The backing code is the same as sent in a earlier email.
>>> 
>>> Other tips?
>>> 
>>> Cheers, Håkon
>>> 
>>> 
>>> On 3 March 2011 05:23, Richard Yee <ri...@gmail.com> wrote:
>>> 
>>>> Try putting it inside the tr:form or inside your panelPage
>>>> 
>>>> 
>>>> -Richard
>>>> 
>>>> 2011/3/1 Håkon Sagehaug <ha...@uni.no>
>>>> 
>>>>> Hi
>>>>> 
>>>>> Thanks for the reply, here is my xhtml, with a simple login form
>>>>> 
>>>>> <tr:document title="Login Demo">
>>>>>      <tr:statusIndicator>
>>>>>          <f:facet name="busy">
>>>>>              <tr:outputText value="#{helloWorldBacking.pollText}" />
>>>>>          </f:facet>
>>>>>      </tr:statusIndicator>
>>>>>      <tr:form>
>>>>> 
>>>>>          <tr:panelPage>
>>>>>              <f:facet name="infoStatus">
>>>>>                  <tr:legend name="required" />
>>>>>              </f:facet>
>>>>> 
>>>>>              <tr:inputText label="Username" id="username"
>>>>>                  value="#{helloWorldBacking.username}" required="true"
>>>> />
>>>>> 
>>>>>              <tr:inputText label="Password" id="password"
>>>>>                  value="#{helloWorldBacking.password}" required="true"
>>>>> secret="true" />
>>>>>              <tr:commandButton id="button2" text="Login"
>>>>> partialSubmit="true"
>>>>>                  action="#{helloWorldBacking.send}" />
>>>>>          </tr:panelPage>
>>>>> 
>>>>>      </tr:form>
>>>>> 
>>>>>  </tr:document>
>>>>> 
>>>>> And parts of the backing bean
>>>>> 
>>>>>  public String send() {
>>>>>      FacesContext facesContext = FacesContext.getCurrentInstance();
>>>>> 
>>>>>      System.out.println("user name " + username + " is logged in "
>>>>>              + userLoggedIn);
>>>>> 
>>>>>      try {
>>>>>          Thread.sleep(5000);
>>>>>          Token tok = tokenMgr.getToken(username, password, true);
>>>>>         Thread.sleep(2000);
>>>>>          pollText = "Token fetched";
>>>>>          if (tok != null) {
>>>>>              userLoggedIn = true;
>>>>>              return ("success");
>>>>>          }
>>>>>          username = "";
>>>>>          password = "";
>>>>>      } catch (TrustException e1) {
>>>>>          e1.printStackTrace();
>>>>>      } catch (AxisFault e) {
>>>>>          e.printStackTrace();
>>>>>      } catch (FileNotFoundException e) {
>>>>>          e.printStackTrace();
>>>>>      } catch (XMLStreamException e) {
>>>>>          e.printStackTrace();
>>>>>      } catch (InterruptedException e) {
>>>>> 
>>>>>          e.printStackTrace();
>>>>>      }
>>>>>      FacesMessage message = new FacesMessage("Login failed");
>>>>> 
>>>>>      facesContext.addMessage("username", message);
>>>>> 
>>>>>      username = "";
>>>>>      password = "";
>>>>> 
>>>>>      return ("error");
>>>>> 
>>>>>  }
>>>>> As you can see I sleep the thread to simulate the operations needed to
>>>> log
>>>>> in the user, for now I'm only getting the token. After that I'll fetch
>>>> the
>>>>> project, data etc...
>>>>> 
>>>>> So I wanted the pollText to apear  dynmically in the status indicator,
>>>> but
>>>>> can get it to update,.
>>>>> 
>>>>> Any tips?
>>>>> 
>>>>> cheers, Håkon
>>>>> 
>>>>> On 1 March 2011 23:23, Scott O'Bryan <da...@gmail.com> wrote:
>>>>> 
>>>>>> I see no reason why this wouldn't work..  What specifically is failing
>>>>>> for you and perhaps a code snipi might help me visualize your issue.
>>>>>> 
>>>>>> On Mar 1, 2011, at 3:04 PM, "Håkon Sagehaug" <ha...@uni.no>
>>>>>> wrote:
>>>>>> 
>>>>>>> Hi all,
>>>>>>> 
>>>>>>> I've just stared using Trinidad and myFaces, and had a question. I'm
>>>>>>> implementing a login in page for uses, and wanted to use the
>>>>>>> statusIndicator, to give back messages for the user like
>>>>>>> 
>>>>>>> 1. Got user information
>>>>>>> 2. Loading datasets
>>>>>>> 3. Logged in
>>>>>>> 
>>>>>>> And tried to have a  tr:outputText within the statusIndicator. The
>>>>> value
>>>>>> for
>>>>>>> the outPuttext would be linked to a backing bean, but I was not very
>>>>>>> successful, do you have any other tips?
>>>>>>> 
>>>>>>> I guess one can use the progressIndicator, but I would like text to
>>>> be
>>>>>>> returned not a procentage progress.
>>>>>>> 
>>>>>>> cheers, Håkon
>>>>>> 
>>>>> 
>>>> 
>> 

Re: Using statusIndicator

Posted by Håkon Sagehaug <ha...@uni.no>.
Hi

Yes, that was an old cut and past mistake, I've got loginButton as id for
the button. The latest test are with loginButton, not button2. So this way
of doing it should normally work?

cheers, Håkon

On 3 March 2011 16:35, Scott O'Bryan <da...@gmail.com> wrote:

> Umm.  Considering the id of your button is button2, I'm not sure why
> your partialTrigger is loginButton.  Can you explain?
>
> On Mar 3, 2011, at 6:46 AM, "Håkon Sagehaug" <ha...@uni.no>
> wrote:
>
> > Hi all,
> >
> > I might not get the full point here ;). Here is what I tried, put trigger
> on
> > the statusIndicator like here
> >
> > <tr:statusIndicator partialTriggers="loginButton">
> >                    <f:facet name="busy">
> >                        <tr:outputText
> value="#{helloWorldBacking.pollText}"
> > />
> >                    </f:facet>
> >                </tr:statusIndicator>
> >
> > And on the outputText like here
> >
> > <tr:statusIndicator partialTriggers="loginButton">
> >                    <f:facet name="busy">
> >                        <tr:outputText
> value="#{helloWorldBacking.pollText}"
> > partialTriggers="loginButton"/>
> >                    </f:facet>
> >                </tr:statusIndicator>
> >
> > Where loginButton is
> >
> > <tr:commandButton id="button2" text="Login" partialSubmit="true"/>
> >
> > But nothing seems to have the wanted effect. I looks like it picks up the
> > initial value for the helloWorldBacking.pollText, but when this value
> > changes it's it not propagated in the UI. Maybe this can't be done like
> I've
> > sketched out. The backing code is the same as sent in a earlier email.
> >
> > Other tips?
> >
> > Cheers, Håkon
> >
> >
> > On 3 March 2011 05:23, Richard Yee <ri...@gmail.com> wrote:
> >
> >> Try putting it inside the tr:form or inside your panelPage
> >>
> >>
> >> -Richard
> >>
> >> 2011/3/1 Håkon Sagehaug <ha...@uni.no>
> >>
> >>> Hi
> >>>
> >>> Thanks for the reply, here is my xhtml, with a simple login form
> >>>
> >>> <tr:document title="Login Demo">
> >>>       <tr:statusIndicator>
> >>>           <f:facet name="busy">
> >>>               <tr:outputText value="#{helloWorldBacking.pollText}" />
> >>>           </f:facet>
> >>>       </tr:statusIndicator>
> >>>       <tr:form>
> >>>
> >>>           <tr:panelPage>
> >>>               <f:facet name="infoStatus">
> >>>                   <tr:legend name="required" />
> >>>               </f:facet>
> >>>
> >>>               <tr:inputText label="Username" id="username"
> >>>                   value="#{helloWorldBacking.username}" required="true"
> >> />
> >>>
> >>>               <tr:inputText label="Password" id="password"
> >>>                   value="#{helloWorldBacking.password}" required="true"
> >>> secret="true" />
> >>>               <tr:commandButton id="button2" text="Login"
> >>> partialSubmit="true"
> >>>                   action="#{helloWorldBacking.send}" />
> >>>           </tr:panelPage>
> >>>
> >>>       </tr:form>
> >>>
> >>>   </tr:document>
> >>>
> >>> And parts of the backing bean
> >>>
> >>>   public String send() {
> >>>       FacesContext facesContext = FacesContext.getCurrentInstance();
> >>>
> >>>       System.out.println("user name " + username + " is logged in "
> >>>               + userLoggedIn);
> >>>
> >>>       try {
> >>>           Thread.sleep(5000);
> >>>           Token tok = tokenMgr.getToken(username, password, true);
> >>>          Thread.sleep(2000);
> >>>           pollText = "Token fetched";
> >>>           if (tok != null) {
> >>>               userLoggedIn = true;
> >>>               return ("success");
> >>>           }
> >>>           username = "";
> >>>           password = "";
> >>>       } catch (TrustException e1) {
> >>>           e1.printStackTrace();
> >>>       } catch (AxisFault e) {
> >>>           e.printStackTrace();
> >>>       } catch (FileNotFoundException e) {
> >>>           e.printStackTrace();
> >>>       } catch (XMLStreamException e) {
> >>>           e.printStackTrace();
> >>>       } catch (InterruptedException e) {
> >>>
> >>>           e.printStackTrace();
> >>>       }
> >>>       FacesMessage message = new FacesMessage("Login failed");
> >>>
> >>>       facesContext.addMessage("username", message);
> >>>
> >>>       username = "";
> >>>       password = "";
> >>>
> >>>       return ("error");
> >>>
> >>>   }
> >>> As you can see I sleep the thread to simulate the operations needed to
> >> log
> >>> in the user, for now I'm only getting the token. After that I'll fetch
> >> the
> >>> project, data etc...
> >>>
> >>> So I wanted the pollText to apear  dynmically in the status indicator,
> >> but
> >>> can get it to update,.
> >>>
> >>> Any tips?
> >>>
> >>> cheers, Håkon
> >>>
> >>> On 1 March 2011 23:23, Scott O'Bryan <da...@gmail.com> wrote:
> >>>
> >>>> I see no reason why this wouldn't work..  What specifically is failing
> >>>> for you and perhaps a code snipi might help me visualize your issue.
> >>>>
> >>>> On Mar 1, 2011, at 3:04 PM, "Håkon Sagehaug" <ha...@uni.no>
> >>>> wrote:
> >>>>
> >>>>> Hi all,
> >>>>>
> >>>>> I've just stared using Trinidad and myFaces, and had a question. I'm
> >>>>> implementing a login in page for uses, and wanted to use the
> >>>>> statusIndicator, to give back messages for the user like
> >>>>>
> >>>>> 1. Got user information
> >>>>> 2. Loading datasets
> >>>>> 3. Logged in
> >>>>>
> >>>>> And tried to have a  tr:outputText within the statusIndicator. The
> >>> value
> >>>> for
> >>>>> the outPuttext would be linked to a backing bean, but I was not very
> >>>>> successful, do you have any other tips?
> >>>>>
> >>>>> I guess one can use the progressIndicator, but I would like text to
> >> be
> >>>>> returned not a procentage progress.
> >>>>>
> >>>>> cheers, Håkon
> >>>>
> >>>
> >>
>

Re: Using statusIndicator

Posted by Scott O'Bryan <da...@gmail.com>.
Umm.  Considering the id of your button is button2, I'm not sure why
your partialTrigger is loginButton.  Can you explain?

On Mar 3, 2011, at 6:46 AM, "Håkon Sagehaug" <ha...@uni.no> wrote:

> Hi all,
>
> I might not get the full point here ;). Here is what I tried, put trigger on
> the statusIndicator like here
>
> <tr:statusIndicator partialTriggers="loginButton">
>                    <f:facet name="busy">
>                        <tr:outputText value="#{helloWorldBacking.pollText}"
> />
>                    </f:facet>
>                </tr:statusIndicator>
>
> And on the outputText like here
>
> <tr:statusIndicator partialTriggers="loginButton">
>                    <f:facet name="busy">
>                        <tr:outputText value="#{helloWorldBacking.pollText}"
> partialTriggers="loginButton"/>
>                    </f:facet>
>                </tr:statusIndicator>
>
> Where loginButton is
>
> <tr:commandButton id="button2" text="Login" partialSubmit="true"/>
>
> But nothing seems to have the wanted effect. I looks like it picks up the
> initial value for the helloWorldBacking.pollText, but when this value
> changes it's it not propagated in the UI. Maybe this can't be done like I've
> sketched out. The backing code is the same as sent in a earlier email.
>
> Other tips?
>
> Cheers, Håkon
>
>
> On 3 March 2011 05:23, Richard Yee <ri...@gmail.com> wrote:
>
>> Try putting it inside the tr:form or inside your panelPage
>>
>>
>> -Richard
>>
>> 2011/3/1 Håkon Sagehaug <ha...@uni.no>
>>
>>> Hi
>>>
>>> Thanks for the reply, here is my xhtml, with a simple login form
>>>
>>> <tr:document title="Login Demo">
>>>       <tr:statusIndicator>
>>>           <f:facet name="busy">
>>>               <tr:outputText value="#{helloWorldBacking.pollText}" />
>>>           </f:facet>
>>>       </tr:statusIndicator>
>>>       <tr:form>
>>>
>>>           <tr:panelPage>
>>>               <f:facet name="infoStatus">
>>>                   <tr:legend name="required" />
>>>               </f:facet>
>>>
>>>               <tr:inputText label="Username" id="username"
>>>                   value="#{helloWorldBacking.username}" required="true"
>> />
>>>
>>>               <tr:inputText label="Password" id="password"
>>>                   value="#{helloWorldBacking.password}" required="true"
>>> secret="true" />
>>>               <tr:commandButton id="button2" text="Login"
>>> partialSubmit="true"
>>>                   action="#{helloWorldBacking.send}" />
>>>           </tr:panelPage>
>>>
>>>       </tr:form>
>>>
>>>   </tr:document>
>>>
>>> And parts of the backing bean
>>>
>>>   public String send() {
>>>       FacesContext facesContext = FacesContext.getCurrentInstance();
>>>
>>>       System.out.println("user name " + username + " is logged in "
>>>               + userLoggedIn);
>>>
>>>       try {
>>>           Thread.sleep(5000);
>>>           Token tok = tokenMgr.getToken(username, password, true);
>>>          Thread.sleep(2000);
>>>           pollText = "Token fetched";
>>>           if (tok != null) {
>>>               userLoggedIn = true;
>>>               return ("success");
>>>           }
>>>           username = "";
>>>           password = "";
>>>       } catch (TrustException e1) {
>>>           e1.printStackTrace();
>>>       } catch (AxisFault e) {
>>>           e.printStackTrace();
>>>       } catch (FileNotFoundException e) {
>>>           e.printStackTrace();
>>>       } catch (XMLStreamException e) {
>>>           e.printStackTrace();
>>>       } catch (InterruptedException e) {
>>>
>>>           e.printStackTrace();
>>>       }
>>>       FacesMessage message = new FacesMessage("Login failed");
>>>
>>>       facesContext.addMessage("username", message);
>>>
>>>       username = "";
>>>       password = "";
>>>
>>>       return ("error");
>>>
>>>   }
>>> As you can see I sleep the thread to simulate the operations needed to
>> log
>>> in the user, for now I'm only getting the token. After that I'll fetch
>> the
>>> project, data etc...
>>>
>>> So I wanted the pollText to apear  dynmically in the status indicator,
>> but
>>> can get it to update,.
>>>
>>> Any tips?
>>>
>>> cheers, Håkon
>>>
>>> On 1 March 2011 23:23, Scott O'Bryan <da...@gmail.com> wrote:
>>>
>>>> I see no reason why this wouldn't work..  What specifically is failing
>>>> for you and perhaps a code snipi might help me visualize your issue.
>>>>
>>>> On Mar 1, 2011, at 3:04 PM, "Håkon Sagehaug" <ha...@uni.no>
>>>> wrote:
>>>>
>>>>> Hi all,
>>>>>
>>>>> I've just stared using Trinidad and myFaces, and had a question. I'm
>>>>> implementing a login in page for uses, and wanted to use the
>>>>> statusIndicator, to give back messages for the user like
>>>>>
>>>>> 1. Got user information
>>>>> 2. Loading datasets
>>>>> 3. Logged in
>>>>>
>>>>> And tried to have a  tr:outputText within the statusIndicator. The
>>> value
>>>> for
>>>>> the outPuttext would be linked to a backing bean, but I was not very
>>>>> successful, do you have any other tips?
>>>>>
>>>>> I guess one can use the progressIndicator, but I would like text to
>> be
>>>>> returned not a procentage progress.
>>>>>
>>>>> cheers, Håkon
>>>>
>>>
>>

Re: Using statusIndicator

Posted by Scott O'Bryan <da...@gmail.com>.
On Mar 3, 2011, at 6:46 AM, "Håkon Sagehaug" <ha...@uni.no> wrote:

> Hi all,
>
> I might not get the full point here ;). Here is what I tried, put trigger on
> the statusIndicator like here
>
> <tr:statusIndicator partialTriggers="loginButton">
>                    <f:facet name="busy">
>                        <tr:outputText value="#{helloWorldBacking.pollText}"
> />
>                    </f:facet>
>                </tr:statusIndicator>
>
> And on the outputText like here
>
> <tr:statusIndicator partialTriggers="loginButton">
>                    <f:facet name="busy">
>                        <tr:outputText value="#{helloWorldBacking.pollText}"
> partialTriggers="loginButton"/>
>                    </f:facet>
>                </tr:statusIndicator>
>
> Where loginButton is
>
> <tr:commandButton id="button2" text="Login" partialSubmit="true"/>
>
> But nothing seems to have the wanted effect. I looks like it picks up the
> initial value for the helloWorldBacking.pollText, but when this value
> changes it's it not propagated in the UI. Maybe this can't be done like I've
> sketched out. The backing code is the same as sent in a earlier email.
>
> Other tips?
>
> Cheers, Håkon
>
>
> On 3 March 2011 05:23, Richard Yee <ri...@gmail.com> wrote:
>
>> Try putting it inside the tr:form or inside your panelPage
>>
>>
>> -Richard
>>
>> 2011/3/1 Håkon Sagehaug <ha...@uni.no>
>>
>>> Hi
>>>
>>> Thanks for the reply, here is my xhtml, with a simple login form
>>>
>>> <tr:document title="Login Demo">
>>>       <tr:statusIndicator>
>>>           <f:facet name="busy">
>>>               <tr:outputText value="#{helloWorldBacking.pollText}" />
>>>           </f:facet>
>>>       </tr:statusIndicator>
>>>       <tr:form>
>>>
>>>           <tr:panelPage>
>>>               <f:facet name="infoStatus">
>>>                   <tr:legend name="required" />
>>>               </f:facet>
>>>
>>>               <tr:inputText label="Username" id="username"
>>>                   value="#{helloWorldBacking.username}" required="true"
>> />
>>>
>>>               <tr:inputText label="Password" id="password"
>>>                   value="#{helloWorldBacking.password}" required="true"
>>> secret="true" />
>>>               <tr:commandButton id="button2" text="Login"
>>> partialSubmit="true"
>>>                   action="#{helloWorldBacking.send}" />
>>>           </tr:panelPage>
>>>
>>>       </tr:form>
>>>
>>>   </tr:document>
>>>
>>> And parts of the backing bean
>>>
>>>   public String send() {
>>>       FacesContext facesContext = FacesContext.getCurrentInstance();
>>>
>>>       System.out.println("user name " + username + " is logged in "
>>>               + userLoggedIn);
>>>
>>>       try {
>>>           Thread.sleep(5000);
>>>           Token tok = tokenMgr.getToken(username, password, true);
>>>          Thread.sleep(2000);
>>>           pollText = "Token fetched";
>>>           if (tok != null) {
>>>               userLoggedIn = true;
>>>               return ("success");
>>>           }
>>>           username = "";
>>>           password = "";
>>>       } catch (TrustException e1) {
>>>           e1.printStackTrace();
>>>       } catch (AxisFault e) {
>>>           e.printStackTrace();
>>>       } catch (FileNotFoundException e) {
>>>           e.printStackTrace();
>>>       } catch (XMLStreamException e) {
>>>           e.printStackTrace();
>>>       } catch (InterruptedException e) {
>>>
>>>           e.printStackTrace();
>>>       }
>>>       FacesMessage message = new FacesMessage("Login failed");
>>>
>>>       facesContext.addMessage("username", message);
>>>
>>>       username = "";
>>>       password = "";
>>>
>>>       return ("error");
>>>
>>>   }
>>> As you can see I sleep the thread to simulate the operations needed to
>> log
>>> in the user, for now I'm only getting the token. After that I'll fetch
>> the
>>> project, data etc...
>>>
>>> So I wanted the pollText to apear  dynmically in the status indicator,
>> but
>>> can get it to update,.
>>>
>>> Any tips?
>>>
>>> cheers, Håkon
>>>
>>> On 1 March 2011 23:23, Scott O'Bryan <da...@gmail.com> wrote:
>>>
>>>> I see no reason why this wouldn't work..  What specifically is failing
>>>> for you and perhaps a code snipi might help me visualize your issue.
>>>>
>>>> On Mar 1, 2011, at 3:04 PM, "Håkon Sagehaug" <ha...@uni.no>
>>>> wrote:
>>>>
>>>>> Hi all,
>>>>>
>>>>> I've just stared using Trinidad and myFaces, and had a question. I'm
>>>>> implementing a login in page for uses, and wanted to use the
>>>>> statusIndicator, to give back messages for the user like
>>>>>
>>>>> 1. Got user information
>>>>> 2. Loading datasets
>>>>> 3. Logged in
>>>>>
>>>>> And tried to have a  tr:outputText within the statusIndicator. The
>>> value
>>>> for
>>>>> the outPuttext would be linked to a backing bean, but I was not very
>>>>> successful, do you have any other tips?
>>>>>
>>>>> I guess one can use the progressIndicator, but I would like text to
>> be
>>>>> returned not a procentage progress.
>>>>>
>>>>> cheers, Håkon
>>>>
>>>
>>

Re: Using statusIndicator

Posted by Håkon Sagehaug <ha...@uni.no>.
Hi all,

I might not get the full point here ;). Here is what I tried, put trigger on
the statusIndicator like here

<tr:statusIndicator partialTriggers="loginButton">
                    <f:facet name="busy">
                        <tr:outputText value="#{helloWorldBacking.pollText}"
/>
                    </f:facet>
                </tr:statusIndicator>

And on the outputText like here

<tr:statusIndicator partialTriggers="loginButton">
                    <f:facet name="busy">
                        <tr:outputText value="#{helloWorldBacking.pollText}"
partialTriggers="loginButton"/>
                    </f:facet>
                </tr:statusIndicator>

Where loginButton is

<tr:commandButton id="button2" text="Login" partialSubmit="true"/>

But nothing seems to have the wanted effect. I looks like it picks up the
initial value for the helloWorldBacking.pollText, but when this value
changes it's it not propagated in the UI. Maybe this can't be done like I've
sketched out. The backing code is the same as sent in a earlier email.

Other tips?

Cheers, Håkon


On 3 March 2011 05:23, Richard Yee <ri...@gmail.com> wrote:

> Try putting it inside the tr:form or inside your panelPage
>
>
> -Richard
>
> 2011/3/1 Håkon Sagehaug <ha...@uni.no>
>
> > Hi
> >
> > Thanks for the reply, here is my xhtml, with a simple login form
> >
> > <tr:document title="Login Demo">
> >        <tr:statusIndicator>
> >            <f:facet name="busy">
> >                <tr:outputText value="#{helloWorldBacking.pollText}" />
> >            </f:facet>
> >        </tr:statusIndicator>
> >        <tr:form>
> >
> >            <tr:panelPage>
> >                <f:facet name="infoStatus">
> >                    <tr:legend name="required" />
> >                </f:facet>
> >
> >                <tr:inputText label="Username" id="username"
> >                    value="#{helloWorldBacking.username}" required="true"
> />
> >
> >                <tr:inputText label="Password" id="password"
> >                    value="#{helloWorldBacking.password}" required="true"
> > secret="true" />
> >                <tr:commandButton id="button2" text="Login"
> > partialSubmit="true"
> >                    action="#{helloWorldBacking.send}" />
> >            </tr:panelPage>
> >
> >        </tr:form>
> >
> >    </tr:document>
> >
> > And parts of the backing bean
> >
> >    public String send() {
> >        FacesContext facesContext = FacesContext.getCurrentInstance();
> >
> >        System.out.println("user name " + username + " is logged in "
> >                + userLoggedIn);
> >
> >        try {
> >            Thread.sleep(5000);
> >            Token tok = tokenMgr.getToken(username, password, true);
> >           Thread.sleep(2000);
> >            pollText = "Token fetched";
> >            if (tok != null) {
> >                userLoggedIn = true;
> >                return ("success");
> >            }
> >            username = "";
> >            password = "";
> >        } catch (TrustException e1) {
> >            e1.printStackTrace();
> >        } catch (AxisFault e) {
> >            e.printStackTrace();
> >        } catch (FileNotFoundException e) {
> >            e.printStackTrace();
> >        } catch (XMLStreamException e) {
> >            e.printStackTrace();
> >        } catch (InterruptedException e) {
> >
> >            e.printStackTrace();
> >        }
> >        FacesMessage message = new FacesMessage("Login failed");
> >
> >        facesContext.addMessage("username", message);
> >
> >        username = "";
> >        password = "";
> >
> >        return ("error");
> >
> >    }
> > As you can see I sleep the thread to simulate the operations needed to
> log
> > in the user, for now I'm only getting the token. After that I'll fetch
> the
> > project, data etc...
> >
> > So I wanted the pollText to apear  dynmically in the status indicator,
> but
> > can get it to update,.
> >
> > Any tips?
> >
> > cheers, Håkon
> >
> > On 1 March 2011 23:23, Scott O'Bryan <da...@gmail.com> wrote:
> >
> > > I see no reason why this wouldn't work..  What specifically is failing
> > > for you and perhaps a code snipi might help me visualize your issue.
> > >
> > > On Mar 1, 2011, at 3:04 PM, "Håkon Sagehaug" <ha...@uni.no>
> > > wrote:
> > >
> > > > Hi all,
> > > >
> > > > I've just stared using Trinidad and myFaces, and had a question. I'm
> > > > implementing a login in page for uses, and wanted to use the
> > > > statusIndicator, to give back messages for the user like
> > > >
> > > > 1. Got user information
> > > > 2. Loading datasets
> > > > 3. Logged in
> > > >
> > > > And tried to have a  tr:outputText within the statusIndicator. The
> > value
> > > for
> > > > the outPuttext would be linked to a backing bean, but I was not very
> > > > successful, do you have any other tips?
> > > >
> > > > I guess one can use the progressIndicator, but I would like text to
> be
> > > > returned not a procentage progress.
> > > >
> > > > cheers, Håkon
> > >
> >
>

Re: Using statusIndicator

Posted by Richard Yee <ri...@gmail.com>.
Try putting it inside the tr:form or inside your panelPage


-Richard

2011/3/1 Håkon Sagehaug <ha...@uni.no>

> Hi
>
> Thanks for the reply, here is my xhtml, with a simple login form
>
> <tr:document title="Login Demo">
>        <tr:statusIndicator>
>            <f:facet name="busy">
>                <tr:outputText value="#{helloWorldBacking.pollText}" />
>            </f:facet>
>        </tr:statusIndicator>
>        <tr:form>
>
>            <tr:panelPage>
>                <f:facet name="infoStatus">
>                    <tr:legend name="required" />
>                </f:facet>
>
>                <tr:inputText label="Username" id="username"
>                    value="#{helloWorldBacking.username}" required="true" />
>
>                <tr:inputText label="Password" id="password"
>                    value="#{helloWorldBacking.password}" required="true"
> secret="true" />
>                <tr:commandButton id="button2" text="Login"
> partialSubmit="true"
>                    action="#{helloWorldBacking.send}" />
>            </tr:panelPage>
>
>        </tr:form>
>
>    </tr:document>
>
> And parts of the backing bean
>
>    public String send() {
>        FacesContext facesContext = FacesContext.getCurrentInstance();
>
>        System.out.println("user name " + username + " is logged in "
>                + userLoggedIn);
>
>        try {
>            Thread.sleep(5000);
>            Token tok = tokenMgr.getToken(username, password, true);
>           Thread.sleep(2000);
>            pollText = "Token fetched";
>            if (tok != null) {
>                userLoggedIn = true;
>                return ("success");
>            }
>            username = "";
>            password = "";
>        } catch (TrustException e1) {
>            e1.printStackTrace();
>        } catch (AxisFault e) {
>            e.printStackTrace();
>        } catch (FileNotFoundException e) {
>            e.printStackTrace();
>        } catch (XMLStreamException e) {
>            e.printStackTrace();
>        } catch (InterruptedException e) {
>
>            e.printStackTrace();
>        }
>        FacesMessage message = new FacesMessage("Login failed");
>
>        facesContext.addMessage("username", message);
>
>        username = "";
>        password = "";
>
>        return ("error");
>
>    }
> As you can see I sleep the thread to simulate the operations needed to log
> in the user, for now I'm only getting the token. After that I'll fetch the
> project, data etc...
>
> So I wanted the pollText to apear  dynmically in the status indicator, but
> can get it to update,.
>
> Any tips?
>
> cheers, Håkon
>
> On 1 March 2011 23:23, Scott O'Bryan <da...@gmail.com> wrote:
>
> > I see no reason why this wouldn't work..  What specifically is failing
> > for you and perhaps a code snipi might help me visualize your issue.
> >
> > On Mar 1, 2011, at 3:04 PM, "Håkon Sagehaug" <ha...@uni.no>
> > wrote:
> >
> > > Hi all,
> > >
> > > I've just stared using Trinidad and myFaces, and had a question. I'm
> > > implementing a login in page for uses, and wanted to use the
> > > statusIndicator, to give back messages for the user like
> > >
> > > 1. Got user information
> > > 2. Loading datasets
> > > 3. Logged in
> > >
> > > And tried to have a  tr:outputText within the statusIndicator. The
> value
> > for
> > > the outPuttext would be linked to a backing bean, but I was not very
> > > successful, do you have any other tips?
> > >
> > > I guess one can use the progressIndicator, but I would like text to be
> > > returned not a procentage progress.
> > >
> > > cheers, Håkon
> >
>

Re: Using statusIndicator

Posted by Scott O'Bryan <da...@gmail.com>.
First item in Google if you type "partialtriggers trinidad".  Should 
tell you what you need to know.

http://myfaces.apache.org/trinidad/devguide/ppr.html

Hope that helps,
   Scott

On 03/02/2011 01:50 AM, Håkon Sagehaug wrote:
> Hi
>
> I've read some about these triggers, but not sure how to use it, should I
> connect the partialTrigger to the #{helloWorldBacking.pollText} value, so
> when ever this is updated, the value is also? Or do I connect it to the
> commandButton in my form, little confused :)
>
> cheers, Håkon
>
>
>
>
>
> On 2 March 2011 09:00, Scott O'Bryan<da...@gmail.com>  wrote:
>
>> Ahh yeah.  Look, your component is not updating because you're not
>> telling it to.  You need to set up a partialTrigger in order to get
>> the StatusIndicator to update.
>>
>> On Mar 2, 2011, at 12:48 AM, "Håkon Sagehaug"<ha...@uni.no>
>> wrote:
>>
>>> Hi
>>>
>>> Thanks for the reply, here is my xhtml, with a simple login form
>>>
>>> <tr:document title="Login Demo">
>>>         <tr:statusIndicator>
>>>             <f:facet name="busy">
>>>                 <tr:outputText value="#{helloWorldBacking.pollText}" />
>>>             </f:facet>
>>>         </tr:statusIndicator>
>>>         <tr:form>
>>>
>>>             <tr:panelPage>
>>>                 <f:facet name="infoStatus">
>>>                     <tr:legend name="required" />
>>>                 </f:facet>
>>>
>>>                 <tr:inputText label="Username" id="username"
>>>                     value="#{helloWorldBacking.username}" required="true"
>> />
>>>                 <tr:inputText label="Password" id="password"
>>>                     value="#{helloWorldBacking.password}" required="true"
>>> secret="true" />
>>>                 <tr:commandButton id="button2" text="Login"
>>> partialSubmit="true"
>>>                     action="#{helloWorldBacking.send}" />
>>>             </tr:panelPage>
>>>
>>>         </tr:form>
>>>
>>>     </tr:document>
>>>
>>> And parts of the backing bean
>>>
>>>     public String send() {
>>>         FacesContext facesContext = FacesContext.getCurrentInstance();
>>>
>>>         System.out.println("user name " + username + " is logged in "
>>>                 + userLoggedIn);
>>>
>>>         try {
>>>             Thread.sleep(5000);
>>>             Token tok = tokenMgr.getToken(username, password, true);
>>>            Thread.sleep(2000);
>>>             pollText = "Token fetched";
>>>             if (tok != null) {
>>>                 userLoggedIn = true;
>>>                 return ("success");
>>>             }
>>>             username = "";
>>>             password = "";
>>>         } catch (TrustException e1) {
>>>             e1.printStackTrace();
>>>         } catch (AxisFault e) {
>>>             e.printStackTrace();
>>>         } catch (FileNotFoundException e) {
>>>             e.printStackTrace();
>>>         } catch (XMLStreamException e) {
>>>             e.printStackTrace();
>>>         } catch (InterruptedException e) {
>>>
>>>             e.printStackTrace();
>>>         }
>>>         FacesMessage message = new FacesMessage("Login failed");
>>>
>>>         facesContext.addMessage("username", message);
>>>
>>>         username = "";
>>>         password = "";
>>>
>>>         return ("error");
>>>
>>>     }
>>> As you can see I sleep the thread to simulate the operations needed to
>> log
>>> in the user, for now I'm only getting the token. After that I'll fetch
>> the
>>> project, data etc...
>>>
>>> So I wanted the pollText to apear  dynmically in the status indicator,
>> but
>>> can get it to update,.
>>>
>>> Any tips?
>>>
>>> cheers, Håkon
>>>
>>> On 1 March 2011 23:23, Scott O'Bryan<da...@gmail.com>  wrote:
>>>
>>>> I see no reason why this wouldn't work..  What specifically is failing
>>>> for you and perhaps a code snipi might help me visualize your issue.
>>>>
>>>> On Mar 1, 2011, at 3:04 PM, "Håkon Sagehaug"<ha...@uni.no>
>>>> wrote:
>>>>
>>>>> Hi all,
>>>>>
>>>>> I've just stared using Trinidad and myFaces, and had a question. I'm
>>>>> implementing a login in page for uses, and wanted to use the
>>>>> statusIndicator, to give back messages for the user like
>>>>>
>>>>> 1. Got user information
>>>>> 2. Loading datasets
>>>>> 3. Logged in
>>>>>
>>>>> And tried to have a  tr:outputText within the statusIndicator. The
>> value
>>>> for
>>>>> the outPuttext would be linked to a backing bean, but I was not very
>>>>> successful, do you have any other tips?
>>>>>
>>>>> I guess one can use the progressIndicator, but I would like text to be
>>>>> returned not a procentage progress.
>>>>>
>>>>> cheers, Håkon


Re: Using statusIndicator

Posted by Håkon Sagehaug <ha...@uni.no>.
Hi

I've read some about these triggers, but not sure how to use it, should I
connect the partialTrigger to the #{helloWorldBacking.pollText} value, so
when ever this is updated, the value is also? Or do I connect it to the
commandButton in my form, little confused :)

cheers, Håkon





On 2 March 2011 09:00, Scott O'Bryan <da...@gmail.com> wrote:

> Ahh yeah.  Look, your component is not updating because you're not
> telling it to.  You need to set up a partialTrigger in order to get
> the StatusIndicator to update.
>
> On Mar 2, 2011, at 12:48 AM, "Håkon Sagehaug" <ha...@uni.no>
> wrote:
>
> > Hi
> >
> > Thanks for the reply, here is my xhtml, with a simple login form
> >
> > <tr:document title="Login Demo">
> >        <tr:statusIndicator>
> >            <f:facet name="busy">
> >                <tr:outputText value="#{helloWorldBacking.pollText}" />
> >            </f:facet>
> >        </tr:statusIndicator>
> >        <tr:form>
> >
> >            <tr:panelPage>
> >                <f:facet name="infoStatus">
> >                    <tr:legend name="required" />
> >                </f:facet>
> >
> >                <tr:inputText label="Username" id="username"
> >                    value="#{helloWorldBacking.username}" required="true"
> />
> >
> >                <tr:inputText label="Password" id="password"
> >                    value="#{helloWorldBacking.password}" required="true"
> > secret="true" />
> >                <tr:commandButton id="button2" text="Login"
> > partialSubmit="true"
> >                    action="#{helloWorldBacking.send}" />
> >            </tr:panelPage>
> >
> >        </tr:form>
> >
> >    </tr:document>
> >
> > And parts of the backing bean
> >
> >    public String send() {
> >        FacesContext facesContext = FacesContext.getCurrentInstance();
> >
> >        System.out.println("user name " + username + " is logged in "
> >                + userLoggedIn);
> >
> >        try {
> >            Thread.sleep(5000);
> >            Token tok = tokenMgr.getToken(username, password, true);
> >           Thread.sleep(2000);
> >            pollText = "Token fetched";
> >            if (tok != null) {
> >                userLoggedIn = true;
> >                return ("success");
> >            }
> >            username = "";
> >            password = "";
> >        } catch (TrustException e1) {
> >            e1.printStackTrace();
> >        } catch (AxisFault e) {
> >            e.printStackTrace();
> >        } catch (FileNotFoundException e) {
> >            e.printStackTrace();
> >        } catch (XMLStreamException e) {
> >            e.printStackTrace();
> >        } catch (InterruptedException e) {
> >
> >            e.printStackTrace();
> >        }
> >        FacesMessage message = new FacesMessage("Login failed");
> >
> >        facesContext.addMessage("username", message);
> >
> >        username = "";
> >        password = "";
> >
> >        return ("error");
> >
> >    }
> > As you can see I sleep the thread to simulate the operations needed to
> log
> > in the user, for now I'm only getting the token. After that I'll fetch
> the
> > project, data etc...
> >
> > So I wanted the pollText to apear  dynmically in the status indicator,
> but
> > can get it to update,.
> >
> > Any tips?
> >
> > cheers, Håkon
> >
> > On 1 March 2011 23:23, Scott O'Bryan <da...@gmail.com> wrote:
> >
> >> I see no reason why this wouldn't work..  What specifically is failing
> >> for you and perhaps a code snipi might help me visualize your issue.
> >>
> >> On Mar 1, 2011, at 3:04 PM, "Håkon Sagehaug" <ha...@uni.no>
> >> wrote:
> >>
> >>> Hi all,
> >>>
> >>> I've just stared using Trinidad and myFaces, and had a question. I'm
> >>> implementing a login in page for uses, and wanted to use the
> >>> statusIndicator, to give back messages for the user like
> >>>
> >>> 1. Got user information
> >>> 2. Loading datasets
> >>> 3. Logged in
> >>>
> >>> And tried to have a  tr:outputText within the statusIndicator. The
> value
> >> for
> >>> the outPuttext would be linked to a backing bean, but I was not very
> >>> successful, do you have any other tips?
> >>>
> >>> I guess one can use the progressIndicator, but I would like text to be
> >>> returned not a procentage progress.
> >>>
> >>> cheers, Håkon
> >>
>

Re: Using statusIndicator

Posted by Scott O'Bryan <da...@gmail.com>.
Ahh yeah.  Look, your component is not updating because you're not
telling it to.  You need to set up a partialTrigger in order to get
the StatusIndicator to update.

On Mar 2, 2011, at 12:48 AM, "Håkon Sagehaug" <ha...@uni.no> wrote:

> Hi
>
> Thanks for the reply, here is my xhtml, with a simple login form
>
> <tr:document title="Login Demo">
>        <tr:statusIndicator>
>            <f:facet name="busy">
>                <tr:outputText value="#{helloWorldBacking.pollText}" />
>            </f:facet>
>        </tr:statusIndicator>
>        <tr:form>
>
>            <tr:panelPage>
>                <f:facet name="infoStatus">
>                    <tr:legend name="required" />
>                </f:facet>
>
>                <tr:inputText label="Username" id="username"
>                    value="#{helloWorldBacking.username}" required="true" />
>
>                <tr:inputText label="Password" id="password"
>                    value="#{helloWorldBacking.password}" required="true"
> secret="true" />
>                <tr:commandButton id="button2" text="Login"
> partialSubmit="true"
>                    action="#{helloWorldBacking.send}" />
>            </tr:panelPage>
>
>        </tr:form>
>
>    </tr:document>
>
> And parts of the backing bean
>
>    public String send() {
>        FacesContext facesContext = FacesContext.getCurrentInstance();
>
>        System.out.println("user name " + username + " is logged in "
>                + userLoggedIn);
>
>        try {
>            Thread.sleep(5000);
>            Token tok = tokenMgr.getToken(username, password, true);
>           Thread.sleep(2000);
>            pollText = "Token fetched";
>            if (tok != null) {
>                userLoggedIn = true;
>                return ("success");
>            }
>            username = "";
>            password = "";
>        } catch (TrustException e1) {
>            e1.printStackTrace();
>        } catch (AxisFault e) {
>            e.printStackTrace();
>        } catch (FileNotFoundException e) {
>            e.printStackTrace();
>        } catch (XMLStreamException e) {
>            e.printStackTrace();
>        } catch (InterruptedException e) {
>
>            e.printStackTrace();
>        }
>        FacesMessage message = new FacesMessage("Login failed");
>
>        facesContext.addMessage("username", message);
>
>        username = "";
>        password = "";
>
>        return ("error");
>
>    }
> As you can see I sleep the thread to simulate the operations needed to log
> in the user, for now I'm only getting the token. After that I'll fetch the
> project, data etc...
>
> So I wanted the pollText to apear  dynmically in the status indicator, but
> can get it to update,.
>
> Any tips?
>
> cheers, Håkon
>
> On 1 March 2011 23:23, Scott O'Bryan <da...@gmail.com> wrote:
>
>> I see no reason why this wouldn't work..  What specifically is failing
>> for you and perhaps a code snipi might help me visualize your issue.
>>
>> On Mar 1, 2011, at 3:04 PM, "Håkon Sagehaug" <ha...@uni.no>
>> wrote:
>>
>>> Hi all,
>>>
>>> I've just stared using Trinidad and myFaces, and had a question. I'm
>>> implementing a login in page for uses, and wanted to use the
>>> statusIndicator, to give back messages for the user like
>>>
>>> 1. Got user information
>>> 2. Loading datasets
>>> 3. Logged in
>>>
>>> And tried to have a  tr:outputText within the statusIndicator. The value
>> for
>>> the outPuttext would be linked to a backing bean, but I was not very
>>> successful, do you have any other tips?
>>>
>>> I guess one can use the progressIndicator, but I would like text to be
>>> returned not a procentage progress.
>>>
>>> cheers, Håkon
>>

Re: Using statusIndicator

Posted by Håkon Sagehaug <ha...@uni.no>.
Hi

Thanks for the reply, here is my xhtml, with a simple login form

<tr:document title="Login Demo">
        <tr:statusIndicator>
            <f:facet name="busy">
                <tr:outputText value="#{helloWorldBacking.pollText}" />
            </f:facet>
        </tr:statusIndicator>
        <tr:form>

            <tr:panelPage>
                <f:facet name="infoStatus">
                    <tr:legend name="required" />
                </f:facet>

                <tr:inputText label="Username" id="username"
                    value="#{helloWorldBacking.username}" required="true" />

                <tr:inputText label="Password" id="password"
                    value="#{helloWorldBacking.password}" required="true"
secret="true" />
                <tr:commandButton id="button2" text="Login"
partialSubmit="true"
                    action="#{helloWorldBacking.send}" />
            </tr:panelPage>

        </tr:form>

    </tr:document>

And parts of the backing bean

    public String send() {
        FacesContext facesContext = FacesContext.getCurrentInstance();

        System.out.println("user name " + username + " is logged in "
                + userLoggedIn);

        try {
            Thread.sleep(5000);
            Token tok = tokenMgr.getToken(username, password, true);
           Thread.sleep(2000);
            pollText = "Token fetched";
            if (tok != null) {
                userLoggedIn = true;
                return ("success");
            }
            username = "";
            password = "";
        } catch (TrustException e1) {
            e1.printStackTrace();
        } catch (AxisFault e) {
            e.printStackTrace();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (XMLStreamException e) {
            e.printStackTrace();
        } catch (InterruptedException e) {

            e.printStackTrace();
        }
        FacesMessage message = new FacesMessage("Login failed");

        facesContext.addMessage("username", message);

        username = "";
        password = "";

        return ("error");

    }
As you can see I sleep the thread to simulate the operations needed to log
in the user, for now I'm only getting the token. After that I'll fetch the
project, data etc...

So I wanted the pollText to apear  dynmically in the status indicator, but
can get it to update,.

Any tips?

cheers, Håkon

On 1 March 2011 23:23, Scott O'Bryan <da...@gmail.com> wrote:

> I see no reason why this wouldn't work..  What specifically is failing
> for you and perhaps a code snipi might help me visualize your issue.
>
> On Mar 1, 2011, at 3:04 PM, "Håkon Sagehaug" <ha...@uni.no>
> wrote:
>
> > Hi all,
> >
> > I've just stared using Trinidad and myFaces, and had a question. I'm
> > implementing a login in page for uses, and wanted to use the
> > statusIndicator, to give back messages for the user like
> >
> > 1. Got user information
> > 2. Loading datasets
> > 3. Logged in
> >
> > And tried to have a  tr:outputText within the statusIndicator. The value
> for
> > the outPuttext would be linked to a backing bean, but I was not very
> > successful, do you have any other tips?
> >
> > I guess one can use the progressIndicator, but I would like text to be
> > returned not a procentage progress.
> >
> > cheers, Håkon
>

Re: Using statusIndicator

Posted by Scott O'Bryan <da...@gmail.com>.
I see no reason why this wouldn't work..  What specifically is failing
for you and perhaps a code snipi might help me visualize your issue.

On Mar 1, 2011, at 3:04 PM, "Håkon Sagehaug" <ha...@uni.no> wrote:

> Hi all,
>
> I've just stared using Trinidad and myFaces, and had a question. I'm
> implementing a login in page for uses, and wanted to use the
> statusIndicator, to give back messages for the user like
>
> 1. Got user information
> 2. Loading datasets
> 3. Logged in
>
> And tried to have a  tr:outputText within the statusIndicator. The value for
> the outPuttext would be linked to a backing bean, but I was not very
> successful, do you have any other tips?
>
> I guess one can use the progressIndicator, but I would like text to be
> returned not a procentage progress.
>
> cheers, Håkon