You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by we...@apache.org on 2007/02/19 09:48:04 UTC

svn commit: r509132 - /myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MenuBarRenderer.java

Author: weber
Date: Mon Feb 19 00:48:03 2007
New Revision: 509132

URL: http://svn.apache.org/viewvc?view=rev&rev=509132
Log:
(TOBAGO-167) Enable rendering popups by ajax request
  fix onclick in menuItems

Modified:
    myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MenuBarRenderer.java

Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MenuBarRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MenuBarRenderer.java?view=diff&rev=509132&r1=509131&r2=509132
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MenuBarRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MenuBarRenderer.java Mon Feb 19 00:48:03 2007
@@ -353,7 +353,7 @@
 
   private void addMenuEntry(StringBuilder sb, String var, FacesContext facesContext,
                             UICommand command) throws IOException {
-    String onClick = createOnClick(facesContext, command);
+    String onClick = HtmlRendererUtil.createOnClick(facesContext, command);
     if (command instanceof UIMenuCommand) {
       if (command.getFacet(FACET_ITEMS) != null) {
         UIComponent facet = command.getFacet(FACET_ITEMS);
@@ -370,24 +370,6 @@
     } else if (command instanceof UISelectOneCommand) {
       addSelectOne(sb, var, facesContext, command, onClick);
     }
-  }
-
-  private String createOnClick(FacesContext facesContext,
-                               UIComponent component) {
-    String clientId = component.getClientId(facesContext);
-    String onclick;
-
-    if (component.getAttributes().get(ATTR_ACTION_LINK)!=null) {
-      onclick = "Tobago.navigateToUrl('"
-          + HtmlUtils.generateUrl(facesContext, (String) component.getAttributes().get(ATTR_ACTION_LINK)) + "');";
-    //} else if (COMMAND_TYPE_RESET.equals(type)) {
-    //  onclick = null;
-    } else if (component.getAttributes().get(ATTR_ACTION_ONCLICK)!=null) {
-      onclick = (String) component.getAttributes().get(ATTR_ACTION_ONCLICK);
-    } else { // default: Action.TYPE_SUBMIT
-      onclick = "Tobago.submitAction('" + clientId + "');";
-    }
-    return onclick;
   }
 
   private void addCommand(StringBuilder sb, String var, FacesContext facesContext,