dev@javaserverfaces.java.net

Please review changebundle for focus tag

From: Jim Driscoll <Jim.Driscoll_at_Sun.COM>
Date: Mon, 07 Apr 2008 18:47:07 -0700

This is the tag that we were talking about on the list. This is the
simple version, you just use <mj:focus for="componetID"/>. Added it as
part of the Mojarra Extensions library.

I'd still like to see it as an attribute on f:view for 2.0.

SECTION: Modified Files
----------------------------

M jsf-ri/conf/share/mojarra_ext.tld
M jsf-ri/src/com/sun/faces/jsf-ri-config.xml
  - Config changes to add focus tag. "for" attribute is required.

A jsf-ri/src/com/sun/faces/ext/component/UIFocus.java
  - UIComponent which extends UIComponentBase

A jsf-ri/src/com/sun/faces/ext/taglib/FocusTag.java
  - Tag class for new Focus component.

M jsf-demo/mojarra_ext/web/landing.jsp
M jsf-demo/mojarra_ext/web/welcome.jsp
  - Update demo to use new focus tag.



SECTION: Diffs
----------------------------
Index: jsf-demo/mojarra_ext/web/landing.jsp
===================================================================
RCS file:
/cvs/javaserverfaces-sources/jsf-demo/mojarra_ext/web/landing.jsp,v
retrieving revision 1.1.2.2
diff -u -r1.1.2.2 landing.jsp
--- jsf-demo/mojarra_ext/web/landing.jsp 7 Apr 2008 17:55:23 -0000 1.1.2.2
+++ jsf-demo/mojarra_ext/web/landing.jsp 8 Apr 2008 01:35:56 -0000
@@ -61,6 +61,7 @@
                  <h:message id="creditcardError" for="sampleCreditCard"/>
                  <br/>
                  <h:commandButton id="submit" action="back" value="Back" />
+ <mj:focus for="sampleCreditCard"/>
              </h:form>
          </f:view>

Index: jsf-demo/mojarra_ext/web/welcome.jsp
===================================================================
RCS file:
/cvs/javaserverfaces-sources/jsf-demo/mojarra_ext/web/welcome.jsp,v
retrieving revision 1.1.2.2
diff -u -r1.1.2.2 welcome.jsp
--- jsf-demo/mojarra_ext/web/welcome.jsp 7 Apr 2008 17:55:23 -0000 1.1.2.2
+++ jsf-demo/mojarra_ext/web/welcome.jsp 8 Apr 2008 01:35:56 -0000
@@ -61,6 +61,7 @@
                  </h:inputText>
                  <h:message id="regexError" for="sampleRegex"
showDetail="true" showSummary="false"/><br/>
                  <h:commandButton id="submit" action="landing"
value="Go" />
+ <mj:focus for="sampleRegex"/>
              </h:form>
          </f:view>
      </body>
Index: jsf-ri/conf/share/mojarra_ext.tld
===================================================================
RCS file: /cvs/javaserverfaces-sources/jsf-ri/conf/share/mojarra_ext.tld,v
retrieving revision 1.1.2.2
diff -u -r1.1.2.2 mojarra_ext.tld
--- jsf-ri/conf/share/mojarra_ext.tld 7 Apr 2008 17:55:23 -0000 1.1.2.2
+++ jsf-ri/conf/share/mojarra_ext.tld 8 Apr 2008 01:35:56 -0000
@@ -75,4 +75,25 @@
 
<tag-class>com.sun.faces.ext.taglib.CreditCardValidatorTag</tag-class>
          <body-content>empty</body-content>
      </tag>
+ <tag>
+ <name>focus</name>
+ <tag-class>com.sun.faces.ext.taglib.FocusTag</tag-class>
+ <attribute>
+ <name>binding</name>
+ <description>A value binding that points to a bean
property</description>
+ </attribute>
+ <attribute>
+ <name>id</name>
+ <description>The client id of this component</description>
+ </attribute>
+ <attribute>
+ <name>rendered</name>
+ <description>Is this component rendered?</description>
+ </attribute>
+ <attribute>
+ <name>for</name>
+ <description>component ID that should receive the
focus</description>
+ <required>true</required>
+ </attribute>
+ </tag>
  </taglib>
Index: jsf-ri/src/com/sun/faces/jsf-ri-config.xml
===================================================================
RCS file:
/cvs/javaserverfaces-sources/jsf-ri/src/com/sun/faces/jsf-ri-config.xml,v
retrieving revision 1.73.4.2
diff -u -r1.73.4.2 jsf-ri-config.xml
--- jsf-ri/src/com/sun/faces/jsf-ri-config.xml 7 Apr 2008 17:55:22
-0000 1.73.4.2
+++ jsf-ri/src/com/sun/faces/jsf-ri-config.xml 8 Apr 2008 01:35:56 -0000
@@ -211,4 +211,9 @@
 
<validator-class>com.sun.faces.ext.validator.CreditCardValidator</validator-class>
    </validator>

+ <!-- Add our implementation specific Components -->
+ <component>
+ <component-type>com.sun.faces.ext.focus</component-type>
+
<component-class>com.sun.faces.ext.component.UIFocus</component-class>
+ </component>
  </faces-config>


SECTION: New Files
----------------------------
SEE ATTACHMENTS