11 Replies Latest reply on Jul 23, 2009 3:28 AM by abuit

    Show hotKeys in contextmenu

      We use the contextmenu and all the items can also be triggered by hotkeys. Now we want to show the keyboard hotkey to the user of the application.

      Is this possible or can this be added to the contextmenu component?

        • 1. Re: Show hotKeys in contextmenu
          ilya_shaikovsky

          rich:hotKey should help you.

          • 2. Re: Show hotKeys in contextmenu

            Sorry, I think the meaning of my post was not clear.

            The hotkeys are working fine, but I want to show the user what the shortkey is of that action. I would like to show this in the contextmenu near the items with a right alignment.

            Is this possible or can this be a new feature of the contextmenu?

            • 3. Re: Show hotKeys in contextmenu
              ilya_shaikovsky

              why not possible. just define the label of the menu not using attribute but using nested components so you could achieve needed markup.

              • 4. Re: Show hotKeys in contextmenu

                I tried that, but I could not align the two labels left and right because they are in a span. I tried to use float i inline style, but than my 2nd label jumps to below.

                • 5. Re: Show hotKeys in contextmenu

                   

                  "ilya_shaikovsky" wrote:
                  why not possible. just define the label of the menu not using attribute but using nested components so you could achieve needed markup.


                  We are using dynamic JSF, and it's not possible to set an UIComponent as the value of the HtmlMenuItem. (Well, you can but it'll show a memory reference, it won't be encoded).

                  Since the HtmlMenuItems are rendered with some non-default renderer, it's hard to squeeze in some other UIComponents during the render phase.

                  This is the issue, help would be greatly appricated.

                  • 6. Re: Show hotKeys in contextmenu
                    ilya_shaikovsky

                    you should not define UIComponent as value but just add it as child.

                    • 7. Re: Show hotKeys in contextmenu

                      Ilya, thanks for your reply.

                      The items from the context menu are rendered as followed:

                      <div "The item">
                       <span "The icon"><img/></span>
                       <span "The text">...</span>
                      </div>


                      When I add a child to the component, it'll be rendered nested in the text span.

                      <div "The item">
                       <span "The icon"><img/></span>
                       <span "The text">...<child components></span>
                      </div>


                      result: http://img136.imageshack.us/img136/9889/contextmenunofloat.png

                      Because the child components are rendered inside this span element, I cannot align them to the right properly. When I add the float:right; attribute to the child components, the outline will be messed up.

                      result: http://img115.imageshack.us/img115/8223/contextmenufloatright.png

                      The desired situation is that the child component is rendered after the span, so a div can be placed in the wrapper div, to align the text to the proper position, the same way context menu groups have their > icon rendered. Or, ofcourse, a facet for this feature.


                      <div "The item">
                       <span "The icon"><img/></span>
                       <span "The text">...</span>
                       <child components>
                      </div>


                      Thanks again for your time.

                      • 8. Re: Show hotKeys in contextmenu
                        ilya_shaikovsky

                        how about to use table? I understand that not looks good enough but just as workaround?

                        • 9. Re: Show hotKeys in contextmenu

                          A block element inside an inline element will make everything look.. a bit funky.

                          I would really appriciate it if the children would be rendered after the icon and text span tags, this would help us out alot.

                          Thanks again for your reply!

                          • 10. Re: Show hotKeys in contextmenu
                            ilya_shaikovsky

                            yes.. sounds not good at all :/ please feel free to create an RFC to RF jira.

                            • 11. Re: Show hotKeys in contextmenu