When building to the JavaScript target there are many build options and configurations. More importantly
issues like cross origin need server side code that would be able to proxy such requests to make the
client side code seamless…
Steve wrote a rather detailed appendix to the developer guide
covering all of those options from startup splash screen configuration to servlet proxy logic. The build also generates
a ready to deploy WAR file which should make setting this up on any Java servlet container a nobrainer.
During our work on the developer guide for 3.0 we updated the
build hints section with many
previously undocumented hints and also updated the
theme constants section in a similar way.
Hopefully, this will allow us to keep them up to date more easily as we add them in the future. This week
we also updated the Codename One Designer constants combo box with all the documented constants.
Issues with the current release
The current plugin has two annoying bugs, the first of which is a regression in test execution which should be
resolved and will be a part of the next update. However, the second is slightly more annoying….
It seems that our code for packaging the demos into the plugin had a bug where it didn’t override the build.xml
with the latest/current build XML and it got a debug version of that file from my local version of the kitchen sink.
If you create the kitchen sink demo using the current plugin keep in mind that this won’t work for sending an Android
build. This should be fixed for the next plugin update and shouldn’t affect other plugins.
13 Comments
Hi,
I tried this Javascript port, it is excellence, you cannot imagine 95% of my android apps runnable without any modification.
The current problem is the ConnectionRequest cannot do POST request. I have to adjust all my ConnectionRequest to GET.
Second issue is, the “KeyListener” not working. The compiled JS apps just dont listen to the key pressed.
`
f.addKeyListener(‘a’, new ActionListener() {
public void actionPerformed(ActionEvent evt) {
String strChar = getChar(evt.getKeyEvent());
System.out.println(“Key ” + evt.getKeyEvent() + ” pressed,getChar() = ” + strChar);
evt.consume();
}
});
`
Which is working in android/iphone emulator properly.
Hope this issues makes help for those fantastic JS port developer.
Are you running your app through the single-file preview on the build server, the ZIP distribution, or the WAR distribution. The “single-file” preview uses a simplified proxy script for use on App Engine that may have trouble with some requests… I haven’t tested it with POST yet. If you use the WAR distribution, it comes bundled with a better proxy that should handle POST (though haven’t actually tested that either — but it is based on a well-established Proxy servlet that claims to handle POST).
I haven’t implemented key listeners on the form yet. Please post both of these issues (separately) into the issue tracker so I don’t forget to look into them when the time comes.
I am using zip file, and unzip them to my origin server root, and browse directly to my server.
I have posted to issue tracker, separately.
By the way, how soon this javascript port will be in BETA?
Thank you shannah.
Are the POST requests being sent to the same host as the index.html file is being served on, or a different server? If a different server, you’ll need to set a proxy servlet as described here [https://www.codenameone.com…](https://www.codenameone.com/manual/appendix-javascript.html)
The Javascript port will be in beta by July.
Shannah, may I know which component that you already implement key listener? I try to use TextField to handle the key event, but it just fell not so direct as Form. Possible with Label?
Key events aren’t sent on Android (unless the Android device has a physical keyboard) or iOS since they are restricted to physical keys and not virtual keyboards.
To follow input in text fields you can use DataChangeListener.
Yes you are right, I try to use hardware keyboard to do data entry, which allow user additional option for data entry. It is working fine in android, but not in JS port, yet.
Datachanger listener cannot detect ‘Enter’ key, I use with actionListener to detect enter key. But the problem is, I have to press “Enter” twice (first to end edit mode, second enter only trigger actionListener) then only can grab the “enter” key. This is confusing user. Somemore, after the first enter, the textfield cursor ‘drop’ to newline, even I set true to singleline edit, this make the entered words ‘disapear’..
Can you advice any trick to overcome this issue? Or any other component can have keylistener, before shanna implement the keylistener on the form?
Your advice is much appreciated.
I haven’t implemented key listeners at all yet. DataChangeListener should work, and is tested to work with a soft keyboard on android, on desktop, on iOS with both a soft keyboard and a hardware keyboard. I haven’t tested android with a hardware keyboard yet. There may be a bug there. Please file an issue on this in the issue tracker and post a minimal test case.
Can you please advice where should I file yhe issue tracker? Any ETA of the BETA of this JS port?
Thanks!
Beta should be ready by June. See [https://github.com/codename…](https://github.com/codenameone/CodenameOne/issues/)
Hi, Shai, I understand the javascript port will be updated on 1/JUN, may I know is the keylistener implemented currently? Can I try now?
We update the JavaScript port a few times a week. If an issue exists and was marked fixed it will take less than a week for it to reach production. I suggest you follow up in the issue tracker on github.
Look like I wrongly post this issue to googlecode previously. Thats why this issue still there.
I just post to github with the title “Javascipr port, form not support keylistener #1516”
Just hope this issue can be fixed.
Thank you.