You are viewing a plain text version of this content. The canonical link for it is here.
Posted to adffaces-user@incubator.apache.org by "Correa, Luis Henrique" <lu...@eds.com> on 2007/03/26 13:36:07 UTC
Error on DemoNavigationItem.
Hi everybody , I'm having a trouble to create a navigationPane which changes the color of commandNavigationMenuItem when I select the item.
Here is my css .
.af_navigationPane_list-inactive-enabled{
width:150px;
list-style-type: none;
float: none;
vertical-align: top;
background: #F7F5ED;
border-top: 1px solid #fff;
text-decoration: none;
color: #000;
text-align: center;
}
.af_navigationPane_list-inactive-enabled a:hover{
background:#E0DDD5;
border-right: 4px solid #9D102D;
border-left: 4px solid #9D102D;
border-bottom: 1px solid #C1BBAB;
border-top: none;
display: block;
width:150px;
text-align: center;
}
.af_navigationPane_list-active-enabled a{
width:150px;
background: #9D102D;
border-top: 1px solid #fff;
text-decoration: none;
color: #fff;
text-align: center;
}
My class of MenuNavigationItem
package com.eds.bprm.view.action.action;
import java.util.List;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
import org.apache.myfaces.trinidad.bean.FacesBean;
import org.apache.myfaces.trinidad.bean.PropertyKey;
import org.apache.myfaces.trinidad.component.UIXCommand;
import org.apache.myfaces.trinidad.component.UIXNavigationHierarchy;
import org.apache.myfaces.trinidad.context.RequestContext;
public class MenuNavigationItem
{
public void navigationItemAction(ActionEvent event)
{
UIComponent actionItem = event.getComponent();
UIComponent parent = actionItem.getParent();
while(!(parent instanceof UIXNavigationHierarchy))
{
parent = parent.getParent();
if(parent == null)
{
System.err.println("Unexpected component hierarchy, no UIXNavigationHierarchy found.");
return;
}
}
List<UIXCommand> children = parent.getChildren();
for(UIXCommand child: children)
{
FacesBean childFacesBean = child.getFacesBean();
FacesBean.Type type = childFacesBean.getType();
PropertyKey selectedKey = type.findKey("selected");
if(selectedKey != null)
{
childFacesBean.setProperty(selectedKey, Boolean.valueOf((child == actionItem)));
}
}
RequestContext adfContext = RequestContext.getCurrentInstance();
adfContext.addPartialTarget(parent);
}
}
And my jsp menu.
<%@ page contentType="text/html;charset=windows-1252"%>
<%@ taglib uri="http://myfaces.apache.org/trinidad" prefix="tr"%>
<tr:form>
<tr:navigationPane hint="list">
<tr:commandNavigationItem text="#{bundle[\'menuRegister.menuParametersItem\']}"
action="parameter"
actionListener="#{navigationItem.navigationItemAction}"
partialSubmit="true"/>
<tr:commandNavigationItem text="#{bundle[\'menuRegister.menuIOFRegistry\']}"
action="iofRegister"
actionListener="#{navigationItem.navigationItemAction}"
partialSubmit="true"/>
<tr:commandNavigationItem text="#{bundle[\'menuRegister.menuUserProfile\']}"
action="userProfile"
actionListener="#{navigationItem.navigationItemAction}"
partialSubmit="true"/>
<tr:commandNavigationItem text="#{bundle[\'menuRegister.menuAlcadaProfile\']}"
action="alcadaProfile"
actionListener="#{navigationItem.navigationItemAction}"
partialSubmit="true"/>
</tr:navigationPane>
</tr:form>
So when I choose one item in menu , the color doesn't change , I don't know what I'm doing wrong because this example
is similar with the DemoNavigationItem , anyone can help me ?
Thanks
Luís Henrique Zerba Corrêa
EDS - Brazil - SP Java CoE
* 55 11 43931063
* luishenrique.correa@eds.com