You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by bo...@apache.org on 2009/06/21 22:01:07 UTC
svn commit: r787083 - in /myfaces/tobago/trunk/theme:
scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/
standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/
Author: bommel
Date: Sun Jun 21 20:01:07 2009
New Revision: 787083
URL: http://svn.apache.org/viewvc?rev=787083&view=rev
Log:
(TOBAGO-769) Support for focus and errorFocus for tc:select* controls
Modified:
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectManyCheckboxRenderer.java
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectManyListboxRenderer.java
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectOneChoiceRenderer.java
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectOneListboxRenderer.java
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectOneRadioRenderer.java
myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectManyCheckboxRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectManyCheckboxRenderer.java?rev=787083&r1=787082&r2=787083&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectManyCheckboxRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectManyCheckboxRenderer.java Sun Jun 21 20:01:07 2009
@@ -158,6 +158,7 @@
if (!inline) {
writer.endElement(HtmlConstants.TABLE);
}
+ HtmlRendererUtil.renderFocusId(facesContext, selectMany);
HtmlRendererUtil.checkForCommandFacet(selectMany, clientIds, facesContext, writer);
}
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectManyListboxRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectManyListboxRenderer.java?rev=787083&r1=787082&r2=787083&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectManyListboxRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectManyListboxRenderer.java Sun Jun 21 20:01:07 2009
@@ -116,6 +116,7 @@
writer.endElement(HtmlConstants.SELECT);
HtmlRendererUtil.checkForCommandFacet(selectMany, facesContext, writer);
+ HtmlRendererUtil.renderFocusId(facesContext, selectMany);
}
}
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectOneChoiceRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectOneChoiceRenderer.java?rev=787083&r1=787082&r2=787083&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectOneChoiceRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectOneChoiceRenderer.java Sun Jun 21 20:01:07 2009
@@ -93,6 +93,7 @@
writer.endElement(HtmlConstants.SELECT);
super.encodeEnd(facesContext, selectOne);
+ HtmlRendererUtil.renderFocusId(facesContext, selectOne);
HtmlRendererUtil.checkForCommandFacet(selectOne, facesContext, writer);
}
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectOneListboxRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectOneListboxRenderer.java?rev=787083&r1=787082&r2=787083&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectOneListboxRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectOneListboxRenderer.java Sun Jun 21 20:01:07 2009
@@ -105,6 +105,7 @@
writer.endElement(HtmlConstants.SELECT);
super.encodeEnd(facesContext, selectOne);
+ HtmlRendererUtil.renderFocusId(facesContext, selectOne);
HtmlRendererUtil.checkForCommandFacet(selectOne, facesContext, writer);
}
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectOneRadioRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectOneRadioRenderer.java?rev=787083&r1=787082&r2=787083&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectOneRadioRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectOneRadioRenderer.java Sun Jun 21 20:01:07 2009
@@ -185,7 +185,7 @@
if (!inline) {
writer.endElement(HtmlConstants.TABLE);
}
-
+ HtmlRendererUtil.renderFocusId(facesContext, selectOne);
HtmlRendererUtil.checkForCommandFacet(selectOne, clientIds, facesContext, writer);
}
Modified: myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js?rev=787083&r1=787082&r2=787083&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js (original)
+++ myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js Sun Jun 21 20:01:07 2009
@@ -1199,7 +1199,15 @@
* no element is explicitly requested.
*/
setFocus: function() {
- var focusElement = this.element(this.errorFocusId == "undefined" ? this.focusId: this.errorFocusId);
+ var elementId = this.errorFocusId == "undefined" ? this.focusId: this.errorFocusId;
+ var focusElement = this.element(elementId);
+ if ((focusElement == "undefined" || !focusElement) && elementId) {
+ // search for input elements in tc:select* controls
+ var elements = document.getElementsByName(elementId);
+ if (elements.length > 0) {
+ focusElement = elements[0];
+ }
+ }
if (focusElement) {
try { // focus() on not visible elements breaks IE
focusElement.focus();