just applied your patch. It's in svn.

Cheers
Thomas

On 12/19/05, Grigoras Cristinel <[EMAIL PROTECTED]> wrote:
Hi Thomas,

Please look to this bug, and merge the fix.
http://issues.apache.org/jira/browse/MYFACES-900


Thanks very much.
Cristi



Thomas Spiegl wrote:
Hi,

I implemented the actionListener for JSCookMenu. Get the latest version from SVN or use nightly build to get the new feature.
Attached you will find an example.

1) Example 1  Static
<t:navigationMenuItem id="nav_2"
    actionListener="#{navigationMenu.actionListener}"
    itemLabel="#{example_messages['nav_Home']}"
    itemValue="go_home"
    action=""
The actionListener JSCookMenuBean.actionListener(ActionEvent event) will be executed. HtmlCommandJSCookMenu is now holding the itemValue of the clicked menu entry. Additionaly the action attribute may be given to trigger a page navigation.

2) Example 2 Dynamic
Shows how to generate menu items 'dynamically' by using NavigationMenuItem(s) + how to define an ActionListener per item (see JSCookMenuBean.getJSCookMenuNavigationItems())
The actionListener JSCookMenuBean.actionListener(ActionEvent event) will be executed. HtmlCommandJSCookMenu is now holding the value that was set for the NavigationMenuItem (see JSCookMenuBean.getMenuNaviagtionItem(...))

Cheers
Thomas



On 12/19/05, Thomas Spiegl <[EMAIL PROTECTED] > wrote:
Yes thats right, you cannot pass values to your action Method. The actionListener feature needs to be added to the JSCookMenu.

Thomas


On 12/19/05, Dudu <[EMAIL PROTECTED]> wrote:
Thanks Thomas,
But do you know  how I can get what  navigationMenuItem was clicked,
because it are created dinamically, and depending the navigationMenuItem
clicked, a tab will be created......
I cannot to call a action passing some values? Am I right?
I'm stopped because this problem.
Thanks again.


Thomas Spiegl wrote:
> ActionListener does not work with jscookMenu and navigationMenuItem.
> You may use the navigationMenuItem.action attribute to trigger your
> backingBean action.
>
> Regards
> Thomas
>
> On 12/19/05, *Dudu* < [EMAIL PROTECTED]
> <mailto: [EMAIL PROTECTED]>> wrote:
>
>     Sorry,
>     JscoockMenu
>
>     ps: I'm reading about <adf:setActionListener> to know if it solve this
>     problem, but I'm no sure about it.....
>     thanks
>
>     Thomas Spiegl wrote:
>     > What kind of menu are you using jscookMenu or panelNavigation2?
>     >
>     > Thomas
>     >
>     > On 12/19/05, *Dudu* < [EMAIL PROTECTED]
>     <mailto: [EMAIL PROTECTED]>
>     > <mailto: [EMAIL PROTECTED]
>     <mailto:[EMAIL PROTECTED]>>> wrote:
>     >
>     >     Hi,
>     >     I several NavigationMenuItems, created dinamically. I want
>     when a
>     >     user
>     >     click on a menu,  I want to create a new tab.....
>     >
>     >     But I do not know:
>     >     1 - How to get what navigationMenuItem was clicked.
>     >     2 - How to set dynamically a method of a backing bean?
>     >
>     >     Initially is this
>     >
>     >
>     >
>     >
>     >
>     >
>     >     _______________________________________________________
>     >     Yahoo! doce lar. Faça do Yahoo! sua homepage.
>     >     http://br.yahoo.com/homepageset.html
>     >
>     >
>     >
>     >
>     > --
>     > http://www.irian.at
>     >
>     > Your JSF powerhouse -
>     > JSF Consulting, Development and
>     > Courses in English and German
>     >
>     > Professional Support for Apache MyFaces
>     S
>
>
>
>
>
>     _______________________________________________________
>     Yahoo! doce lar. Faça do Yahoo! sua homepage.
>     http://br.yahoo.com/homepageset.html
>
>
>
>
> --
> http://www.irian.at
>
> Your JSF powerhouse -
> JSF Consulting, Development and
> Courses in English and German
>
> Professional Support for Apache MyFaces






_______________________________________________________
Yahoo! doce lar. Faça do Yahoo! sua homepage.
http://br.yahoo.com/homepageset.html




--

http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces



--
http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces




/*
* Copyright 2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0

*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.myfaces.examples.misc;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory
;
import org.apache.myfaces.custom.navmenu.NavigationMenuItem;
import org.apache.myfaces.custom.navmenu.jscookmenu.HtmlCommandJSCookMenu;

import javax.faces.event.ActionEvent ;
import java.util.ArrayList;

import java.util.List;

/**
* @author Thomas Spiegl
*/
public class JSCookMenuBean {
private static final Log log = LogFactory.getLog(JSCookMenuBean.class);

public List getJSCookMenuNavigationItems()

{
List menu = new ArrayList();
menu.add(getMenuNaviagtionItem("Home", "go_home"));
return menu;
}

private static NavigationMenuItem getMenuNaviagtionItem(String label, String action)

{
NavigationMenuItem item = new NavigationMenuItem(label, action);
item.setActionListener ("#{navigationMenu.actionListener}");
item.setValue(label);
return item;

}

public String actionListener(ActionEvent event)
{
String outcome = (String)((HtmlCommandJSCookMenu) event.getComponent()).getValue();
log.info("ActionListener: " + outcome);

return outcome;
}
}


















--
http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces

Reply via email to