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:23:32 UTC

svn commit: r787086 - in /myfaces/tobago/branches/tobago-1.0.x: core/src/main/java/org/apache/myfaces/tobago/taglib/component/ core/src/main/java/org/apache/myfaces/tobago/taglib/extension/ theme/scarborough/src/main/java/org/apache/myfaces/tobago/rend...

Author: bommel
Date: Sun Jun 21 20:23:32 2009
New Revision: 787086

URL: http://svn.apache.org/viewvc?rev=787086&view=rev
Log:
(TOBAGO-769) Support for focus and errorFocus for tc:select* controls

Modified:
    myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/taglib/component/DateTagDeclaration.java
    myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/taglib/component/InTagDeclaration.java
    myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/taglib/component/InputTagDeclaration.java
    myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TextAreaTagDeclaration.java
    myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/taglib/extension/FileExtensionTag.java
    myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectManyCheckboxRenderer.java
    myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectManyListboxRenderer.java
    myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectOneChoiceRenderer.java
    myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectOneListboxRenderer.java
    myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectOneRadioRenderer.java
    myfaces/tobago/branches/tobago-1.0.x/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js

Modified: myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/taglib/component/DateTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/taglib/component/DateTagDeclaration.java?rev=787086&r1=787085&r2=787086&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/taglib/component/DateTagDeclaration.java (original)
+++ myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/taglib/component/DateTagDeclaration.java Sun Jun 21 20:23:32 2009
@@ -33,7 +33,6 @@
 
 /*
  * Created: Aug 5, 2005 5:03:15 PM
- * User: bommel
  * $Id$
  */
 /**
@@ -45,7 +44,7 @@
     rendererType = RENDERER_TYPE_DATE)
 public interface DateTagDeclaration
     extends InputTagDeclaration, HasIdBindingAndRendered, IsReadonly,
-    IsDisabled, HasConverter, IsInline, IsFocus, HasLabelAndAccessKey,
+    IsDisabled, HasConverter, IsInline, HasLabelAndAccessKey,
     HasTip, IsRequired, HasMarkup {
 
 }

Modified: myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/taglib/component/InTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/taglib/component/InTagDeclaration.java?rev=787086&r1=787085&r2=787086&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/taglib/component/InTagDeclaration.java (original)
+++ myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/taglib/component/InTagDeclaration.java Sun Jun 21 20:23:32 2009
@@ -37,7 +37,6 @@
 
 /*
  * Created: Aug 5, 2005 4:53:25 PM
- * User: bommel
  * $Id$
  */
 /**
@@ -51,7 +50,7 @@
 public interface InTagDeclaration
     extends TextInputTagDeclaration, HasIdBindingAndRendered,
     HasConverter, IsReadonly, IsDisabled, HasDeprecatedWidth,
-    IsInline, IsFocus, IsRequired, HasTip, HasLabelAndAccessKey,
+    IsInline, IsRequired, HasTip, HasLabelAndAccessKey,
     IsPassword, HasSuggestMethod {
 
   /**

Modified: myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/taglib/component/InputTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/taglib/component/InputTagDeclaration.java?rev=787086&r1=787085&r2=787086&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/taglib/component/InputTagDeclaration.java (original)
+++ myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/taglib/component/InputTagDeclaration.java Sun Jun 21 20:23:32 2009
@@ -22,13 +22,13 @@
 import org.apache.myfaces.tobago.taglib.decl.HasValidator;
 import org.apache.myfaces.tobago.taglib.decl.HasValue;
 import org.apache.myfaces.tobago.taglib.decl.HasValueChangeListener;
+import org.apache.myfaces.tobago.taglib.decl.IsFocus;
 
 /*
  * Created: Aug 5, 2005 4:18:38 PM
- * User: bommel
  * $Id$
  */
 public interface InputTagDeclaration extends BeanTagDeclaration, HasValidator,
-    HasOnchange, HasValue, HasValueChangeListener, HasTabIndex {
+    HasOnchange, HasValue, HasValueChangeListener, HasTabIndex, IsFocus {
 
 }

Modified: myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TextAreaTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TextAreaTagDeclaration.java?rev=787086&r1=787085&r2=787086&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TextAreaTagDeclaration.java (original)
+++ myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TextAreaTagDeclaration.java Sun Jun 21 20:23:32 2009
@@ -33,7 +33,6 @@
 
 /*
  * Created: Aug 5, 2005 5:00:41 PM
- * User: bommel
  * $Id$
  */
 
@@ -46,7 +45,7 @@
     rendererType = "TextArea")
 public interface TextAreaTagDeclaration extends TextInputTagDeclaration, HasIdBindingAndRendered,
     HasConverter, IsReadonly, IsDisabled, HasDeprecatedDimension,
