Recently faced a requirement from client that existing ADF
essentials application need to run on Stand Alone Kiosk which did not have
keyboard support. Since Oracle’s ADF components do not come with in-built virtual keyboard had to search a lot and came to a conclusion that we have.
Following best ways of implemting desired functionality
1. Custom JavaScript driven keyboard.
2. JQuery virtual keyboard.
3. Prime faces Keyboard component.
Since prime faces is also JSF based component suite I decided
to give it a try and following steps helped me actually in integrating both
component suites.
1. Download primefaces-5.2.jar community edition from prime
faces download site http://primefaces.org/downloads
2. Copy downloaded file to your project’s WEB-INF\lib
directory
3. Add this downloaded jar file to project properties using Jdeveloper.
4. Once you do this you will see the Prime faces library
listed in component window.
5. You can now drag drop components in source mode of your
JSF page.
You can have look at the below code for reference
primedemo.jsf
<af:document title="primedemo.jsf"
id="d1">
<af:form
id="f1">
<af:panelStretchLayout id="psl1"
inlineStyle="width:inherit;">
<f:facet name="bottom"/>
<f:facet name="center">
<af:panelGroupLayout id="pgl1" layout="scroll"
inlineStyle="width:inherit;">
<primefaces-p:keyboard id="k1"
binding="#{backingBeanScope.primedemo_backing.keyboardvalue}"/>
<af:button text="Show" id="b1"
actionListener="#{backingBeanScope.primedemo_backing.buttonActionListener}"/>
</af:panelGroupLayout>
</f:facet>
<f:facet name="start"/>
<f:facet name="end"/>
<f:facet name="top"/>
</af:panelStretchLayout>
</af:form>
</af:document>
primedemo_backing.java
package view;
import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
import org.primefaces.component.keyboard.Keyboard;
public class primedemo_backing {
private Keyboard
keyboardvalue;
public
primedemo_backing() {
}
public void
setKeyboardvalue(Keyboard keyboardvalue) {
this.keyboardvalue = keyboardvalue;
}
public Keyboard
getKeyboardvalue() {
return
keyboardvalue;
}
public void
buttonActionListener(ActionEvent actionEvent) {
// Add event code here...
FacesMessage
Message = new FacesMessage(String.valueOf(keyboardvalue.getValue()));
Message.setSeverity(FacesMessage.SEVERITY_INFO);
FacesContext fc = FacesContext.getCurrentInstance();
fc.addMessage(null, Message);
}
}
Versions Used
1.Oracle Jdeveloper 12.1.3
2.PrimeFaces community edition version primefaces-5.2.jar
Cheers