1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.myfaces.custom.inputAjax;
20
21 import java.io.IOException;
22
23 import javax.faces.context.FacesContext;
24 import javax.faces.render.Renderer;
25
26 import org.apache.commons.logging.Log;
27 import org.apache.commons.logging.LogFactory;
28 import org.apache.myfaces.component.html.ext.HtmlCommandButton;
29 import org.apache.myfaces.custom.ajax.AjaxCallbacks;
30 import org.apache.myfaces.custom.ajax.api.AjaxRenderer;
31 import org.apache.myfaces.custom.ajax.api.DeprecatedAjaxComponent;
32
33
34
35
36
37
38
39
40
41
42
43
44
45 public abstract class AbstractHtmlCommandButtonAjax extends HtmlCommandButton implements DeprecatedAjaxComponent, AjaxCallbacks
46 {
47 private static final Log log = LogFactory.getLog(HtmlInputTextAjax.class);
48 public static final String COMPONENT_TYPE = "org.apache.myfaces.HtmlCommandButtonAjax";
49 public static final String DEFAULT_RENDERER_TYPE = "org.apache.myfaces.CommandButtonAjax";
50
51 public AbstractHtmlCommandButtonAjax()
52 {
53 super();
54 setRendererType(DEFAULT_RENDERER_TYPE);
55 setType("button");
56 }
57
58
59
60
61
62
63 public void decodeAjax(FacesContext context)
64 {
65 log.debug("entering HtmlCommandButtonAjax.decodeAjax");
66
67 processDecodes(context);
68 processValidators(context);
69 processUpdates(context);
70
71 if (log.isDebugEnabled())
72 {
73 Object valOb = this.getValue();
74 log.debug("value object after decodeAjax: " + valOb);
75 }
76
77 }
78
79 public void encodeAjax(FacesContext context) throws IOException
80 {
81 log.debug("encodeAjax in HtmlCommandButtonAjax");
82 if (context == null) throw new NullPointerException("context");
83 if (!isRendered()) return;
84 Renderer renderer = getRenderer(context);
85
86 if (renderer != null && renderer instanceof AjaxRenderer)
87 {
88 ((AjaxRenderer) renderer).encodeAjax(context, this);
89
90 }
91 }
92
93
94
95
96
97
98 public abstract String getOnSuccess();
99
100
101
102
103
104
105 public abstract String getOnFailure();
106
107
108
109
110
111
112 public abstract String getOnStart();
113
114
115 }