8 Replies Latest reply on Jan 12, 2006 8:51 AM by Woodler

    Tooltip text to maximized button

    santhosh k Newbie

      Hi,

      How can we add tooltip text to maximized/minimized buttons in portlets in JBoss Portal 2.2.0 ?

        • 1. Re: Tooltip text to maximized button
          paul tamaro Newbie

          We're definitely looking into this -- it wasn't overlooked, but rather, we were having problems implementing it if I remember correctly...

          If by "tooltip" you mean either ALT or TITLE attributes for each mode, then this could be done in the portlet RenderSet which creates the portlet window elements for each portlet. Some browsers see ALT, others see TITLE so it's best to use both (imho).

          That said, there are a few issues that come to mind, for example do you need to support multiple-languages? Also, each mode will need a variable to determine which text string to load (Maximize, Minimize, Edit, etc.), and this variable can be used for both the ALT and TITLE attribute.

          Is this what you meant, and/or is it clear and helpful at all?

          • 2. Re: Tooltip text to maximized button
            Woodler Expert

            The title attribute can be added to the render set. The markup that spans the portlet decoration is generated by the renderSet. In the default OTB case of the portal, this is a class called /theme/src/main/org/jboss/portal/theme/impl/render/DivDecorationRenderer

            you can change the code, or create your own renderSet and configure it for your portal (see the doc for details on that)

             private static void renderModeAndStateLinks(RenderContext ctx, WindowResult result, String selector)
             {
             log.debug("render modes and states");
             Collection modes = result.getTriggerableActions(selector);
             for (Iterator i=modes.iterator(); i.hasNext(); ){
             WindowResult.Action action = (WindowResult.Action)i.next();
             if (action.isEnabled()){
             log.debug("action is enabled: " + action.getName());
             ctx.getMarkupFragment().append("<div class=\"portlet-mode-").append(action.getName());
             ctx.getMarkupFragment().append("\" onClick=\"location.href='").append(action.getURL()).append("';\" title=\"this is the title content\"></div>");
             }
             }
             }
            


            as you can see in this snippet, you can place whatever text into the title attribute. Since you have the mode and state (and much more), you can dynamically determine what to render in the title ....


            • 3. Re: Tooltip text to maximized button
              santhosh k Newbie

              Thanks Paul. But I think what you told is for html. But here, in JBoss Portal 2.2, how can we do it for maximized/minimized images (which are not specified inside default/index.html)? I think it's not a possible way what you said. Right?

              • 4. Re: Tooltip text to maximized button
                Woodler Expert

                again: it's the renderSet that does that (inject the html that ultimately displays the images for the modes and states , in combination with the theme css). So do what I showed in the previous post and you get your tool tips.
                I actually changed the cvs HEAD to have that OTB now.

                • 5. Re: Tooltip text to maximized button
                  Danny Hon Newbie

                  I need to accomplish the same thing. Is there any ways that I can get the locale of the user in the DivDecorationRenderer.java so that I can internationalize the TITLE?

                  • 6. Re: Tooltip text to maximized button
                    Woodler Expert

                    I just looked at the code. It's not available.

                    I created http://jira.jboss.com/jira/browse/JBPORTAL-555 for this

                    • 7. Re: Tooltip text to maximized button
                      santhosh k Newbie

                      Thanks mholzner, it worked!

                      But here arises another doubt: How can we write different tooltips for maximize,minimize,edit,.. buttons/images? What additional coding is needed in the procedure u told about? Plz send me the latest version of ur previous answer : )

                      • 8. Re: Tooltip text to maximized button
                        Woodler Expert

                        you can get the lastest code from cvs HEAD

                        The way this currently works (images and links for modes and states) is that the renderSet injects div tags with class attributes that are matched by the theme. So it is the theme that determines the image and the arrangement (look&feel). You can continue down that road and create your own class attributes for the special cases you want to cover. You can add those selectors to the theme css, or add an additional css file that handles those additional cases. You could of corse change the renderSet so it directly injects the images, circumventing the theme all together.