Author: tmjee Date: Sat Jul 15 08:24:09 2006 New Revision: 422251 URL: http://svn.apache.org/viewvc?rev=422251&view=rev Log: WW-1317 - work on tooltip (changes due to switch to dojo tooltip)
Modified: struts/struts2/trunk/apps/showcase/src/main/webapp/tags/ui/example.jsp struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/UIBean.java struts/struts2/trunk/core/src/main/resources/template/xhtml/tooltip.ftl struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/TooltipTest.java struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/tooltip-1.txt struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/tooltip-2.txt struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/tooltip-3.txt Modified: struts/struts2/trunk/apps/showcase/src/main/webapp/tags/ui/example.jsp URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/main/webapp/tags/ui/example.jsp?rev=422251&r1=422250&r2=422251&view=diff ============================================================================== --- struts/struts2/trunk/apps/showcase/src/main/webapp/tags/ui/example.jsp (original) +++ struts/struts2/trunk/apps/showcase/src/main/webapp/tags/ui/example.jsp Sat Jul 15 08:24:09 2006 @@ -13,7 +13,7 @@ <saf:fielderror /> -<saf:form action="exampleSubmit" method="post" enctype="multipart/form-data"> +<saf:form action="exampleSubmit" method="post" enctype="multipart/form-data" tooltipConfig="#{'jsTooltipEnabled':'true'}"> <saf:textfield label="Name" name="name" @@ -113,8 +113,7 @@ doubleEmptyOption="true" doubleMultiple="true" /> - <saf:richtexteditor - width="700" + <saf:textarea label="Your Thougths" name="thoughts" tooltip="Enter your thoughts here" /> Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/UIBean.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/UIBean.java?rev=422251&r1=422250&r2=422251&view=diff ============================================================================== --- struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/UIBean.java (original) +++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/UIBean.java Sat Jul 15 08:24:09 2006 @@ -275,167 +275,23 @@ * <td>none</td> * <td>Set the tooltip of this particular component</td> * </tr> + * <tr> + * <td>jsTooltipEnabled</td> + * <td>String</td> + * <td>false</td> + * <td>Enable js tooltip rendering</td> + * </tr> * <tr> * <td>tooltipIcon</td> * <td>String</td> * <td>/struts/static/tooltip/tooltip.gif</td> * <td>The url to the tooltip icon</td> - * </tr> - * <td>tooltipAboveMousePointer</td> - * <td>Boolean</td> - * <td>false</td> - * <td>Places the tooltip above the mousepointer. Additionally applied the tooltipOffseY allows to set the vertical distance from the mousepointer.</td> - * </tr> - * <tr> - * <td>tooltipBgColor</td> - * <td>String</td> - * <td>#e6ecff</td> - * <td>Background color of the tooltip.</td> - * </tr> - * <tr> - * <td>tooltipBgImg</td> - * <td>String</td> - * <td>none</td> - * <td>Background image.</td> - * </tr> - * <tr> - * <td>tooltipBorderWidth</td> - * <td>String</td> - * <td>1</td> - * <td>Width of tooltip border.</td> - * </tr> - * <tr> - * <td>tooltipBorderColor</td> - * <td>String</td> - * <td>#003399</td> - * <td>Background color of the tooltip</td> - * </tr> * <tr> * <td>tooltipDelay</td> * <td>String</td> * <td>500</td> * <td>Tooltip shows up after the specified timeout (miliseconds). A behavior similar to that of OS based tooltips.</td> * </tr> - * <tr> - * <td>tooltipFixCoordinateX</td> - * <td>String</td> - * <td>not specified</td> - * <td>Fixes the tooltip to the X co-ordinates specified. Useful for example if combined with tooltipSticky attribute.</td> - * </tr> - * <tr> - * <td>tooltipFixCoordinateY</td> - * <td>String</td> - * <td>not specified</td> - * <td>Fixes the tooltip to the Y co-ordinates specified. Useful for example if combined with tooltipSticky attribute.</td> - * </tr> - * <tr> - * <td>tooltipFontColor</td> - * <td>String</td> - * <td>#000066</td> - * <td>Font color.</td> - * </tr> - * <tr> - * <td>tooltipFontFace</td> - * <td>String</td> - * <td>arial,helvetica,sans-serif</td> - * <td>Font face/family eg. verdana,geneva,sans-serif</td> - * </tr> - * <tr> - * <td>tooltipFontSize</td> - * <td>String</td> - * <td>11px</td> - * <td>Font size + unit eg. 30px</td> - * </tr> - * <tr> - * <td>tooltipFontWeight</td> - * <td>String</td> - * <td>normal</td> - * <td>Font weight. either normal or bold</td> - * </tr> - * <tr> - * <td>tooltipLeftOfMousePointer</td> - * <td>Boolean</td> - * <td>false</td> - * <td>Tooltip positioned on the left side of the mousepointer</td> - * </tr> - * <tr> - * <td>tooltipOffsetX</td> - * <td>String</td> - * <td>12</td> - * <td>Horizontal offset from mouse-pointer.</td> - * </tr> - * <tr> - * <td>tooltipOffsetY</td> - * <td>String</td> - * <td>15</td> - * <td>Vertical offset from mouse-pointer.</td> - * </tr> - * <tr> - * <td>tooltipOpacity</td> - * <td>String</td> - * <td>100</td> - * <td>Transparency of tooltip. Opacity is the opposite of transparency. Value must be a number between 0 (fully transparent) and 100 (opaque, no transparency). Not (yet) supported by Opera.</td> - * </tr> - * <tr> - * <td>tooltipPadding</td> - * <td>String</td> - * <td>3</td> - * <td>Inner spacing, ie. the spacing between border and content, for instance text or image(s)</td> - * </tr> - * <tr> - * <td>tooltipShadowColor</td> - * <td>String</td> - * <td>#cccccc</td> - * <td>Creates shadow with the specified color.</td> - * </tr> - * <tr> - * <td>tooltipShadowWidth</td> - * <td>String</td> - * <td>5</td> - * <td>Creates shodow with the specified width (offset).</td> - * </tr> - * <tr> - * <td>tooltipStatic</td> - * <td>Boolean</td> - * <td>false</td> - * <td>Like OS-based tooltips, the tooltip doesn't follow the movements of the mouse pointer.</td> - * </tr> - * <tr> - * <td>tooltipSticky</td> - * <td>Boolean</td> - * <td>false</td> - * <td>The tooltip stays fixed on its inital position until anohter tooltip is activated, or the user clicks on the document.</td> - * </tr> - * <tr> - * <td>tooltipStayAppearTime</td> - * <td>String</td> - * <td>0</td> - * <td>Specifies a time span in miliseconds after which the tooltip disappears, even if the mousepointer is still on the concerned HTML element, with value <=0 it acts as if no time span is defined</td> - * </tr> - * <tr> - * <td>tooltipTextAlign</td> - * <td>String</td> - * <td>left</td> - * <td>Aligns the text of both the title and the body of the tooltip. Either right, left or justify</td> - * </tr> - * <tr> - * <td>tooltipTitle</td> - * <td>String</td> - * <td>none</td> - * <td>title</td> - * </tr> - * <tr> - * <td>tooltipTitleColor</td> - * <td>String</td> - * <td>#ffffff</td> - * <td>Color of the title text</td> - * </tr> - * <tr> - * <td>tooltipWidth</td> - * <td>String</td> - * <td>300</td> - * <td>Width of tooltip</td> - * </tr> * </table> * * <!-- END SNIPPET: tooltipattributes --> @@ -873,11 +729,6 @@ addParameter("tooltip", findString(tooltip)); Map tooltipConfigMap = getTooltipConfig(this); - - - if (tooltipConfigMap.containsKey("tooltipIcon")) { - addParameter("tooltipIcon", tooltipConfigMap.get("tooltipIcon")); - } if (form != null) { // inform the containing form that we need tooltip javascript included form.addParameter("hasTooltip", Boolean.TRUE); Modified: struts/struts2/trunk/core/src/main/resources/template/xhtml/tooltip.ftl URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/template/xhtml/tooltip.ftl?rev=422251&r1=422250&r2=422251&view=diff ============================================================================== --- struts/struts2/trunk/core/src/main/resources/template/xhtml/tooltip.ftl (original) +++ struts/struts2/trunk/core/src/main/resources/template/xhtml/tooltip.ftl Sat Jul 15 08:24:09 2006 @@ -8,6 +8,7 @@ </#if><#t/> alt="${parameters.tooltip?html}" title="${parameters.tooltip?html}" /> + <#if parameters.jsTooltipEnabled?default('false') == 'true'> <span dojoType="tooltip" connectId="_tt${tooltipHashCode?string('#')}" <#if parameters.tooltipToggle?exists><#t/> <#t/>toggle="${parameters.tooltipToggle}"<#t/> @@ -19,4 +20,5 @@ <#t/>delay="${parameters.tooltipDelay}"<#t/> </#if><#t/> caption="${parameters.tooltip}"></span> + </#if> </#if><#t/> Modified: struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/TooltipTest.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/TooltipTest.java?rev=422251&r1=422250&r2=422251&view=diff ============================================================================== --- struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/TooltipTest.java (original) +++ struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/TooltipTest.java Sat Jul 15 08:24:09 2006 @@ -52,32 +52,8 @@ tag.setTooltipConfig( "#{" + "'tooltipIcon':'/struts/tooltip/myTooltip.gif', " + - "'tooltipAboveMousePointer':'true', " + - "'tooltipBgColor':'#ffffff', " + - "'tooltipBgImg':'/struts/tooltip/myBgImg.gif', " + - "'tooltipBorderWidth':'10', " + - "'tooltipBorderColor':'#eeeeee', " + - "'tooltipDelay':'2000', " + - "'tooltipFixCoordinateX':'300', " + - "'tooltipFixCoordinateY':'300', " + - "'tooltipFontColor':'#dddddd', " + - "'tooltipFontFace':'San-Serif,Verdana', " + - "'tooltipFontSize':'20', " + - "'tooltipFontWeight':'bold', " + - "'tooltipLeftOfMousePointer':'true', " + - "'tooltipOffsetX':'10', " + - "'tooltipOffsetY':'20', " + - "'tooltipOpacity':'90', " + - "'tooltipPadding':'30', " + - "'tooltipShadowColor':'#cccccc', " + - "'tooltipShadowWidth':'40', " + - "'tooltipStatic':'true', " + - "'tooltipSticky':'true', " + - "'tooltipStayAppearTime':'3000', " + - "'tooltipTextAlign':'right', " + - "'tooltipTitle':'MyTitle', " + - "'tooltipTitleColor':'#bbbbbb', " + - "'tooltipWidth':'600' " + + "'tooltipDelay':'500', " + + "'jsTooltipEnabled':'true' "+ "}" ); @@ -101,35 +77,11 @@ formTag.setAction("testAction"); formTag.setTooltipConfig( - "#{ " + - "'tooltipIcon':'/struts/tooltip/formMyTooltip.gif', " + - "'tooltipAboveMousePointer':'false', " + - "'tooltipBgColor':'#aaaaaa', " + - "'tooltipBgImg':'/struts/tooltip/formMyBgImg.gif', " + - "'tooltipBorderWidth':'11', " + - "'tooltipBorderColor':'#bbbbbb', " + - "'tooltipDelay':'2001', " + - "'tooltipFixCoordinateX':'301', " + - "'tooltipFixCoordinateY':'301', " + - "'tooltipFontColor':'#cccccc', " + - "'tooltipFontFace':'Verdana,San-Serif', " + - "'tooltipFontSize':'21', " + - "'tooltipFontWeight':'normal', " + - "'tooltipLeftOfMousePointer':'false', " + - "'tooltipOffsetX':'11', " + - "'tooltipOffsetY':'21', " + - "'tooltipOpacity':'91', " + - "'tooltipPadding':'31', " + - "'tooltipShadowColor':'#cccccc', " + - "'tooltipShadowWidth':'41', " + - "'tooltipStatic':'false', " + - "'tooltipSticky':'false', " + - "'tooltipStayAppearTime':'3001', " + - "'tooltipTextAlign':'left', " + - "'tooltipTitle':'FormMyTitle', " + - "'tooltipTitleColor':'#dddddd', " + - "'tooltipWidth':'601' " + - "}" + "#{" + + "'tooltipIcon':'/struts/tooltip/myTooltip.gif', " + + "'tooltipDelay':'500', " + + "'jsTooltipEnabled':'true' "+ + "}" ); @@ -160,35 +112,11 @@ formTag.setAction("testAction"); formTag.setTooltipConfig( - "#{ " + - "'tooltipIcon':'/struts/tooltip/formMyTooltip.gif', " + - "'tooltipAboveMousePointer':'false', " + - "'tooltipBgColor':'#aaaaaa', " + - "'tooltipBgImg':'/struts/tooltip/formMyBgImg.gif', " + - "'tooltipBorderWidth':'11', " + - "'tooltipBorderColor':'#bbbbbb', " + - "'tooltipDelay':'2001', " + - "'tooltipFixCoordinateX':'301', " + - "'tooltipFixCoordinateY':'301', " + - "'tooltipFontColor':'#cccccc', " + - "'tooltipFontFace':'Verdana,San-Serif', " + - "'tooltipFontSize':'21', " + - "'tooltipFontWeight':'normal', " + - "'tooltipLeftOfMousePointer':'false', " + - "'tooltipOffsetX':'11', " + - "'tooltipOffsetY':'21', " + - "'tooltipOpacity':'91', " + - "'tooltipPadding':'31', " + - "'tooltipShadowColor':'#cccccc', " + - "'tooltipShadowWidth':'41', " + - "'tooltipStatic':'false', " + - "'tooltipSticky':'false', " + - "'tooltipStayAppearTime':'3001', " + - "'tooltipTextAlign':'left', " + - "'tooltipTitle':'FormMyTitle', " + - "'tooltipTitleColor':'#dddddd', " + - "'tooltipWidth':'601' " + - "}" + "#{" + + "'tooltipIcon':'/struts/tooltip/myTooltip.gif', " + + "'tooltipDelay':'500', " + + "'jsTooltipEnabled':'true' "+ + "}" ); @@ -199,12 +127,10 @@ tag.setTooltip("myTooltip"); tag.setTooltipConfig( - "#{ " + - "'tooltipIcon':'/struts/tooltip/myTooltip.gif', " + - "'tooltipAboveMousePointer':'true', " + - "'tooltipBgColor':'#ffffff', " + - "'tooltipBgImg':'/struts/tooltip/myBgImg.gif' " + - "}" + "#{" + + "'tooltipIcon':'/struts/tooltip/myTooltip2.gif', " + + "'tooltipDelay':'5000' " + + "}" ); formTag.doStartTag(); @@ -231,35 +157,11 @@ formParamTag.setPageContext(pageContext); formParamTag.setName("tooltipConfig"); formParamTag.setValue( - "#{ " + - "'tooltipIcon':'/struts/tooltip/formMyTooltip.gif', " + - "'tooltipAboveMousePointer':'false', " + - "'tooltipBgColor':'#aaaaaa', " + - "'tooltipBgImg':'/struts/tooltip/formMyBgImg.gif', " + - "'tooltipBorderWidth':'11', " + - "'tooltipBorderColor':'#bbbbbb', " + - "'tooltipDelay':'2001', " + - "'tooltipFixCoordinateX':'301', " + - "'tooltipFixCoordinateY':'301', " + - "'tooltipFontColor':'#cccccc', " + - "'tooltipFontFace':'Verdana,San-Serif', " + - "'tooltipFontSize':'21', " + - "'tooltipFontWeight':'normal', " + - "'tooltipLeftOfMousePointer':'false', " + - "'tooltipOffsetX':'11', " + - "'tooltipOffsetY':'21', " + - "'tooltipOpacity':'91', " + - "'tooltipPadding':'31', " + - "'tooltipShadowColor':'#cccccc', " + - "'tooltipShadowWidth':'41', " + - "'tooltipStatic':'false', " + - "'tooltipSticky':'false', " + - "'tooltipStayAppearTime':'3001', " + - "'tooltipTextAlign':'left', " + - "'tooltipTitle':'FormMyTitle', " + - "'tooltipTitleColor':'#dddddd', " + - "'tooltipWidth':'601' " + - "}" + "#{" + + "'tooltipIcon':'/struts/tooltip/myTooltip.gif', " + + "'tooltipDelay':'500', " + + "'jsTooltipEnabled':'true' "+ + "}" ); @@ -273,12 +175,10 @@ textFieldParamTag.setPageContext(pageContext); textFieldParamTag.setName("tooltipConfig"); textFieldParamTag.setValue( - "#{ " + - "'tooltipIcon':'/struts/tooltip/myTooltip.gif', " + - "'tooltipAboveMousePointer':'true', " + - "'tooltipBgColor':'#ffffff', " + - "'tooltipBgImg':'/struts/tooltip/myBgImg.gif' " + - "}" + "#{" + + "'tooltipIcon':'/struts/tooltip/myTooltip2.gif', " + + "'tooltipDelay':'5000' "+ + "}" ); formTag.doStartTag(); @@ -310,33 +210,9 @@ formParamTag.setName("tooltipConfig"); StrutsMockBodyContent bodyContent = new StrutsMockBodyContent(new MockJspWriter()); bodyContent.setString( - "tooltipIcon = /struts/tooltip/formMyTooltip.gif | " + - "tooltipAboveMousePointer = false | " + - "tooltipBgColor = #aaaaaa| " + - "tooltipBgImg = /struts/tooltip/formMyBgImg.gif | " + - "tooltipBorderWidth = 11 | " + - "tooltipBorderColor = #bbbbbb| " + - "tooltipDelay = 2001 | " + - "tooltipFixCoordinateX = 301| " + - "tooltipFixCoordinateY = 301| " + - "tooltipFontColor = #cccccc | " + - "tooltipFontFace = Verdana,San-Serif | " + - "tooltipFontSize = 21 | " + - "tooltipFontWeight = normal | " + - "tooltipLeftOfMousePointer = false | " + - "tooltipOffsetX = 11 | " + - "tooltipOffsetY = 21| " + - "tooltipOpacity = 91| " + - "tooltipPadding = 31| " + - "tooltipShadowColor = #cccccc| " + - "tooltipShadowWidth = 41| " + - "tooltipStatic = false | " + - "tooltipSticky = false| " + - "tooltipStayAppearTime = 3001| " + - "tooltipTextAlign = left| " + - "tooltipTitle = FormMyTitle| " + - "tooltipTitleColor = #dddddd| " + - "tooltipWidth = 601 " + "tooltipIcon=/struts/tooltip/myTooltip.gif| " + + "tooltipDelay=500| " + + "jsTooltipEnabled=true " ); formParamTag.setBodyContent(bodyContent); @@ -352,10 +228,8 @@ textFieldParamTag.setName("tooltipConfig"); StrutsMockBodyContent bodyContent2 = new StrutsMockBodyContent(new MockJspWriter()); bodyContent2.setString( - "tooltipIcon = /struts/tooltip/myTooltip.gif | " + - "tooltipAboveMousePointer = true | " + - "tooltipBgColor = #ffffff | " + - "tooltipBgImg = /struts/tooltip/myBgImg.gif " + "tooltipIcon=/struts/tooltip/myTooltip2.gif| " + + "tooltipDelay=5000 " ); textFieldParamTag.setBodyContent(bodyContent2); @@ -367,6 +241,8 @@ textFieldParamTag.doEndTag(); tag.doEndTag(); formTag.doEndTag(); + + System.out.println(writer.toString()); verify(TooltipTest.class.getResource("tooltip-3.txt")); } Modified: struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/tooltip-1.txt URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/tooltip-1.txt?rev=422251&r1=422250&r2=422251&view=diff ============================================================================== --- struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/tooltip-1.txt (original) +++ struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/tooltip-1.txt Sat Jul 15 08:24:09 2006 @@ -7,7 +7,7 @@ alt="myTooltip" title="myTooltip" /> - <span dojoType="tooltip" connectId="_tt1507188919" delay="2000" + <span dojoType="tooltip" connectId="_tt1507188919" delay="500" caption="myTooltip"></span> </label></td> <td><input type="text" name="" id="myId"/></td> Modified: struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/tooltip-2.txt URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/tooltip-2.txt?rev=422251&r1=422250&r2=422251&view=diff ============================================================================== --- struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/tooltip-2.txt (original) +++ struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/tooltip-2.txt Sat Jul 15 08:24:09 2006 @@ -3,11 +3,11 @@ <tr> <td class="tdLabel"><label for="myId" class="label">MyLabel: <img id="_tt1507188919" - src='/struts/tooltip/formMyTooltip.gif' + src='/struts/tooltip/myTooltip.gif' alt="myTooltip" title="myTooltip" /> - <span dojoType="tooltip" connectId="_tt1507188919" delay="2001" + <span dojoType="tooltip" connectId="_tt1507188919" delay="500" caption="myTooltip"></span> </label></td> <td><input type="text" name="" id="myId"/></td> Modified: struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/tooltip-3.txt URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/tooltip-3.txt?rev=422251&r1=422250&r2=422251&view=diff ============================================================================== --- struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/tooltip-3.txt (original) +++ struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/tooltip-3.txt Sat Jul 15 08:24:09 2006 @@ -3,11 +3,11 @@ <tr> <td class="tdLabel"><label for="myId" class="label">MyLabel: <img id="_tt1507188919" - src='/struts/tooltip/myTooltip.gif' + src='/struts/tooltip/myTooltip2.gif' alt="myTooltip" title="myTooltip" /> - <span dojoType="tooltip" connectId="_tt1507188919" delay="2001" + <span dojoType="tooltip" connectId="_tt1507188919" delay="5000" caption="myTooltip"></span> </label></td> <td><input type="text" name="" id="myId"/></td>