You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by to...@apache.org on 2005/12/05 02:09:34 UTC
svn commit: r353951 -
/myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/navmenu/htmlnavmenu/HtmlNavigationMenuRenderer.java
Author: tomsp
Date: Sun Dec 4 17:09:30 2005
New Revision: 353951
URL: http://svn.apache.org/viewcvs?rev=353951&view=rev
Log:
fixed ValueBinding issue (rendered, ...)
Modified:
myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/navmenu/htmlnavmenu/HtmlNavigationMenuRenderer.java
Modified: myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/navmenu/htmlnavmenu/HtmlNavigationMenuRenderer.java
URL: http://svn.apache.org/viewcvs/myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/navmenu/htmlnavmenu/HtmlNavigationMenuRenderer.java?rev=353951&r1=353950&r2=353951&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/navmenu/htmlnavmenu/HtmlNavigationMenuRenderer.java (original)
+++ myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/navmenu/htmlnavmenu/HtmlNavigationMenuRenderer.java Sun Dec 4 17:09:30 2005
@@ -32,6 +32,7 @@
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import javax.faces.event.ActionListener;
+import javax.faces.el.ValueBinding;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
@@ -282,22 +283,26 @@
for (int j = 0; j < listeners.length; j++)
{
newItem.addActionListener(listeners[j]);
-
}
// value
newItem.setValue(uiNavMenuItem.getValue());
// immeditate
- newItem.setImmediate(uiNavMenuItem.isImmediate());
+ if (!copyValueBinding(uiNavMenuItem, newItem, "immediate"))
+ newItem.setImmediate(uiNavMenuItem.isImmediate());
// transient, rendered
- newItem.setTransient(uiNavMenuItem.isTransient());
- newItem.setRendered(uiNavMenuItem.isRendered());
+ if (!copyValueBinding(uiNavMenuItem, newItem, "transient"))
+ newItem.setTransient(uiNavMenuItem.isTransient());
+ if (!copyValueBinding(uiNavMenuItem, newItem, "rendered"))
+ newItem.setRendered(uiNavMenuItem.isRendered());
// restore state
HtmlCommandNavigationItem previousItem =
HtmlNavigationMenuRendererUtils.findPreviousItem(previousViewRoot, newItem.getClientId(facesContext));
if (previousItem != null)
{
- newItem.setActive(Boolean.valueOf(previousItem.isActive()));
- newItem.setOpen(Boolean.valueOf(previousItem.isOpen()));
+ if (!copyValueBinding(uiNavMenuItem, newItem, "active"))
+ newItem.setActive(Boolean.valueOf(previousItem.isActive()));
+ if (!copyValueBinding(uiNavMenuItem, newItem, "open"))
+ newItem.setOpen(Boolean.valueOf(previousItem.isOpen()));
}
else
{
@@ -338,6 +343,15 @@
}
// process next level
preprocessNavigationItems(facesContext, newItem, previousViewRoot, uiNavMenuItem.getChildren(), uniqueId);
+ }
+
+ private boolean copyValueBinding(UIComponent source, UIComponent target, String binding)
+ {
+ ValueBinding valueBinding = source.getValueBinding(binding);
+ if (valueBinding == null)
+ return false;
+ target.setValueBinding(binding, valueBinding);
+ return true;
}
// protected