1 2 3 4 5 6 Previous Next 78 Replies Latest reply: Mar 2, 2012 8:31 PM by Tugcem Oral Go to original post RSS
  • 45. Re: Growl
    Bernard Labno Master

    Hi, could you shed more light no this? I'm surprised that my component requires cookie.

  • 46. Growl
    liumin hu Master

    hi,

     

    i am using FF 4, if i choose accept the cookies in the options, the notify works. if not, nothing will display.

     

    I test with your notify-example site. there is no problem. i cant understand.

  • 47. Growl
    kemal taskiran Newbie

    hi,

    we want to try to use notify component with a4j:push (RF 4 final), but we couldn't set notify's text from comming message 'event.rf.data'. How can we set this text with this message? Here is the our code, thank you.

     

            <script type="text">

            function getMessageString(data){

                return data.author + " - " +data.timestamp+ ": " + data.text;

            }

            </script>

            <rich:panel header="Welcome to pushDeneme" id="chatpanel">

                <rich:panel styleClass="chatOutput" bodyClass="chatOutput" />

     

                <br clear="all" />

                <hr />

                <h:form>

                    <a4j:push address="topic@chat" onerror="alert(event.rf.data)">

                        <a4j:ajax event="dataavailable" render="notify"

                            listener="#{chatBean.listen}" />

                        <notify:notify sticky="false" stayTime="5000" title="Chat Message"

                            id="notify" text="????" nonblockingOpacity="0" />

                    </a4j:push>

                    <a4j:push address="topic@chat" onerror="alert(event.rf.data)"

                        ondataavailable="jQuery('&lt;div /&gt;').prependTo('.chatOutput').text(getMessageString(event.rf.data))" />

                    <h:inputTextarea value="#{chatBean.message}" rows="3"

                        style="width:80%" id="nm" />

                    <a4j:commandButton value="Send" action="#{chatBean.send}"

                        render="@none" execute="@form" />

                    <notify:notifyMessages interval="1000" stack="bottomRightStack"

                        ajaxRendered="true" />

                </h:form>

                <hr />

                <h:form>

                    <rich:panel header="Change nickname:">

                        <h:inputText valueChangeListener="#{chatBean.leave}" id="cn" />

                        <a4j:commandButton value="Change" execute="@form"

                            action="#{chatBean.change}" />

                    </rich:panel>

                    <h:commandButton value="Disconnect" action="#{chatBean.leave}" />

     

                </h:form>

            </rich:panel>

  • 48. Re: Growl
    Bernard Labno Master

    As I understand, you want to trigger notify on some JavaScript event. To achieve this you don't need to nest any <notify:xxx/> tags. Just put this script into a4j:push:

    onerror="RichFaces.Notify({'text':event.rf.data,'title':'Error'} );"

     

     

    Remember to load apropriate resources for notify or nest some dummy <notify:notify/> tag:

    • org/richfaces/renderkit/html/scripts/jquery/jquery.js
    • org/richfaces/renderkit/html/scripts/jquery.pnotify.js
    • org/richfaces/renderkit/html/scripts/richfaces.pnotify.js
    • org/richfaces/renderkit/html/css/jquery.pnotify.xcss
  • 49. Re: Growl
    Jan Papousek Newbie

    Hi Bernard,

     

    firstly I must say that it's really cool component. I have tested it little and I have some questions:

    • Why the attribute showHistory is contained by both tags notify and notifyMessages? What should it do when its value is in both tags differently?
    • What is the functionality of attributes globalOnly and for in tag notifyMessages?

    and problem:

    • I have tried to set the attribute rendered to false (in both tags notify and notifyMessages), but nothing happened.

     

    Regards,

    Jan

  • 50. Re: Growl
    Bernard Labno Master

    Hello Jan,

    Why the attribute showHistory is contained by both tags notify and notifyMessages? What should it do when its value is in both tags differently?

    notify and notifyMessages are two separate components. notify requires you to provide text and title while notifyMessages renders FacesMessages, so it's similar to rich:messages. When you set showHistory i.e. true for notify and false for notifyMessages then FacesMessages will not be stacked in history, only the one from notify will.

    What is the functionality of attributes globalOnly and for in tag notifyMessages?

    It's same as in rich:messages. FacesMessage created by validator or converter for particluar component is not global so when you set globalOnly to true, then validation errors will not be displayed with notifyMessages.

    "for" attribute is like in h:message, it displays validation message for single field. (value of that attribute is id of that validated component.)

    m:

    I have tried to set the attribute rendered to false (in both tags notify and notifyMessages), but nothing happened.

    That's strange, i will investigate on this one.

     

    Thank you for your feedback.

  • 51. Re: Growl
    Jan Papousek Newbie

    Thank you for a quick response. Now I understand it and I will try it.

     

    The attribute rendered has the same behaviour in the context of notifyStack component (nothing happens).

  • 52. Re: Growl
    Jan Papousek Newbie

    I am sorry the bad behaviour of attribute rendered in tags notify and notifyMessages was my fault. However the attribute doesn't work in the tag notifyStack (I expect the stack and all its messages are hidden when rendered=false).

  • 53. Re: Growl
    Jan Papousek Newbie

    I have tried a validation and for attribute with two stacks (https://gist.github.com/1106505#). The notify component displays correctly. Each stack contains one message generated by notify component. On the other side the notifyMessages component produces all messages twice (into the both stacks).

  • 54. Re: Growl
    Bernard Labno Master

    On the other side the notifyMessages component produces all messages twice (into the both stacks).

    Jan, the behaviour is fine. You have two notifyMessages components where one posts messages in stack topRightStack and second in bottomRightStack. When you type something in field one than both fields get validated causing 2 messages. This results in 4 messages being displayed (2 in each stack) because of 2 notifyMessages.

  • 55. Re: Growl
    Bernard Labno Master

    In code i see that RichFaces.ui.NotifyStack.register JavaScript function is not rendered if i set "rendered" to false for one of the stacks, so the rendering of stack config is ok.

    It can be discussed if once the stack is not rendered the messages associated with that stack should also not be rendered.

    Personally I think not. It's the notify and notifyMessages components that should have "rendered" attribute apropriately set.

  • 56. Re: Growl
    Jan Papousek Newbie

    Jan, the behaviour is fine. You have two notifyMessages components where one posts messages in stack topRightStack and second in bottomRightStack. When you type something in field one than both fields get validated causing 2 messages. This results in 4 messages being displayed (2 in each stack) because of 2 notifyMessages.

    I thought that if I set the attribute for to number1, the notifyMessages produces only messages associated with the field with id number1.

     

    In code i see that RichFaces.ui.NotifyStack.register JavaScript function is not rendered if i set "rendered" to false for one of the stacks, so the rendering of stack config is ok.

    It can be discussed if once the stack is not rendered the messages associated with that stack should also not be rendered.

    Personally I think not. It's the notify and notifyMessages components that should have "rendered" attribute apropriately set.

    Ok, I understand. I think the notify and messages shouldn't be displayed but it's only my opinion.

     

    Thank you for your time.

    Jan

  • 57. Re: Growl
    Bernard Labno Master

    I thought that if I set the attribute for to number1, the notifyMessages produces only messages associated with the field with id number1.

    Oh, sorry, i've missed that "for" attribute. I'll investigate on this, cause it should be as you suggest.

  • 58. Re: Growl
    Lukáš Fryč Master

    Hi Bernard, what do you say about renaming stack's attributes stackDir1 to horizontalDir and stackDir2 to verticalDir?

  • 59. Re: Growl
    Bernard Labno Master

    Lukas, I think it's a good idea.