Google+ Followers

Friday, March 22, 2013


Mobile world and web approach solutions – SmartGWT.Mobile

As the demands increase for applications to mobile phones, tablets and smart phones I would like to, go through at existing web solutions for mobiles, among native applications, and analyzing a little bit, and emphasizing one of them, the SmartGWT.Mobile product.

The first thing that comes in my mind, of course is html, javascript, css3, html5. The mobile web is growing up quickly, and tons of great HTML5 features are already supported on modern mobile browsers. Web developers can use the same set of technologies they know and love to build rich web applications that work across different device types. HTML5 allows us to use efficiently local storage, multimedia introducing new audio-video types like: MP4, WebM, Ogg and offers a canvas for graphics. Supports mouse and touch together.

If you are not satisfied with simple web pages or applications, you might think forward using technologies, that offers us, server side communications too. HTML5 can be paired with server side solutions like PHP or JSP. And then, you can enter into Java world, because there are plenty of possibilities which says that you can write all the code, the server side and even the client side program, all in java. When you are ready with programming, you just translate or compile your program to javascript and html5. And more, because your output will be a more efficient html5 and ajax code, than one written manually. You don't have to worry about browser's compatibility and of course the server side code will run on a java web server. Thanks for GWT-GoogleWebToolkit, such solutions are the following, let's see a few of them:

MGWT; GWT-Phonegap
mgwt is a library for developing mobile apps and mobile websites with GWT from one code base. mgwt provides native looking widgets for many platforms, animations and many other things that are needed for writing mobile apps. gwt-phonegap enables GWT apps to use Phonegap. With Phonegap HTML5 apps can access the same device features that native apps can use from Javascript, such as the file system or contacts.
With mgwt and gwt-phonegap you can deploy your GWT apps into any app store or let your users use them as a website.
Both projects are available under apache 2.0 license from maven central.
mgwt provides mobile widgets that are compatible with UIBinder and the Editor Framework. mgwt integrates touch events and animation events with its own DOM implementation and provides gesture recognizers on top of that.
There are themes for iPhone, iPad, android phones, android tablets and blackberry. For going offline there is an automatically generated HTML5 offline manifest.
In dev mode gwt-phonegap can emulate the Phonegap API so that developing of Phonegap apps can happen inside GWT dev mode.
gwt-phonegap also provides utilities to make GWT RPC work in a Phonegap environment. Personally, I think that the one disadvantage of this solution, is that for GWT PRC server side communications, you must use the GWT-Phonegap library too, among the mgwt package.

Emitrom products:
emitrom – comes with a set of product for different kind of applications like: Flash4J, Lienzo, Titanium4JMobile, Touch4J. They are very modern and interesting, is worthy to see and try. Develop slick mobile web apps that will look and feel like native iOS, Android and BlackBerry using the Secha Touch API but do it in the language you know with the tools you already know in Java. So sounds good, but one thing brothers me a little bit, for the functionality, you have to add additional packages to your emitrom project, like Sencha Touch Javascript library, or Phonegap.

The smartclient  platform makes is simple to build powerful, high-productivity web applications on pure web standards. SmartGWT is coding in java, and getting the power of the SmartClient framework.
Smart GWT combines the industry's richest set of GWT UI components with a Java server framework to provide an end-to-end solution for building business web applications. Provides all the power of true Ajax, deep server integration, rich enterprise ui components, and mobile support without a rewrite. Even if you know nothing about mobile development, your Smart GWT application supports mobile. Finger taps and gestures arrive as normal mouse events, so your event handlers just work — users can even trigger context menus and hovers via touch-and-hold, and drag and drop via finger slides. Device-aware components automatically switch appearance and behavior to mimic typical mobile UIs.
Want more control? Gesture & orientation change events, as well as native functions like phone dialing are all there to let you fully tune the mobile experience.
In plus, SmartGWT offers us a new product family named SmartGWT.Mobile.
When should I use vs Smart GWT?

