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/27 18:15:20 UTC
svn commit: r769044 -
/myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/event/PopupActionListener.java
Author: weber
Date: Mon Apr 27 16:15:20 2009
New Revision: 769044
URL: http://svn.apache.org/viewvc?rev=769044&view=rev
Log:
(TOBAGO-753) tc:popupReference/PopupActionListener should allow valueBinding
<https://issues.apache.org/jira/browse/TOBAGO-753>
Modified:
myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/event/PopupActionListener.java
Modified: myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/event/PopupActionListener.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/event/PopupActionListener.java?rev=769044&r1=769043&r2=769044&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/event/PopupActionListener.java (original)
+++ myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/event/PopupActionListener.java Mon Apr 27 16:15:20 2009
@@ -26,6 +26,8 @@
import javax.faces.event.ActionEvent;
import javax.faces.event.AbortProcessingException;
import javax.faces.context.FacesContext;
+import javax.faces.el.ValueBinding;
+import javax.faces.webapp.UIComponentTag;
import java.io.Serializable;
/*
@@ -38,11 +40,18 @@
private String popupId;
+ private ValueBinding popupIdBinding;
+
public PopupActionListener() {
}
public PopupActionListener(String popupId) {
- this.popupId = popupId;
+
+ if (UIComponentTag.isValueReference(popupId)) {
+ popupIdBinding = ComponentUtil.createValueBinding(popupId);
+ } else {
+ this.popupId = popupId;
+ }
if (LOG.isDebugEnabled()) {
LOG.debug("Add ActionListener: " + popupId);
}
@@ -56,17 +65,26 @@
}
public void processAction(ActionEvent actionEvent) throws AbortProcessingException {
- UIPopup popup = (UIPopup) ComponentUtil.findComponent(actionEvent.getComponent(), popupId);
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ String id = null;
+ if (popupIdBinding != null) {
+ id = (String) popupIdBinding.getValue(facesContext);
+ } else {
+ id = popupId;
+ }
+ UIPopup popup = (UIPopup) ComponentUtil.findComponent(actionEvent.getComponent(), id);
if (popup != null) {
if (LOG.isDebugEnabled()) {
LOG.debug("activated "
- + actionEvent.getComponent().getClientId(FacesContext.getCurrentInstance()));
+ + actionEvent.getComponent().getClientId(facesContext));
}
popup.setActivated(true);
} else {
- LOG.error("Found no popup for " + popupId + " search base component "
- + actionEvent.getComponent().getClientId(FacesContext.getCurrentInstance()));
+ LOG.error("Found no popup for \""
+ + (popupIdBinding != null ? popupIdBinding.getExpressionString() + "\" := \"" : "" )
+ + id + "\"! Search base componentId : "
+ + actionEvent.getComponent().getClientId(facesContext));
}
}