01: package org.gridsphere.provider.portletui.beans;
02:
03: /**
04: * A <code>RenderSubmitBean</code> is a visual bean that represents an HTML button and
05: * has an associated <code>DefaultPortletAction</code>
06: */
07: public class RenderSubmitBean extends ActionBean implements TagBean {
08:
09: public static final String SUBMIT_STYLE = "portlet-form-button";
10: public static final String NAME = "as";
11:
12: /**
13: * Constructs a default action submit bean
14: */
15: public RenderSubmitBean() {
16: super (NAME);
17: this .cssClass = SUBMIT_STYLE;
18: }
19:
20: /**
21: * Constructs an action submit bean from a supplied portlet request and bean identifier
22: *
23: * @param beanId the bean identifier
24: */
25: public RenderSubmitBean(String beanId) {
26: super (NAME);
27: this .cssClass = SUBMIT_STYLE;
28: this .beanId = beanId;
29: }
30:
31: public String toStartString() {
32: return "";
33: }
34:
35: public String toEndString() {
36: String sname = (name == null) ? "" : name;
37: StringBuffer sb = new StringBuffer();
38:
39: String inputType = "submit";
40: if (useAjax)
41: inputType = "button";
42: sb.append("<input " + getFormattedCss() + " type=\""
43: + inputType + "\" " + checkDisabled());
44:
45: if (action != null)
46: sname = action;
47: if (anchor != null)
48: sname += "#" + anchor;
49: if (onClick != null) {
50: // 'onClick' replaced by 'onclick' for XHTML 1.0 Strict compliance
51: sb.append(" onclick=\"" + onClick + "\" ");
52: }
53: sb.append("name=\"" + sname + "\" value=\"" + value + "\"/>");
54: return sb.toString();
55: }
56:
57: }
|