ICEfaces
  1. ICEfaces
  2. ICE-8498

New icecore:defaultAction component

    Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: EE-3.0.0.GA, 3.1
    • Fix Version/s: 3.3
    • Component/s: Bridge, Framework
    • Labels:
      None
    • Environment:
      ICEfaces

      Description

      Create a component which will allow to control which command to initiate form submit when enter key is pressed.

      For example such component will allow to execute button#2 by default when a user hit Enter:

      <h:form id="form">
      ...
          <h:commandButton value="Ajax button" id="button1" actionListener="#{sampleBean.ajaxSubmit}">
               <f:ajax execute="@this" render="@form">
          <h:commandButton>
          <h:commandButton value="Regular Button" id="button2" action="#{sampleBean.nonAjaxSubmit}" />

          <ace:defaultAction target="#{someEL_poinitng_to_button2}" />
      ...
      </h:form>

      The component could also support more keys in addition to Enter.

      Example:
      <h:form id="form">
      ...
      <f:ajax execute="@this" render="@form">
          <h:commandButton value="Submit" id="button1" actionListener="#{sampleBean.ajaxSubmit}"/>
          <h:commandButton value="Cancel" id="button2" action="#{sampleBean.nonAjaxSubmit}" />
      <f:ajax/>

          <ace:defaultAction target="button1" key="Enter"/>
          <ace:defaultAction target="button2" key="Esc"/>
      ...
      </h:form>

        Activity

        Evgheni Sadovoi created issue -
        Evgheni Sadovoi made changes -
        Field Original Value New Value
        Salesforce Case [5007000000NJSvR]
        Hide
        Ken Fyten added a comment -

        This likely should be an icecore: component.

        Show
        Ken Fyten added a comment - This likely should be an icecore: component.
        Ken Fyten made changes -
        Fix Version/s 3.3 [ 10370 ]
        Assignee Mircea Toma [ mircea.toma ]
        Affects Documentation (User Guide, Ref. Guide, etc.),Sample App./Tutorial [ 10003, 10001 ]
        Assignee Priority P2 [ 10011 ]
        Component/s Bridge [ 10011 ]
        ICEsoft Forum Reference http://www.icesoft.org/JForum/posts/list/21411.page
        Ken Fyten made changes -
        Assignee Priority P2 [ 10011 ] P3 [ 10012 ]
        Ken Fyten made changes -
        Assignee Priority P3 [ 10012 ] P2 [ 10011 ]
        Mircea Toma made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #33245 Mon Jan 28 05:10:26 MST 2013 mircea.toma ICE-8498 Introduced new DefaultAction component. Modified FormSubmit system event listener to provide a key code -- element id mapping when enhancing the form for capturing key presses. Modified bridge to read the mapping in ice.captureEnterKey and submit form when key code matches one of the mappings.
        Files Changed
        Commit graph MODIFY /icefaces3/trunk/icefaces/core/src/main/java/org/icefaces/impl/event/FormSubmit.java
        Commit graph MODIFY /icefaces3/trunk/icefaces/core/src/main/resources/META-INF/faces-config.xml
        Commit graph MODIFY /icefaces3/trunk/icefaces/core/src/main/javascript/application.js
        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/impl/component/DefaultAction.java
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #33247 Mon Jan 28 05:18:10 MST 2013 mircea.toma ICE-8498 Added more key mappings.
        Files Changed
        Commit graph MODIFY /icefaces3/trunk/icefaces/core/src/main/java/org/icefaces/impl/component/DefaultAction.java
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #33248 Mon Jan 28 09:25:22 MST 2013 mircea.toma ICE-8498 Make sure there are no spaces is the component ID.
        Files Changed
        Commit graph MODIFY /icefaces3/trunk/icefaces/core/src/main/java/org/icefaces/impl/component/DefaultAction.java
        Hide
        Mircea Toma added a comment -

        Introduced new DefaultAction component. Modified FormSubmit system event listener to provide a key code – element id mapping when enhancing the form for capturing key presses. Modified bridge to read the mapping in ice.captureEnterKey and submit form when key code matches one of the mappings.

        Show
        Mircea Toma added a comment - Introduced new DefaultAction component. Modified FormSubmit system event listener to provide a key code – element id mapping when enhancing the form for capturing key presses. Modified bridge to read the mapping in ice.captureEnterKey and submit form when key code matches one of the mappings.
        Hide
        Mircea Toma added a comment -

        Renamed ice.captureEnterKey to ice.captureKeypress.

        Show
        Mircea Toma added a comment - Renamed ice.captureEnterKey to ice.captureKeypress.
        Hide
        Mircea Toma added a comment -

        Added the following key mappings: "Enter", "Esc", "Space", "Page Up", "Page Down", "Page Up", "Left arrow", "Up arrow", "Right arrow", "Down arrow", "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", "F11", "F12".

        Show
        Mircea Toma added a comment - Added the following key mappings: "Enter", "Esc", "Space", "Page Up", "Page Down", "Page Up", "Left arrow", "Up arrow", "Right arrow", "Down arrow", "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", "F11", "F12".
        Hide
        Mircea Toma added a comment -

        The component can be used in within a form to capture a certain key press. Multiple icecore:defaultAction instances can be used to capture different keypresses.

        Usage:

        <h:form id="form"> 
        ... 
            <icecore:defaultAction actionListener="#{sampleBean.update}" key="Enter"/> 
            <icecore:defaultAction action="#{sampleBean.cancel}" key="Esc"/> 
            <icecore:defaultAction action="#{helpBean.help}" key="F1"/> 
        ... 
        </h:form>
        
        Show
        Mircea Toma added a comment - The component can be used in within a form to capture a certain key press. Multiple icecore:defaultAction instances can be used to capture different keypresses. Usage: <h:form id= "form" > ... <icecore:defaultAction actionListener= "#{sampleBean.update}" key= "Enter" /> <icecore:defaultAction action= "#{sampleBean.cancel}" key= "Esc" /> <icecore:defaultAction action= "#{helpBean.help}" key= "F1" /> ... </h:form>
        Mircea Toma made changes -
        Status In Progress [ 3 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Hide
        Mark Collette added a comment -

        It would be good if the individual key names did not have spaces, so that the key property could take a space delimited list of keys that would trigger the action/actionListener. This way apps can choose between using different defaultAction components with different actionListener(s) versus one defaultAction with one actionListener that itself looks in the request parameter map to determine which key was pressed and act accordingly.

        Show
        Mark Collette added a comment - It would be good if the individual key names did not have spaces, so that the key property could take a space delimited list of keys that would trigger the action/actionListener. This way apps can choose between using different defaultAction components with different actionListener(s) versus one defaultAction with one actionListener that itself looks in the request parameter map to determine which key was pressed and act accordingly.
        Ken Fyten made changes -
        Resolution Fixed [ 1 ]
        Status Resolved [ 5 ] Reopened [ 4 ]
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #33481 Mon Feb 18 04:17:23 MST 2013 mircea.toma ICE-8498 Modified key names made of two words to not have spaces and always use camel case.
        Files Changed
        Commit graph MODIFY /icefaces3/trunk/icefaces/core/src/main/java/org/icefaces/impl/component/DefaultAction.java
        Hide
        Mircea Toma added a comment - - edited

        Modified key names made of two words to not have spaces and always use camel case. So now the keys names look like this: PageUp, PageDown, ....., LeftArrow.

        As far as multiple key mappings wired to the same action/actionListener, this already can be done:

        <h:form id="form"> 
        ... 
            <icecore:defaultAction actionListener="#{sampleBean.update}" key="Enter"/> 
            <icecore:defaultAction actionListener="#{sampleBean.update}" key="Esc"/> 
            <icecore:defaultAction actionListener="#{sampleBean.update}" key="LeftArrow"/> 
        ...
        </h:form>
        

        It might not be as terse as the suggested approach but acceptable in those rare cases where needed.

        Show
        Mircea Toma added a comment - - edited Modified key names made of two words to not have spaces and always use camel case. So now the keys names look like this: PageUp, PageDown, ....., LeftArrow. As far as multiple key mappings wired to the same action/actionListener, this already can be done: <h:form id= "form" > ... <icecore:defaultAction actionListener= "#{sampleBean.update}" key= "Enter" /> <icecore:defaultAction actionListener= "#{sampleBean.update}" key= "Esc" /> <icecore:defaultAction actionListener= "#{sampleBean.update}" key= "LeftArrow" /> ... </h:form> It might not be as terse as the suggested approach but acceptable in those rare cases where needed.
        Mircea Toma made changes -
        Status Reopened [ 4 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Ken Fyten made changes -
        Component/s Framework [ 10013 ]
        Component/s ACE-Components [ 10050 ]
        Ken Fyten made changes -
        Summary New default action component New icecore:defaultAction component
        Ken Fyten made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Mircea Toma
            Reporter:
            Evgheni Sadovoi
          • Votes:
            4 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: