myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From svieu...@apache.org
Subject svn commit: r179495 - in /myfaces/trunk/src/components/org/apache/myfaces/custom/navmenu: jscookmenu/HtmlJSCookMenuRenderer.java jscookmenu/resource/ jscookmenu/resource/MyFacesHack.js resource/
Date Thu, 02 Jun 2005 03:20:13 GMT
Author: svieujot
Date: Wed Jun  1 20:20:12 2005
New Revision: 179495

URL: http://svn.apache.org/viewcvs?rev=179495&view=rev
Log:
MyFaces : Fix JSCookMenu, and slight refactor.

Added:
    myfaces/trunk/src/components/org/apache/myfaces/custom/navmenu/jscookmenu/resource/
      - copied from r179489, myfaces/trunk/src/components/org/apache/myfaces/custom/navmenu/resource/jscookmenu/
    myfaces/trunk/src/components/org/apache/myfaces/custom/navmenu/jscookmenu/resource/MyFacesHack.js
  (with props)
Removed:
    myfaces/trunk/src/components/org/apache/myfaces/custom/navmenu/resource/
Modified:
    myfaces/trunk/src/components/org/apache/myfaces/custom/navmenu/jscookmenu/HtmlJSCookMenuRenderer.java

Modified: myfaces/trunk/src/components/org/apache/myfaces/custom/navmenu/jscookmenu/HtmlJSCookMenuRenderer.java
URL: http://svn.apache.org/viewcvs/myfaces/trunk/src/components/org/apache/myfaces/custom/navmenu/jscookmenu/HtmlJSCookMenuRenderer.java?rev=179495&r1=179494&r2=179495&view=diff
==============================================================================
--- myfaces/trunk/src/components/org/apache/myfaces/custom/navmenu/jscookmenu/HtmlJSCookMenuRenderer.java
(original)
+++ myfaces/trunk/src/components/org/apache/myfaces/custom/navmenu/jscookmenu/HtmlJSCookMenuRenderer.java
Wed Jun  1 20:20:12 2005
@@ -150,7 +150,7 @@
     {
         for (int i = 0; i < items.length; i++)
         {
-            NavigationMenuItem item = (NavigationMenuItem)items[i];
+            NavigationMenuItem item = items[i];
             Object tempObj = null;
             UINavigationMenuItem uiNavMenuItem = null;
             if (i < uiNavMenuItemList.size()) {
@@ -186,7 +186,7 @@
             }
             else
             {
-                writer.write("''");
+                writer.write("null");
             }
             writer.write(", '");
             if( item.getLabel() != null ) {
@@ -208,7 +208,7 @@
             {
                 writer.write("null");
             }
-            writer.write(", '#', null");
+            writer.write(", 'linkDummyForm', null"); // TODO Change here to allow the use
of non dummy form if possible.
 
             if (item.isRendered() && ! item.isDisabled()) {
                 // render children only if parent is visible/enabled
@@ -225,7 +225,7 @@
                                 new ArrayList(1), menuId);
                     } 
                 }
-            };
+            }
             writer.write("]");
         }
     }
@@ -257,19 +257,20 @@
         RendererUtils.checkParamValidity(context, component, HtmlCommandJSCookMenu.class);
         HtmlCommandJSCookMenu menu = (HtmlCommandJSCookMenu)component;
         
-        AddResource.addJavaScriptToHeader(NavigationMenuItem.class, "jscookmenu/JSCookMenu.js",
context);
+        AddResource.addJavaScriptToHeader(HtmlJSCookMenuRenderer.class, "JSCookMenu.js",
context);
+        AddResource.addJavaScriptToHeader(HtmlJSCookMenuRenderer.class, "MyFacesHack.js",
context);
 
-        AddResource.addJavaScriptToHeader(NavigationMenuItem.class, "jscookmenu/ThemeOffice/theme.js",
context);
-        AddResource.addStyleSheet(NavigationMenuItem.class, "jscookmenu/ThemeOffice/theme.css",
context);
+        AddResource.addJavaScriptToHeader(HtmlJSCookMenuRenderer.class, "ThemeOffice/theme.js",
context);
+        AddResource.addStyleSheet(HtmlJSCookMenuRenderer.class, "ThemeOffice/theme.css",
context);
 
