Virtual keyboard

Hello all,

I’m developing an keyboardless application, so I have to use virtual keyboard. I found a javascript VK
here
but I coudn’t figure out how to use it with vaadin. Where can I put the .js and .css to use in the code and how to set Textfield html property “class” to use it?

Thanks in advice,

Fernando

Hi!

You need to create a custom client-side GWT widget and integrate it with Vaadin. If you are not familiar with creating a custom Vaadin component you may learn more at
Vaadin Book chapter 11
.

It might not be a simple task to use native javascript library within the GWT code. IMO it would be better to re-write the whole library with Java to get all advantages of GWT. But if that’s not possible, and there are no alternative libraries already done for GWT, then you could do the following trick in your client-side widget:

MyCustomWidget.java (implements com.vaadin.terminal.gwt.client.Paintable)


   import com.google.gwt.core.client.GWT;
   import com.google.gwt.resources.client.ClientBundle;
   import com.google.gwt.resources.client.TextResource;
   import com.vaadin.terminal.gwt.client.ApplicationConnection;
   import com.vaadin.terminal.gwt.client.UIDL;
   ...
   public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
        ...
	final Resources resources = GWT.create(Resources.class);
	String someJsCode = resources.someJs().getText();
	eval(someJsCode);
        ...
   }

   public static interface Resources extends ClientBundle {
	@Source("myJavascriptFile.js")
	TextResource someJs();
   }

   private static native void eval(String s)
	/*-{
	    eval(s); // This will execute the "myJavascriptFile.js" file.
            // Here you can call any function in the js file
	}-*/;
   ...

myJavascriptFile.js file should be in the same location that the widget’s source file. Locations for any css and other theme related files needed is described in the
Vaadin Book chapter 11
.

Hello,
because I also need a virtual keyboard, I googled and found some JavaScript libraries.

Additionaly I found a
gwt-keyboard
.
Has anyone tried or successfully embedded this one into vaadin?

Thanks
Michael

any luck regarding this issue ?

With Vaadin 7, integrating one of the libraries (even one of the JavaScript libraries) should be quite easy - see tutorials on integrating JavaScript components
here
.

Hi, maybe is too late but I´m trying the same. I was looking for a Virtualkeyboard too.

I have found this virtualkeyboard
https://vaadin.com/directory#!addon/virtualkeyboard-add-on

Hope this work for someone else.