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 2009/04/02 10:40:22 UTC
svn commit: r761206 -
/myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/component/UITreeOldNode.java
Author: weber
Date: Thu Apr 2 08:40:22 2009
New Revision: 761206
URL: http://svn.apache.org/viewvc?rev=761206&view=rev
Log:
(TOBAGO-751) tc:tree should allow valueBinding in reference attributes
Modified:
myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/component/UITreeOldNode.java
Modified: myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/component/UITreeOldNode.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/component/UITreeOldNode.java?rev=761206&r1=761205&r2=761206&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/component/UITreeOldNode.java (original)
+++ myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/component/UITreeOldNode.java Thu Apr 2 08:40:22 2009
@@ -161,25 +161,32 @@
}
}
- @SuppressWarnings("unchecked")
private Object getReference(TreeNode treeNode, String key) {
Object value = null;
- UITreeOld root = findTreeRoot();
- String reference = (String) root.getAttributes().get(key);
- if (reference != null) {
- try {
- FacesContext facesContext = FacesContext.getCurrentInstance();
- Map requestMap = facesContext.getExternalContext().getRequestMap();
+ String reference = null;
+ try {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ UITreeOld root = findTreeRoot();
+ ValueBinding binding = root.getValueBinding(key);
+ if (binding == null) {
+ reference = (String) root.getAttributes().get(key);
+ if (reference == null) {
+ return null;
+ }
String ref = "#{tobagoTreeNode." + reference + "}";
- ValueBinding vb = facesContext.getApplication().createValueBinding(ref);
- requestMap.put("tobagoTreeNode", treeNode);
- value = vb.getValue(facesContext);
- requestMap.remove("tobagoTreeNode");
- } catch (Exception e) {
- LOG.warn(
- "Can't find " + key + " over ref='" + reference
- + "' treeNode='" + treeNode + "! " + treeNode.getClass().getName(), e);
+ binding = facesContext.getApplication().createValueBinding(ref);
+ } else {
+ reference = binding.getExpressionString();
}
+ Map requestMap = facesContext.getExternalContext().getRequestMap();
+ //noinspection unchecked
+ requestMap.put("tobagoTreeNode", treeNode);
+ value = binding.getValue(facesContext);
+ requestMap.remove("tobagoTreeNode");
+ } catch (Exception e) {
+ LOG.warn(
+ "Can't find " + key + " over ref='" + reference
+ + "' treeNode='" + treeNode + "! " + treeNode.getClass().getName(), e);
}
return value;
}