In a nutshell, if your application:
1. primarily targets phones and tablets: use only
2. primarily targets desktops and tablets: use Smart GWT only
3. targets desktops, tablets and phones: consider using both; however, depending on devices and requirements you may use just one or the other.

I would like to present a short application written in java with SmartGWT.Mobile which has a server side RPC communication, getting data from a server, and showing into a TableView mobile component. There is no need of additional packages like, phonegap or sencha to run this program. I put this running code on a free java server to demonstrate the functionality. If you test this in a desktop pc, you should us the google chrome explorer, because this explorer handles dialog boxes for mobiles. Google Application Engine offers us a web server for java applications, and it has also a free but limited storage.
You can find the link of my mobile applications on my site

My personal conclusion is that, you may use any of these technologies, if you want a web solution on your mobile, and as you see, these technologies are making effort also, to achieve a native appearance or sometimes even native functionalities too. It is ok! but for example, I don't consider a server side communication, being just a native functionality, it is also a web programming pretension
Web pages, I think, never will transform to real, true native applications. And don't have to. At the end you will always deal with javascript and html as a result of your work. Is not a problem, it is in order.  And again, my personal opinion, is that, for a real native application use the right tool or programming language, because there are also many solutions, even in java, like Codename One. For web pages, sites and web applications the above mentioned technologies are the best :) 

Saturday, March 9, 2013

Java swing with JavaFx

Enhance a Java swing frame with JavaFx componets or functionality

My purpose with this short blog to present a very simple example of how I was understood the use Java swing components together with Javafx components on a Java Frame form. So, I just was curios to see how can I improve a swing form with the new modern JavaFx componets or technology. Having this idea in my mind I have looked for technical documents at oracle javafx blog site, and I found the following 2 interesting articles:

More about javafx on: Oracle's site

Firs let me show you to picture about my running application, that tells you all, about my short example.

Image 1:

Image 2:

Now as you see above, just a short demonstration of how can we use together a javafx and a swing button on a JFrame form. With Netbeans IDE, the steps are easy primitve, but of course you can use your favorite IDE to try this also. I packed all the application in a zip file, so you can even download for free, if you want to look over.

First I created an empty, new JavaFx project, called javafxswingapplication1. Then you may wonder, but I created a new java file, not a javafx unit. This was an empty JFrame form, and I just put on it a swing button, a swing text field and also a JPanel swing container. The JPanel will hold the javafx components, designed on a JFXPanel. The “birdge” between the swing and javafx, is the JFXPanel javafx container, which can be added to the JPanel. The swing part of the form was designed with the swing designer from the Netbeans IDE, and the javafx code I added manually to the form.

All the javafx code is wrapped into a single method and is called from the constructor of the Jframe form, after the call of initcomponents() swing initialization method. The javafx project is set to start this frame at running the application. This can be done at project properties, run – main class.

So the key point is the javafx method, let's see how does it look. I was called this method: createSceneAndAddToSwing

private void createSceneAndAddToSwing() {
PlatformImpl.startup(new Runnable() {
public void run() {
jfxPanel = new JFXPanel();
Group mainPanel = new Group();
Scene scene = new Scene(mainPanel,300,150);
Button btn = new Button();
btn.setText("From JavaFX");
btn.setOnAction(new EventHandler<ActionEvent>() {
public void handle(ActionEvent event) {
jTextField1.setText("It was pushed a JavaFX button!");

//add this "javafx" to the swing jframe's jpanel
jPanel1.setLayout(new BorderLayout());
jfxPanel.setPreferredSize(new Dimension(PANEL_WIDTH_INT, PANEL_HEIGHT_INT));
jPanel1.add(jfxPanel, BorderLayout.CENTER);
So that's it, for a more complex javafx functionality in a swing frame, I would firstly create a standalone javafx project to wirte and test the desired javafx and then to embed it onto a jpanel container using the JFXPanel as a bridge.

Tuesday, March 5, 2013

NetBeans 7.3 Contribution

Today I got this response to my NetBeans 7.3 contribution. I am very happy now :)