Author: ludovic
Date: 2008-01-03 13:03:27 +0100 (Thu, 03 Jan 2008)
New Revision: 6612

Modified:
   
xwiki-platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/doc/XWikiDocument.java
   
xwiki-platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/objects/classes/PropertyClass.java
Log:
XWIKI-1980 .displayTooltip should support internationalized strings

Modified: 
xwiki-platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/doc/XWikiDocument.java
===================================================================
--- 
xwiki-platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/doc/XWikiDocument.java
     2008-01-03 12:02:16 UTC (rev 6611)
+++ 
xwiki-platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/doc/XWikiDocument.java
     2008-01-03 12:03:27 UTC (rev 6612)
@@ -1309,7 +1309,7 @@
     {
         try {
             PropertyClass pclass = (PropertyClass) 
obj.getxWikiClass(context).get(fieldname);
-            String tooltip = pclass.getTooltip();
+            String tooltip = pclass.getTooltip(context);
             if ((tooltip != null) && (!tooltip.trim().equals(""))) {
                 String img = "<img src=\"" + 
context.getWiki().getSkinFile("info.gif", context) +
                     "\" class=\"tooltip_image\" align=\"middle\" />";

Modified: 
xwiki-platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/objects/classes/PropertyClass.java
===================================================================
--- 
xwiki-platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/objects/classes/PropertyClass.java
 2008-01-03 12:02:16 UTC (rev 6611)
+++ 
xwiki-platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/objects/classes/PropertyClass.java
 2008-01-03 12:03:27 UTC (rev 6612)
@@ -330,6 +330,24 @@
         return getLargeStringValue("tooltip");
     }
 
+    /**
+     * Gets international tooltip
+     * @param context
+     * @return
+     */
+    public String getTooltip(XWikiContext context)
+    {
+        String tooltipName = getFieldFullName() + "_tooltip";
+        String tooltip = context.getWiki().getMessage(tooltipName, context);
+        if (tooltipName.equals(tooltip)) {
+            tooltipName = getLargeStringValue("tooltip");
+            if ((tooltipName!=null)&&(!tooltipName.trim().equals(""))) {
+                tooltip = context.getWiki().getMessage(tooltipName, context);
+            }
+        }
+        return tooltip;           
+    }
+
     public void setTooltip(String tooltip)
     {
         setLargeStringValue("tooltip", tooltip);

_______________________________________________
notifications mailing list
notifications@xwiki.org
http://lists.xwiki.org/mailman/listinfo/notifications

Reply via email to