1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19 package org.apache.myfaces.custom.form;
20
21 import javax.faces.context.FacesContext;
22
23 import org.apache.myfaces.component.ForceIdAware;
24 import org.apache.myfaces.component.html.util.HtmlComponentUtils;
25
26 /**
27 * Renders a HTML form element which allow defining a different scheme,
28 * servername or port for the action url to which the form is submited
29 *
30 * @JSFComponent
31 * name = "s:form"
32 * class = "org.apache.myfaces.custom.form.HtmlForm"
33 * tagClass = "org.apache.myfaces.custom.form.HtmlFormTag"
34 *
35 * @author Mathias Broekelmann (latest modification by $Author: lu4242 $)
36 * @version $Revision: 691856 $ $Date: 2008-09-03 21:40:30 -0500 (Wed, 03 Sep 2008) $
37 */
38 public abstract class AbstractHtmlForm extends javax.faces.component.html.HtmlForm
39 implements ForceIdAware
40 {
41 public static final String COMPONENT_TYPE = "org.apache.myfaces.HtmlForm";
42 private static final String DEFAULT_RENDERER_TYPE = "org.apache.myfaces.Form";
43
44 public AbstractHtmlForm()
45 {
46 setRendererType(DEFAULT_RENDERER_TYPE);
47 }
48
49 public String getClientId(FacesContext context)
50 {
51 String clientId = HtmlComponentUtils.getClientId(this, getRenderer(context), context);
52 if (clientId == null)
53 {
54 clientId = super.getClientId(context);
55 }
56
57 return clientId;
58 }
59
60 /**
61 * This attribute can be used to set the port for the action attribute
62 *
63 * @JSFProperty
64 */
65 public abstract Integer getPort();
66
67 /**
68 * This attribute can be used to set the url scheme for the action attribute
69 *
70 * @JSFProperty
71 */
72 public abstract String getScheme();
73
74 /**
75 * This attribute can be used to set the url server name or ip address for the action attribute
76 *
77 * @JSFProperty
78 */
79 public abstract String getServerName();
80
81 /**
82 * This attribute can be used to set an entirely different action
83 * (might be something JSF-unspecific) to the form.
84 *
85 * @JSFProperty
86 */
87 public abstract String getAction();
88
89 /**
90 * This attribute can be used to set a method to the form which is
91 * different to the regular POST method used.
92 *
93 * @JSFProperty
94 */
95 public abstract String getMethod();
96
97 /**
98 * If true, this component will force the use of the specified id when rendering.
99 *
100 * @JSFProperty
101 * literalOnly = "true"
102 * defaultValue = "false"
103 *
104 * @return
105 */
106 public abstract boolean isForceId();
107
108 /**
109 * If false, this component will not append a '[n]' suffix
110 * (where 'n' is the row index) to components that are
111 * contained within a "list." This value will be true by
112 * default and the value will be ignored if the value of
113 * forceId is false (or not specified.)
114 *
115 * @JSFProperty
116 * literalOnly = "true"
117 * defaultValue = "true"
118 *
119 * @return
120 */
121 public abstract boolean isForceIdIndex();
122
123 }