-        AddResource.addJavaScriptToHeader(NavigationMenuItem.class, "jscookmenu/ThemeMiniBlack/theme.js",
context);
-        AddResource.addStyleSheet(NavigationMenuItem.class, "jscookmenu/ThemeMiniBlack/theme.css",
context);
+        AddResource.addJavaScriptToHeader(HtmlJSCookMenuRenderer.class, "ThemeMiniBlack/theme.js",
context);
+        AddResource.addStyleSheet(HtmlJSCookMenuRenderer.class, "ThemeMiniBlack/theme.css",
context);
 
-        AddResource.addJavaScriptToHeader(NavigationMenuItem.class, "jscookmenu/ThemeIE/theme.js",
context);
-        AddResource.addStyleSheet(NavigationMenuItem.class, "jscookmenu/ThemeIE/theme.css",
context);
+        AddResource.addJavaScriptToHeader(HtmlJSCookMenuRenderer.class, "ThemeIE/theme.js",
context);
+        AddResource.addStyleSheet(HtmlJSCookMenuRenderer.class, "ThemeIE/theme.css", context);
 
-        AddResource.addJavaScriptToHeader(NavigationMenuItem.class, "jscookmenu/ThemePanel/theme.js",
context);
-        AddResource.addStyleSheet(NavigationMenuItem.class, "jscookmenu/ThemePanel/theme.css",
context);
+        AddResource.addJavaScriptToHeader(HtmlJSCookMenuRenderer.class, "ThemePanel/theme.js",
context);
+        AddResource.addStyleSheet(HtmlJSCookMenuRenderer.class, "ThemePanel/theme.css", context);
         
         ResponseWriter writer = context.getResponseWriter();
 

Added: myfaces/trunk/src/components/org/apache/myfaces/custom/navmenu/jscookmenu/resource/MyFacesHack.js
URL: http://svn.apache.org/viewcvs/myfaces/trunk/src/components/org/apache/myfaces/custom/navmenu/jscookmenu/resource/MyFacesHack.js?rev=179495&view=auto
==============================================================================
--- myfaces/trunk/src/components/org/apache/myfaces/custom/navmenu/jscookmenu/resource/MyFacesHack.js
(added)
+++ myfaces/trunk/src/components/org/apache/myfaces/custom/navmenu/jscookmenu/resource/MyFacesHack.js
Wed Jun  1 20:20:12 2005
@@ -0,0 +1,51 @@
+//
+// Overrides the original JSCookMenu function to work with MyFaces
+//
+function cmItemMouseUp (obj, index)
+{
+	var item = _cmItemList[index];
+
+	var link = null, target = '_self';
+
+	if (item.length > 2)
+		link = item[2];
+	if (item.length > 3 && item[3])
+		target = item[3];
+
+	if (link != null)
+	{
+         // changes by royalts (Thomas Spiegl)
+         var action = link;
+         var form = target;
+         var dummyForm = document.forms[ form ];
+         dummyForm.elements['jscook_action'].value = action;
+         dummyForm.submit();
+         //window.open (link, target);
+	}
+
+	var prefix = obj.cmPrefix;
+	var thisMenu = cmGetThisMenu (obj, prefix);
+
+	var hasChild = (item.length > 5);
+	if (!hasChild)
+	{
+		if (cmIsDefaultItem (item))
+		{
+			if (obj.cmIsMain)
+				obj.className = prefix + 'MainItem';
+			else
+				obj.className = prefix + 'MenuItem';
+		}
+		cmHideMenu (thisMenu, null, prefix);
+	}
+	else
+	{
+		if (cmIsDefaultItem (item))
+		{
+			if (obj.cmIsMain)
+				obj.className = prefix + 'MainItemHover';
+			else
+				obj.className = prefix + 'MenuItemHover';
+		}
+	}
+}
\ No newline at end of file

Propchange: myfaces/trunk/src/components/org/apache/myfaces/custom/navmenu/jscookmenu/resource/MyFacesHack.js
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/trunk/src/components/org/apache/myfaces/custom/navmenu/jscookmenu/resource/MyFacesHack.js
------------------------------------------------------------------------------
    svn:keywords = "Id Author LastChangedDate LastChangedBy LastChangedRevision"

Propchange: myfaces/trunk/src/components/org/apache/myfaces/custom/navmenu/jscookmenu/resource/MyFacesHack.js
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message