1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.myfaces.renderkit.html.jsf;
20
21 import javax.faces.component.UIComponent;
22 import javax.faces.context.FacesContext;
23
24 import org.apache.myfaces.component.UserRoleUtils;
25 import org.apache.myfaces.renderkit.html.util.DummyFormUtils;
26 import org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlButtonRendererBase;
27 import org.apache.myfaces.shared_tomahawk.renderkit.html.util.FormInfo;
28
29
30
31
32
33
34
35
36 public class ExtendedHtmlButtonRenderer
37 extends HtmlButtonRendererBase
38 {
39 protected void addHiddenCommandParameter(FacesContext facesContext, UIComponent nestingForm, String hiddenFieldName)
40 {
41 if (nestingForm != null)
42 {
43 super.addHiddenCommandParameter(facesContext, nestingForm, hiddenFieldName);
44 }
45 else
46 {
47 DummyFormUtils.addDummyFormParameter(facesContext, hiddenFieldName);
48 }
49 }
50
51 protected FormInfo findNestingForm(UIComponent uiComponent, FacesContext facesContext)
52 {
53 return DummyFormUtils.findNestingForm(uiComponent, facesContext);
54 }
55
56 protected boolean isDisabled(FacesContext facesContext, UIComponent uiComponent)
57 {
58 if (!UserRoleUtils.isEnabledOnUserRole(uiComponent))
59 {
60 return true;
61 }
62 else
63 {
64 return super.isDisabled(facesContext, uiComponent);
65 }
66 }
67 }