1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.myfaces.tobago.event;
21
22 import org.apache.myfaces.tobago.internal.util.FindComponentUtils;
23 import org.slf4j.Logger;
24 import org.slf4j.LoggerFactory;
25
26 import javax.faces.component.StateHolder;
27 import javax.faces.component.UIComponent;
28 import javax.faces.component.UIComponentBase;
29 import javax.faces.context.FacesContext;
30 import javax.faces.el.ValueBinding;
31 import javax.faces.event.ActionEvent;
32
33
34
35
36 @Deprecated
37 public class ValueBindingPopupActionListener extends AbstractPopupActionListener implements StateHolder {
38
39 private static final Logger LOG = LoggerFactory.getLogger(ValueBindingPopupActionListener.class);
40
41 private ValueBinding popupIdBinding;
42
43
44
45
46 public ValueBindingPopupActionListener() {
47 }
48
49 public ValueBindingPopupActionListener(Object binding) {
50 popupIdBinding = (ValueBinding) binding;
51 }
52
53 @Override
54 protected UIComponent getPopup(ActionEvent actionEvent) {
55 String id = (String) popupIdBinding.getValue(FacesContext.getCurrentInstance());
56 UIComponent popup = FindComponentUtils.findComponent(actionEvent.getComponent(), id);
57 if (popup == null) {
58 LOG.error("Found no popup for \""
59 + popupIdBinding.getExpressionString() + "\" := \""
60 + id + "\"! Search base componentId : "
61 + actionEvent.getComponent().getClientId(FacesContext.getCurrentInstance()));
62 }
63 return popup;
64 }
65
66 public boolean isTransient() {
67 return false;
68 }
69
70 public void restoreState(FacesContext context, Object state) {
71 Object[] values = (Object[]) state;
72 popupIdBinding = (ValueBinding) UIComponentBase.restoreAttachedState(context, values[0]);
73 }
74
75 public Object saveState(FacesContext context) {
76 Object[] values = new Object[1];
77 values[0] = UIComponentBase.saveAttachedState(context, popupIdBinding);
78 return values;
79 }
80
81
82 public void setTransient(boolean newTransientValue) {
83
84 }
85 }