ICEfaces
  1. ICEfaces
  2. ICE-9483

New icecore:focusManager component

    Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.0.BETA, EE-3.3.0.GA_P02, 4.0
    • Component/s: Framework
    • Labels:
      None
    • Environment:
      ICEfaces 3.x
    • Assignee Priority:
      P2
    • Affects:
      Documentation (User Guide, Ref. Guide, etc.), Sample App./Tutorial

      Description

      Add a new ice core:focusManager component that would provide the following automatic focus setting features when it is included inside a form component:

      - The first visible (enabled) input element in the form has focus set on it initially.
      - Alternatively, if there is an invalid component in the form (failed validation), the first visible (enabled) invalid component will receive focus instead.
      - The application also specify a component to have focus set on it via the "for" attribute.

        Activity

        Ken Fyten created issue -
        Ken Fyten made changes -
        Field Original Value New Value
        Assignee Mircea Toma [ mircea.toma ]
        Fix Version/s 3.4 [ 10770 ]
        Affects Documentation (User Guide, Ref. Guide, etc.),Sample App./Tutorial [ 10003, 10001 ]
        Assignee Priority P2 [ 10011 ]
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #37389 Tue Aug 13 15:06:35 MDT 2013 mircea.toma ICE-9483 Implemented icecore:focusManager component.
        Files Changed
        Commit graph MODIFY /icefaces3/trunk/icefaces/core/src/main/resources/META-INF/faces-config.xml
        Commit graph MODIFY /icefaces3/trunk/icefaces/core/src/main/resources/META-INF/core.taglib.xml
        Commit graph ADD /icefaces3/trunk/icefaces/core/src/main/java/org/icefaces/component
        Commit graph ADD /icefaces3/trunk/icefaces/core/src/main/java/org/icefaces/component/Focusable.java
        Commit graph ADD /icefaces3/trunk/icefaces/core/src/main/java/org/icefaces/impl/component/FocusManager.java
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #37390 Tue Aug 13 15:30:55 MDT 2013 mircea.toma ICE-9483 Optimized imports.
        Files Changed
        Commit graph MODIFY /icefaces3/trunk/icefaces/core/src/main/java/org/icefaces/impl/component/FocusManager.java
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #37391 Tue Aug 13 16:27:34 MDT 2013 mircea.toma ICE-9483 Add random comment to the JS code to force the application of focus even when the entry was previously focused.
        Files Changed
        Commit graph MODIFY /icefaces3/trunk/icefaces/core/src/main/java/org/icefaces/impl/component/FocusManager.java
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #37392 Tue Aug 13 16:29:51 MDT 2013 mircea.toma ICE-9483 Added test application.
        Files Changed
        Commit graph ADD /icefaces3/trunk/icefaces/samples/core/test/focus-manager/src/main/java/org/icefaces/demo/focusManager
        Commit graph ADD /icefaces3/trunk/icefaces/samples/core/test/focus-manager
        Commit graph ADD /icefaces3/trunk/icefaces/samples/core/test/focus-manager/src/main/java/org/icefaces/demo
        Commit graph ADD /icefaces3/trunk/icefaces/samples/core/test/focus-manager/src/main/java/org/icefaces/demo/focusManager/Entry.java
        Commit graph ADD /icefaces3/trunk/icefaces/samples/core/test/focus-manager/src/main/webapp/WEB-INF/faces-config.xml
        Commit graph ADD /icefaces3/trunk/icefaces/samples/core/test/focus-manager/src/main
        Commit graph ADD /icefaces3/trunk/icefaces/samples/core/test/focus-manager/src/main/webapp/WEB-INF/web.xml
        Commit graph ADD /icefaces3/trunk/icefaces/samples/core/test/focus-manager/src/main/java
        Commit graph ADD /icefaces3/trunk/icefaces/samples/core/test/focus-manager/src/main/webapp/test-first-focus.xhtml
        Commit graph ADD /icefaces3/trunk/icefaces/samples/core/test/focus-manager/src/main/java/org
        Commit graph ADD /icefaces3/trunk/icefaces/samples/core/test/focus-manager/src/main/webapp
        Commit graph ADD /icefaces3/trunk/icefaces/samples/core/test/focus-manager/src/main/java/org/icefaces
        Commit graph ADD /icefaces3/trunk/icefaces/samples/core/test/focus-manager/src/main/webapp/index.html
        Commit graph ADD /icefaces3/trunk/icefaces/samples/core/test/focus-manager/src/main/webapp/WEB-INF
        Commit graph ADD /icefaces3/trunk/icefaces/samples/core/test/focus-manager/src/main/webapp/test-for-focus.xhtml
        Commit graph ADD /icefaces3/trunk/icefaces/samples/core/test/focus-manager/src/main/resources
        Commit graph ADD /icefaces3/trunk/icefaces/samples/core/test/focus-manager/src
        Commit graph ADD /icefaces3/trunk/icefaces/samples/core/test/focus-manager/build.xml
        Hide
        Mircea Toma added a comment -

        Implemented icecore:focusManager component. The component behaves as described in the requirements, above. The for attribute can be used to point to the component that will receive focus when the page is loaded. If not specified the focus will be set on the first component or in case one or more enclosed components are invalid the focus will be set on the first invalid component.
        By default icecore:focusManager will set the focus on the element corresponding to the root of the markup rendered by the component.
        For components that are more complex a new interface was introduced that used to specify which element rendered by the component should receive focus. See org.icefaces.component.Focusable javadoc.

        Show
        Mircea Toma added a comment - Implemented icecore:focusManager component. The component behaves as described in the requirements, above. The for attribute can be used to point to the component that will receive focus when the page is loaded. If not specified the focus will be set on the first component or in case one or more enclosed components are invalid the focus will be set on the first invalid component. By default icecore:focusManager will set the focus on the element corresponding to the root of the markup rendered by the component. For components that are more complex a new interface was introduced that used to specify which element rendered by the component should receive focus. See org.icefaces.component.Focusable javadoc.
        Mircea Toma made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #37415 Wed Aug 14 15:38:09 MDT 2013 mircea.toma ICE-9483 Added Javadocs.
        Files Changed
        Commit graph MODIFY /icefaces3/trunk/icefaces/core/src/main/java/org/icefaces/component/Focusable.java
        Hide
        Mircea Toma added a comment -

        Added test application in samples/core/test/focus-manager folder.

        Show
        Mircea Toma added a comment - Added test application in samples/core/test/focus-manager folder.
        Ken Fyten made changes -
        Assignee Mircea Toma [ mircea.toma ] Ken Fyten [ ken.fyten ]
        Ken Fyten made changes -
        Comment [ What happens if a component doesn't implement the Focusable interface? How does the focusManager react? ]
        Ken Fyten made changes -
        Assignee Ken Fyten [ ken.fyten ] Mircea Toma [ mircea.toma ]
        Ken Fyten made changes -
        Resolution Fixed [ 1 ]
        Status Resolved [ 5 ] Reopened [ 4 ]
        Hide
        Mircea Toma added a comment - - edited

        Modified autoCompleteEntry, checkboxButton, maskedEntry, radioButton, textEntry and textAreaEntry to implement Focusable interface so that the focus manager will focus the correct rendered element. The select components that inherit from UIInput are not suitable to implement Focusable because they would expand their drop-down when focused. Also, richInputText has its textarea rendered into a frame so it is not really possible for the focus manger to focus it.

        Show
        Mircea Toma added a comment - - edited Modified autoCompleteEntry , checkboxButton , maskedEntry , radioButton , textEntry and textAreaEntry to implement Focusable interface so that the focus manager will focus the correct rendered element. The select components that inherit from UIInput are not suitable to implement Focusable because they would expand their drop-down when focused. Also, richInputText has its textarea rendered into a frame so it is not really possible for the focus manger to focus it.
        Mircea Toma made changes -
        Status Reopened [ 4 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #37820 Mon Sep 09 13:22:23 MDT 2013 mircea.toma ICE-9483 Modified input ACE components to implement Focusable interface so that the focus manager will focus the correct rendered element.
        Files Changed
        Commit graph MODIFY /icefaces3/trunk/icefaces/ace/component/src/org/icefaces/ace/component/radiobutton/RadioButton.java
        Commit graph MODIFY /icefaces3/trunk/icefaces/ace/component/src/org/icefaces/ace/component/textareaentry/TextAreaEntry.java
        Commit graph MODIFY /icefaces3/trunk/icefaces/ace/component/src/org/icefaces/ace/component/radiobutton/RadioButtonRenderer.java
        Commit graph MODIFY /icefaces3/trunk/icefaces/ace/component/src/org/icefaces/ace/component/textentry/TextEntry.java
        Commit graph MODIFY /icefaces3/trunk/icefaces/ace/component/src/org/icefaces/ace/component/checkboxbutton/CheckboxButtonRenderer.java
        Commit graph MODIFY /icefaces3/trunk/icefaces/ace/component/src/org/icefaces/ace/component/checkboxbutton/CheckboxButton.java
        Commit graph MODIFY /icefaces3/trunk/icefaces/ace/component/src/org/icefaces/ace/component/maskedentry/MaskedEntry.java
        Commit graph MODIFY /icefaces3/trunk/icefaces/ace/component/src/org/icefaces/ace/component/autocompleteentry/AutoCompleteEntry.java
        Hide
        Ken Fyten added a comment -

        The select components that inherit from UIInput are not suitable to implement Focusable because they would expand their drop-down when focused.

        Let's go ahead and implement this for the UIInput descendants as well for consistency.

        Also, the list of components supporting this should include all the ace:*Entry components, such as ace:sliderEntry.

        Show
        Ken Fyten added a comment - The select components that inherit from UIInput are not suitable to implement Focusable because they would expand their drop-down when focused. Let's go ahead and implement this for the UIInput descendants as well for consistency. Also, the list of components supporting this should include all the ace:*Entry components, such as ace:sliderEntry.
        Ken Fyten made changes -
        Resolution Fixed [ 1 ]
        Status Resolved [ 5 ] Reopened [ 4 ]
        Hide
        Mircea Toma added a comment -

        Modified focus manager to handle any Focusable component, regardless if it extends UIInput or not. Modified ace:comboBox, ace:dateTimeEntry (popup mode), ace:fileEntry, ace:selectMenu and ace:simpleSelectOne to have their focus managed.

        Show
        Mircea Toma added a comment - Modified focus manager to handle any Focusable component, regardless if it extends UIInput or not. Modified ace:comboBox, ace:dateTimeEntry (popup mode), ace:fileEntry, ace:selectMenu and ace:simpleSelectOne to have their focus managed.
        Mircea Toma made changes -
        Status Reopened [ 4 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #38050 Mon Sep 16 17:22:28 MDT 2013 mircea.toma ICE-9483 Modified focus manager to handle any Focusable component, regardless if it extends UIInput or not. Modified ace:comboBox, ace:dateTimeEntry (popup mode), ace:fileEntry, ace:selectMenu and ace:simpleSelectOne to have their focus managed.
        Files Changed
        Commit graph MODIFY /icefaces3/trunk/icefaces/ace/component/src/org/icefaces/ace/component/simpleselectonemenu/SimpleSelectOneMenu.java
        Commit graph MODIFY /icefaces3/trunk/icefaces/ace/component/src/org/icefaces/ace/component/datetimeentry/DateTimeEntry.java
        Commit graph MODIFY /icefaces3/trunk/icefaces/ace/component/src/org/icefaces/ace/component/selectmenu/SelectMenu.java
        Commit graph MODIFY /icefaces3/trunk/icefaces/ace/component/src/org/icefaces/ace/component/selectmenu/SelectMenuRenderer.java
        Commit graph MODIFY /icefaces3/trunk/icefaces/ace/component/src/org/icefaces/ace/component/fileentry/FileEntry.java
        Commit graph MODIFY /icefaces3/trunk/icefaces/core/src/main/java/org/icefaces/impl/component/FocusManager.java
        Commit graph MODIFY /icefaces3/trunk/icefaces/ace/component/src/org/icefaces/ace/component/combobox/ComboBox.java
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #38055 Tue Sep 17 09:08:48 MDT 2013 mircea.toma ICE-9483 Make ace:slideEntry focus manageable.
        Files Changed
        Commit graph MODIFY /icefaces3/trunk/icefaces/ace/component/src/org/icefaces/ace/component/sliderentry/SliderEntry.java
        Commit graph MODIFY /icefaces3/trunk/icefaces/ace/component/resources/icefaces.ace/sliderentry/slider.js
        Ken Fyten made changes -
        Resolution Fixed [ 1 ]
        Status Resolved [ 5 ] Reopened [ 4 ]
        Hide
        Mircea Toma added a comment -

        ace:fileEntry does receive focus it's just Firefox who seem to not be able to focus input[file] elements. Chrome, for example, does work very well.

        Show
        Mircea Toma added a comment - ace:fileEntry does receive focus it's just Firefox who seem to not be able to focus input [file] elements. Chrome, for example, does work very well.
        Hide
        Cruz Miraback added a comment -

        Actually, it seems to be working in all browsers for me (FF24, Chrome30, IE10). My example previously had the fileEntry component wrapped in a panelGroup, and in this scenario it doesn't work in any browser.

        Show
        Cruz Miraback added a comment - Actually, it seems to be working in all browsers for me (FF24, Chrome30, IE10). My example previously had the fileEntry component wrapped in a panelGroup, and in this scenario it doesn't work in any browser.
        Hide
        Mircea Toma added a comment - - edited

        ace:fileEntry works fine for me too as long as the focus retention doesn't moves away the focus. For example in showcase the navigation links used for switching to the different use cases of a certain component will send the ice.focus parameter which will trigger the focus retention, the update that comes back will have focus code for the focus managed (by icecore:focusManager) component and also the focus retained navigation link. The navigation link code comes last in the update which causes the focus to remain on the navigaiton link.
        For showcase we could add an onclick handler on the navigation links to cancels the focus retention for them:

        ....
        ....
        <li style="padding-left: 15px;">
            <ui:param name="beanName" value="#{subMenuLink.exampleBeanName}.title"/>
            <h:commandLink id="subLink"
                           actionListener="#{navigationController.navigate}"
                           title="#{msgs[subMenuLink.title]}"
                           disabled="#{subMenuLink.disabled}"
                           class="#{(subMenuLink.exampleBeanName eq navigationModel.componentExample) ||
                                    (navigationModel.componentExample eq null and subMenuLink['default'])
                                    ? 'selected'
                                    : ''}" onclick="ice.setFocus();">
        
        
        Show
        Mircea Toma added a comment - - edited ace:fileEntry works fine for me too as long as the focus retention doesn't moves away the focus. For example in showcase the navigation links used for switching to the different use cases of a certain component will send the ice.focus parameter which will trigger the focus retention, the update that comes back will have focus code for the focus managed (by icecore:focusManager) component and also the focus retained navigation link. The navigation link code comes last in the update which causes the focus to remain on the navigaiton link. For showcase we could add an onclick handler on the navigation links to cancels the focus retention for them: .... .... <li style= "padding-left: 15px;" > <ui:param name= "beanName" value= "#{subMenuLink.exampleBeanName}.title" /> <h:commandLink id= "subLink" actionListener= "#{navigationController.navigate}" title= "#{msgs[subMenuLink.title]}" disabled= "#{subMenuLink.disabled}" class="#{(subMenuLink.exampleBeanName eq navigationModel.componentExample) || (navigationModel.componentExample eq null and subMenuLink[' default ']) ? 'selected' : ''} " onclick=" ice.setFocus();">
        Mircea Toma made changes -
        Status Reopened [ 4 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Cruz Miraback made changes -
        Resolution Fixed [ 1 ]
        Status Resolved [ 5 ] Reopened [ 4 ]
        Hide
        Mircea Toma added a comment -

        Use ice.applyFocus function instead of invoking Element.focus method directly. ice.applyFocus introduction was for overcoming the focus related quirks that some browsers have.

        Show
        Mircea Toma added a comment - Use ice.applyFocus function instead of invoking Element.focus method directly. ice.applyFocus introduction was for overcoming the focus related quirks that some browsers have.
        Mircea Toma made changes -
        Status Reopened [ 4 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #38663 Wed Oct 23 16:41:55 MDT 2013 mircea.toma ICE-9483 Use ice.applyFocus function instead of invoking Element.focus method directly. ice.applyFocus introduction was for overcoming the focus related quirks that some browsers have.
        Files Changed
        Commit graph MODIFY /icefaces3/trunk/icefaces/core/src/main/java/org/icefaces/impl/component/FocusManager.java
        Mircea Toma made changes -
        Fix Version/s 3.3 [ 10370 ]
        Mircea Toma made changes -
        Fix Version/s EE-3.3.0.GA_P02 [ 11371 ]
        Fix Version/s 3.3 [ 10370 ]
        Hide
        Ken Fyten added a comment -

        Documentation note: The icecore:focusMgr features are not supported with the ACE components when used in the EE 3.3.0.GA_P02 release as the ACE components in EE 3.3 do not support the "focus sable" interface.

        Show
        Ken Fyten added a comment - Documentation note: The icecore:focusMgr features are not supported with the ACE components when used in the EE 3.3.0.GA_P02 release as the ACE components in EE 3.3 do not support the "focus sable" interface.
        Ken Fyten made changes -
        Fix Version/s 4.0 [ 11382 ]
        Ken Fyten made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Mircea Toma
            Reporter:
            Ken Fyten
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: