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.focus2;
20
21 import javax.faces.component.UIInput;
22 import javax.faces.context.FacesContext;
23
24 /**
25 * @JSFComponent
26 * name = "s:focus2"
27 * class = "org.apache.myfaces.custom.focus2.HtmlFocus"
28 * superClass = "org.apache.myfaces.custom.focus2.AbstractHtmlFocus"
29 * tagClass = "org.apache.myfaces.custom.focus2.HtmlFocusTag"
30 *
31 * @author Rogerio Pereira Araujo (latest modification by $Author: skitching $)
32 * @version $Revision: 676957 $ $Date: 2008-07-15 11:41:17 -0500 (Tue, 15 Jul 2008) $
33 */
34 public abstract class AbstractHtmlFocus extends UIInput
35 {
36 public static final String COMPONENT_TYPE = "org.apache.myfaces.Focus2";
37 public static final String COMPONENT_FAMILY = "javax.faces.Output";
38 public static final String DEFAULT_RENDERER_TYPE = "org.apache.myfaces.Focus2";
39
40 public String getFamily()
41 {
42 return COMPONENT_FAMILY;
43 }
44
45 public AbstractHtmlFocus()
46 {
47 super.setRendererType(DEFAULT_RENDERER_TYPE);
48 }
49
50 /**
51 * Defines that the first element of the form should receive the
52 * focus by default
53 * (if the overrideFocusId-attribute is not specified, no error has
54 * been queued and the focus
55 * has not already been set).
56 *
57 * @JSFProperty
58 * defaultValue = "true"
59 */
60 public abstract boolean isFocusOnFirst();
61
62 /**
63 * Defines that the first element of the form with an associated error should
64 * receive the focus by default (if the override focus-id attribute wasn't set).
65 *
66 * @JSFProperty
67 * defaultValue = "true"
68 * @return
69 */
70 public abstract boolean isFocusOnError();
71
72 /**The id (locally in this naming container) of the component which
73 * should receive the focus.
74 * Overrides all other behaviour if set.
75 *
76 * @JSFProperty
77 */
78 public abstract String getOverrideFocusId();
79
80 /**
81 * Defines an id of a command-button or command-link that will be
82 * focussed and submitted when the enter-key is pressed.
83 *
84 * @JSFProperty
85 */
86 public abstract String getFocusAndSubmitOnEnter();
87
88 /**
89 * The client-id (fully specified as a concatenation of the id of
90 * this component and all naming container
91 * parent ids) of the component which receives the focus (works only if
92 * overrideFocusId hasn't been set and no error has been queued).
93 *
94 * The value will automatically be updated when the focus is changed.
95 *
96 * @JSFProperty
97 * @see javax.faces.component.UIInput#setValue(java.lang.Object)
98 */
99 public void setValue(Object value)
100 {
101 super.setValue(value);
102 }
103
104 public Object getValue()
105 {
106 return super.getValue();
107 }
108
109 public void updateModel(FacesContext context)
110 {
111 super.updateModel(context);
112 }
113
114 public void processValidators(FacesContext context)
115 {
116 super.processValidators(context);
117 }
118
119 }