-    IsFocus, IsRequired, HasLabelAndAccessKey, HasTip {
+    IsRequired, HasLabelAndAccessKey, HasTip {
 
   /**
    * The row count for this component.

Modified: myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/taglib/extension/FileExtensionTag.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/taglib/extension/FileExtensionTag.java?rev=787086&r1=787085&r2=787086&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/taglib/extension/FileExtensionTag.java (original)
+++ myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/taglib/extension/FileExtensionTag.java Sun Jun 21 20:23:32 2009
@@ -67,6 +67,7 @@
   private String labelWidth;
   private String required;
   private String tabIndex;
+  private String focus;
 
   private LabelExtensionTag labelTag;
   private FileTag fileTag;
@@ -120,6 +121,9 @@
     if (tabIndex != null) {
       fileTag.setTabIndex(tabIndex);
     }
+    if (focus != null) {
+      fileTag.setFocus(focus);
+    }
     fileTag.setParent(labelTag);
     fileTag.doStartTag();
 
@@ -150,6 +154,7 @@
     tabIndex = null;
     fileTag = null;
     labelTag = null;
+    focus = null;
   }
 
   public void setLabel(String label) {
@@ -199,4 +204,8 @@
   public void setTabIndex(String tabIndex) {
     this.tabIndex = tabIndex;
   }
+
+  public void setFocus(String focus) {
+    this.focus = focus;
+  }
 }

Modified: myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectManyCheckboxRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectManyCheckboxRenderer.java?rev=787086&r1=787085&r2=787086&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectManyCheckboxRenderer.java (original)
+++ myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectManyCheckboxRenderer.java Sun Jun 21 20:23:32 2009
@@ -149,6 +149,7 @@
       writer.endElement(HtmlConstants.TABLE);
     }
     checkForCommandFacet(selectMany, clientIds, facesContext, writer);
+    HtmlRendererUtil.renderFocusId(facesContext, selectMany);
   }
 
   public int getFixedHeight(FacesContext facesContext, UIComponent component) {

Modified: myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectManyListboxRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectManyListboxRenderer.java?rev=787086&r1=787085&r2=787086&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectManyListboxRenderer.java (original)
+++ myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectManyListboxRenderer.java Sun Jun 21 20:23:32 2009
@@ -117,6 +117,7 @@
 
     writer.endElement(HtmlConstants.SELECT);
     checkForCommandFacet(selectMany, facesContext, writer);
+    HtmlRendererUtil.renderFocusId(facesContext, selectMany);
   }
 
 }

Modified: myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectOneChoiceRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectOneChoiceRenderer.java?rev=787086&r1=787085&r2=787086&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectOneChoiceRenderer.java (original)
+++ myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectOneChoiceRenderer.java Sun Jun 21 20:23:32 2009
@@ -93,6 +93,7 @@
     writer.endElement(HtmlConstants.SELECT);
     super.encodeEnd(facesContext, selectOne);
     checkForCommandFacet(selectOne, facesContext, writer);
+    HtmlRendererUtil.renderFocusId(facesContext, selectOne);    
   }
 
   public int getComponentExtraWidth(FacesContext facesContext, UIComponent component) {

Modified: myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectOneListboxRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectOneListboxRenderer.java?rev=787086&r1=787085&r2=787086&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectOneListboxRenderer.java (original)
+++ myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectOneListboxRenderer.java Sun Jun 21 20:23:32 2009
@@ -107,6 +107,7 @@
     writer.endElement(HtmlConstants.SELECT);
     super.encodeEnd(facesContext, selectOne);
     checkForCommandFacet(selectOne, facesContext, writer);
+    HtmlRendererUtil.renderFocusId(facesContext, selectOne);
   }
 
 

Modified: myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectOneRadioRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectOneRadioRenderer.java?rev=787086&r1=787085&r2=787086&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectOneRadioRenderer.java (original)
+++ myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectOneRadioRenderer.java Sun Jun 21 20:23:32 2009
@@ -183,7 +183,7 @@
     }
 
     checkForCommandFacet(selectOne, clientIds, facesContext, writer);
-
+    HtmlRendererUtil.renderFocusId(facesContext, selectOne);
   }
 
   public int getFixedHeight(FacesContext facesContext, UIComponent component) {

Modified: myfaces/tobago/branches/tobago-1.0.x/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js?rev=787086&r1=787085&r2=787086&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js (original)
+++ myfaces/tobago/branches/tobago-1.0.x/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js Sun Jun 21 20:23:32 2009
@@ -1187,7 +1187,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();