-
1. Re: Simple doubt about rich:hotkey in RichFaces4.2.3
jhuska Jan 9, 2013 6:34 AM (in response to edilmar)Hi there,
checkout VDL dock for possible options of key bindings:
http://docs.jboss.org/richfaces/latest_4_2_X/vdldoc/
From there:
The key sequence to be pressed, single keys separated by + (e.g. 'ctrl+a'), more key sequences separated by space. Special keys are accepted as follows: backspace, tab, return, shift, ctrl, alt, pause, capslock, esc, space, pageup, pagedown, end, home, left, up, right, down, insert, del, numlock, scroll, meta, f1, f2, ..., f12
There you can also find that when providing no selector attribute the hotkey is bound to the whole document.
Was that helpful ?
-
2. Re: Simple doubt about rich:hotkey in RichFaces4.2.3
edilmar Jan 9, 2013 10:10 AM (in response to jhuska)Thanks for the above link.
I tried this simple code to open a panel when user press CTRL+A, but it didn't work. Tested with Chrome18 and Firefox17.
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich"
template="/WEB-INF/templates/templateTeste.xhtml"
>
<ui:define name="content">
<h:form id="formCad">
<h:outputText value="TEST"/><br/>
<a4j:commandButton id="buttonPanel" value="Open"
render="openGrid"
action="#{t.openPanel}"
oncomplete="#{rich:component('openPanel')}.show();"/>
<rich:popupPanel header="A Panel" id="openPanel" width="600" height="300" domElementAttachment="form">
<rich:panel style="width:100%;height:100%" id="openGrid">
<h:outputText value="Test Panel" />
<a4j:commandButton value="Close Panel" onclick="#{rich:component('openPanel')}.hide(); return false;" />
</rich:panel>
</rich:popupPanel>
<rich:hotKey key="ctrl+a" preventDefault="true">
<rich:componentControl target="buttonPanel" operation="click"/>
</rich:hotKey>
</h:form>
</ui:define>
</ui:composition>
Tried operation = click, onclick, complete, oncomplete...
-
3. Re: Simple doubt about rich:hotkey in RichFaces4.2.3
robinho Jan 9, 2013 11:51 AM (in response to edilmar)Have you tried something like:
<rich:hotKey key="ctrl+a" handler="#{rich:element('buttonPanel')}.click()" /> ?
-
4. Re: Simple doubt about rich:hotkey in RichFaces4.2.3
edilmar Jan 9, 2013 12:33 PM (in response to robinho)I tried now and it didn't work too.
I think "handler" property worked only in RichFaces3.x versions.
I didn't find this property in javadocs and showcase from RichFaces4.x.
-
5. Re: Simple doubt about rich:hotkey in RichFaces4.2.3
edilmar Jan 10, 2013 1:01 PM (in response to edilmar)If I put the hotKey to work directly with openPanel popupPanel, it works!
The problem in this case is that hotKey doesn't run some code needed by a4j:commandButton, like action="#{t.openPanel}" in my sample code.
<rich:hotKey key="ctrl+a" preventDefault="true"> <rich:componentControl target="openPanel" operation="show" /> </rich:hotKey> Is it possible that hotKey doesn't work with a4j:commandButton?
When running with JS Console Window from Firefox opened, no JS errors appear.
-
6. Re: Simple doubt about rich:hotkey in RichFaces4.2.3
edilmar Jan 25, 2013 2:07 PM (in response to edilmar)I published a issue in JIRA: https://issues.jboss.org/browse/RF-12759
-
7. Re: Simple doubt about rich:hotkey in RichFaces4.2.3
edilmar Feb 14, 2013 8:42 AM (in response to edilmar)Tested with RF4.3.0, and it still doesn't work.
-
8. Re: Simple doubt about rich:hotkey in RichFaces4.2.3
rodmarcm Feb 15, 2013 11:31 AM (in response to edilmar)Hi Edilmar !
handler attribute of rich:hotKey is no more used in RF 4.3.
I think that a4j:commandButton is not doing its job (action="#{t.openPanel}") because it is out of the tatget that you're indicating in rich:componentControl(target="openPanel").
Maybe you can try something like this inside rich:hotKey tag:
<rich:componentControl target="t" operation="openPanel" />
rich:componentControl takes as target one component available in your page (Java Bean) and then executes its method indicated in operation parameter.
However if you want to make appearing the popup after some server procesing then you should link your hotKey to make ajax call with the reRender parameter and control the visibility with another variable modified at server side.
Regards,
-
9. Re: Simple doubt about rich:hotkey in RichFaces4.2.3
edilmar Feb 18, 2013 4:02 PM (in response to rodmarcm)This didn't work too.
-
10. Re: Simple doubt about rich:hotkey in RichFaces4.2.3
edilmar May 9, 2013 4:37 PM (in response to edilmar)I tested this problem in Firefox16/17/18, Chrome 14/15/16/17/18 and IE8/9/10, with the same behaviour.
-
11. Re: Simple doubt about rich:hotkey in RichFaces4.2.3
edilmar Jun 25, 2013 5:50 PM (in response to edilmar)A friend in JIRA made a workaround that worked fine, using onkeydown event in rich:hotkey.