Web client development technology for java fundamentalist - java

I am a java developer and I would like to develop rich clients for the web. My problem is that I hate javascript, flash, etc. and most of the programming languages usually used for web client. I would be happy to keep doing java to develop web clients that may be used on common web browsers and, why not, on new fashion mobile devices. I am looking for some advices/warnings to make a good choice.
Java applet seems perfect for my case, but according to some rumors, it is not a really sustainable solution. Should I have a look at JavaFX? GWT? Are there some other possibilities?

What do you want to do? Vaadin is based on GWT and therefore utilizes HTML5 + JavaScript which is much slower than a Java Applet. I have tried boat and Applets with Swing is A LOT
faster than Vaadin.
With Java Applets, Swing and Hessian you have unbeatable performance for business applications. Hessian is a very fast binary web service protocol. With JavaScript you are usually limited to text-encoded web service protocols like Json and various XML-based protocols. Text-based protocols consume a lot of CPU, memory and bandwidth compared to binary protocols - and they don't really provide you with any advantage at all.
The weak point of Applets is hardware accelerated graphics like OpenGL and multimedia. If you are developing games or movie players Applets is not that great.
JavaFX promise to fix hardware accelerated graphics performance and video codecs. With your description it is not clear if you need to wait for that.
However if you really need more than what standard applets will provide you than web start may be a solution. Its a bit like the old ActiveX with signed or unsigned application that gets extra privileges - either by being signed by sun or by asking the user. This will allow you to use JOGL or a 3d scene graph engine.

You are a perfect fit for JavaServer Faces (JSF). Yes just try them on. Look, you look great in them. The appeal of JSF is 1. It is a standardardized technology, part of Java EE 2. It relies a lot on Java programming over any JavaScript coding (which is not done at all). 3. JSF has been around for awhile, and it works quite well. In addition, JSF works with Ajax, out of the box (an added bonus), without writing a single syllable of JavaScript. The only downside is that you will have to code some html, and the "facelets" are basically html pages with some extra tags thrown in that you need to learn. But the vast majority of the real processing is done in Java. JSF also works without the extra baggage of Java EE, it was built to work with a plain Tomcat like server (or Glassfish or JBoss, etc) and a browser, and Java SE (the desktop version).

I think JavaFX looks very promising as a Java-based RIA technology. It's cutting edge though. Mac OS X and Linux versions are only available as a preview yet. Mobile and other device support has been announced but its not out yet, AFAIK.

Vaadin would also be suitable, requiring no Javascript or HTML at all, even for new component development. Page layout is done using layout managers (like Swing). New components can be composed from existing components (again, like Swing), or written from scratch using GWT (fairly straightforward, and pure Java).
There is a reasonable selection of add-ons covering some features not in the core framework.
The framework is very easy to use for Java developers with Swing experience, and has a polished look and feel out of the box. However, the layout managers do make it difficult to change the look and feel using CSS - simple tasks like adding borders are hard.
The layout is also quite "heavy", which means that Vaadin websites can feel slightly sluggish. In my experience, the feel is still better than some of the heavier JSF frameworks.
It is compatible with all major browsers.
Demonstrator: http://demo.vaadin.com/sampler/
You could also consider Wicket. This has a similar component-based approach, but the components are defined using simple HTML fragments, which results in a much lighter DOM (and therefore better browser performance) and far better control over the look and feel. Wicket has a steeper learning curve, however.

After trying GWT and struggling with its so-called "super-dev mode", I discovered JavaScript programming was not so painful. I forced myself to learn and practice and I finally fully adopted it. There are numbers of nice things in JavaScript and a huge number of libraries. My recommendation for people in my case is just to persevere in learning JavaScript using for example w3schools tutorial.

Related

Java framework to build Rich Web Apps for IE8

We build Java Spring MVC web apps for internal company users that have pretty basic GUIs. A few have jQuery/Ajax to add some GUI richness, but nothing major. For a new app, the business users are asking for a very rich web app (ex: drag and drop functionality, flexible tables like in Excel, etc). Our users can only use IE8 and we can't run Java applets in the browser. Also we don't have the time to learn an entirely new language (ex: Flex), so the learning curve can't be too steep for Java MVC developers. This app will only be used by company internal users (~ 100 concurrent users).
I have looked into some of the newer Javascript MVC frameworks (ex: Spine, Backbone, Ember). My main concern is that I am not sure how well the resulting complex Javascript will run under IE8. A secondary concern is that we don't have experience trying to maintain a lot of code in Javascript. It seems like a lot of Javascript code would become a maintenance nightmare (non-typesafe, harder to debug, not as many tools, etc).
I have also looked into GWT and ZK. These frameworks reduce the concern about maintaining a lot of Javascript code, but the IE8 performance concern still remains. If we built a very rich GUI in one of these frameworks, would the resulting auto-generated Javascript work well in IE8?
What framework would you recommend that would meet the high-level user requirements listed above and also meet the non-functional requirements (small learning curve, low maintenance burden, good future support)? Has anyone tried to do something similar to this? If so, what did you use and how did it turn out?
We are working with Vaadin, which is quite similar to GWT (develop Java code), an it works fine in all browsers. For us, scalability of the view is the more important thing (manage large code sets)
You can go with ZK OR Primefaces
Both are very rich web framework Just explore their Demo decide which will be very helpful for you.
Vaadin supports drag and drop but programming model for d&d is a bit nightmarish.
I would certainly pick GWT in your case. Google guys put a lot of work to have it working with ie8 well. note GWT has good tool support like Eclipse plugins. to avoid writing everything from scratch, you could start with some framework that builds on GWT like gwtplatform or ExtGWT.
You may also consider ADF Faces, it has a very rich component set, you can see a demo here.
In my company all our projects are done with Apache Wicket.
This java web framework is simple, powerful, very efficient, component based and everything is testable.
And the community is great.
Have a look to http://wicket.apache.org.
Francois

How can I create a "modern looking" Java desktop application?

Similar questions to this are asked periodically, but many of these answers are outdated.
I need to build a cross-platform desktop application in Java with a GUI of comparable quality to contemporary desktop apps.
Swing is the default choice, but I have yet to encounter a Swing application that didn't look, at the very least, quite dated and clunky (subjective, I know, but with GUIs it's hard to avoid aesthetic judgements).
I notice that the new Bitcoin client now uses QT with Java bindings, and does have an attractive user interface, but this has the disadvantage that it is no-longer pure Java.
So much of what I find when I search for Swing-related libraries is 5 years old or older, even though the aesthetics of desktop applications have evolved significantly since then.
If you needed to build a Java desktop application from scratch, what would you use for its GUI?
I can also offer you a new LaF to look into - WebLaF. I'am currently working on it to bring a lot of UI features and make work with Swing much easier for anyone by just using WebLaF library basic features.
A few examples showing how some of WebLaF components look like:
Some of main goals i am targeting:
Great and modern-looking L&F with support for all Swing components
An extensive set of additional components which you won't find in standard Swing
A big set of Utility classes to assist you with writing the code
WebLaF library also suggests a few other advantages and unique features:
It is an open-source project (GPLv3 licensed)
Easy components styling using painters system (specifically with 9-patch files)
Quick and easy customization of the default "Web" style
Lots of features to accelerate and simplify Swing application interface creation
You can try the demo-app to see if it is modern and simple enough :)
Have you looked into JavaFX 2.0? It is designed to interop easily with Swing, and has many modern 'good looking' controls.
Also, as lrAndroid mentions, a Swing app can look like a native app if you set the system look and feel with:
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
Look into changing the Look and Feel of your Java program. This allows you to customize the overall "theme" of your program.
Here is information on changing the LAF.
I've had good experiences with FlatLaf.
It's easy to install, it's cross-platform, it has no external dependency, it's open-source (Apache license), it includes dark modes and there are tons of themes.
After adding :
UIManager.setLookAndFeel( new FlatLightLaf() );
your app looks like it was written during the last decade, and not during the previous millenium.
It also has one high-contrast theme, for accessibility.
Modern Javascript frameworks (ExtJS, Dojo, etc...) offer the same widgets richness or more (Excel like grids for instance), a wider variety of L&F and usually fit better with the OS of the user.
Users are also very comfortable with their browsers and, hey, "modern stuff" is on the web, and the modern web today is HTML+Javascript.
The overhead of converting an app to "web like" is minimal. An embedded Jetty can remain really small and disk space has become much less of an issue.
There are additional benefits going down this route for the future evolutions of the application.
Suddenly, the desktop app becomes a server app, which can be accessed from another desktop. We were able top promote a desktop app to 'portal' in a matter of weeks.
Rewriting the app in terms of (Ajax) web services provides an easy transition to creating a full REST (or SOAP...) services stack. The app can then be integrated to other applications, easily monitored externally, etc...
Support of other devices (smart phones, tablets,...) becomes much easier, by concentrating on the UI layer only
As the app grows, separation of concerns is cleaner; developers working on the UI do not have to mess with low level code.
There are a lot of excellent JS/HTML designers and developers that do not program in Java.
EDIT
3 years later this has become extremely easy thanks to Electron
Try one of these:
JTattoo
JGoodies
Quaqua
What about Nimbus look and feel? Oracle Link
Also take a look at SO-Question
I know this question is old, but if you don't want to use FX and still want to use Swing, then try MacWidgets, i've used it on a couple projects. It's very light, and looks great. Below is an old project i was working on, over time i've perfected using macwidgets and now use it internally in my company.
http://www.digitalhand.net/projects/jdataanalyzer/mainGUI.png
QT is quite extensive but also very big (bloated) and complex. There is also the SWT library being used by open office for instance. SWT uses native UI widgets for buttons, tables etc where as Swing emulates them.
However, the trend is clearly towards writing rich client applications for the browser using HTML and Javascript. Both of these have made huge strides in the past few years.
HTML5 specifically targets rich client applications with features such as better forms and local database to support disconnected scenarios (note that this last feature is not standardized yet but it is implemented by all latest browsers).
Javascript has now powerful libraries with jQuery and its many plugins. There are even languages like Coffeescript which can be used to produce Javascript with a simpler and more powerful syntax.
There's also no need for such apps to connect to an outside server. Small footprint local servers (eg: jetty, node.js, ...) and databases (SQLite, H2,...) can be installed on the client to make a completely self contained application.
Swing is good (stable, documented, supported until 2026). The problem is that it relies on the LookAndFeel system that provide a very limited number of boilerplate choices. It should be easy to change the appearance of each component individually and then unleash its creativity. Unfortunately it is painful. IMHO frameworks should be built on top of Swing to make it possible instead of creating JavaFX.
Take a look at https://github.com/dotxyteam/ReflectionUI.
Ex GUI: http://javacollection.net/reflectionui/wp-content/uploads/2017/08/general.png
Go for Jetpack Compose for Desktop. It's a super modern reactive UI which is nice to work with. It also works the same as it would for Android with very few exceptions. It's Kotlin though instead of Java, but these are both JVM based and it's very easy to make the jump.

What are my options for building a rich web application?

I'm working on a client-side Java application for which I want to create a web-based user interface (which will be served up to a browser from the local app). At the risk of oversimplifying, its a microblogging tool that will support functionality similar to Twitter and Facebook. Its open source, and you can read more on our wiki.
Its important that this app is extremely easy to use, and I also want it to look good relative to contemporary web applications (such as the examples available on the Chrome web store). Since I am not a web designer, I'm hoping to use tools that give me an attractive UI "out of the box". Oh, and I need to keep the distributable file reasonably small (un him so whatever I use needs to be reasonably lightweight.
So far, I've looked at Sproutcore and GWT.
Sproutcore apps definite have the appearance I'm hoping for, but I'm not that familiar with JavaScript, and after some experimentation is not entirely clear to me how I will achieve some of the more sophisticated functionality that I think I'm going to need.
Being Java, GWT is more within my comfort zone, however I had a hell of a time just getting my development environment set up properly. It seems that GWT wants to dictate the structure of my application, but since the user interface is only a small part of it I'm not willing to build the entire app around GWT.
Something else I've been thinking about is using CoffeeScript (which seems more palatable him and him him him him him than JavaScript, and there are Maven builders for it), perhaps together with JQuery-UI.
What other options should I consider?
To recommend two big javascript frameworks Sencha and Cappuccino.
These have an extensive UI toolkit out of the box. The latter has an MVC framework build in, the former has a general JavaScript library build in. Both come highly recommended.
Also as recommended jQuery UI is a reasonable toolkit. I would personally couple Sencha for its rich UI toolkit and a lightweight MVC framework like Backbone. I'm afraid this does require learning JavaScript well.
You can also instead drive your JavaScript UI toolkit mainly from the server and skip the clientside MVC. For that sencha should surfice as a UI toolkit, but if you want meaningful functionality you will need some more structure. I would also recommend RequireJS for modular file management.
Take a look on Vaadin its based on GWT but simpler to use. I use it since 2 years and i'am not a designer too.
Take a look at jQuery & jQuery UI (jQuery Modile if you are looking to deploy to hand held devices)
Also, since you mentioned that you are not a designer, you might want to implement the front end in an MVVM pattern to separate the UI from the business logic of your applications. Knockout is a nice way to do with with decelerative data binding
I don't like writing plain JavaScript, so I'll tell you little bit about Java based frameworks. Recently, I've picked Google Web Toolkit.
Pros:
plenty of materials
Eclipse + Google plugin
Very intuitive API
3rd party libraries
Fancy widgets + optimized JavaScript
lot of generics
very active community
awesome async callbacks
Cons:
very slow debugging, that will drive you mad sooner or later
lot of deprecated code for so young framework
Mixed feelings:
You don't have to write declarative UI (you can do Swing-like development), but your code grows bigger and less maintainable, so it is quite probable that you'll eventually learn some declarative UI like UI Binder
Visual designer for GWT is somehow nice, but very unstable (eclipse) :(
Some considerations:
Do some prototyping with Vaadin. Try some debugging. Then try GWT and debugging on similar sized project. Consider debugging as the VERY important decision factor, because GWT debugging was the most frustrating thing for me.
Consider JSF + some nice rich component framework for JSF like RichFaces, IceFaces, PrimeFaces etc (but you app won't be "light" and "small" anymore if you really care). Be sure to be perfectly comfortable with environment (IDE + plugins), nothing beats JSF there (I'd pick RichFaces + Seam today, if full Java EE is option).
If you don't want to learn javascript I recommend you GWT with Sencha-GWT (GXT), you can develop all your app in java language, and also debug your code in java.
It is very easy to create a web app with this technology, and provides almost all funcionality available in javascript version.
Also you can mix it with hibernate and giled to persist your data, and giled helps you to serialize hibernate objects.
I have been writing an application in SproutCore for the front-end and a Java backend. In my mind this works perfectly.
The backend can stop worrying about HTML and JavaScript contents on the client side, if the request is XHR or plain request/response. I can implement the backends using plain old Java Servlets, and only worry about the data that is passed between the client and the server (JSON for the most part).
The client becomed fast and responsive, and SproutCore has a rich amount of components that you can mix and match.
So in other words with SproutCore (and Cappuccino and other full-blows MVC JavaScript frameworks) you can let your client do what it does best : Render and display HTML, CSS and JavaScript, while leaving your server to worry about what it does best: retrieve, store and update data. If you are interested, the source code for this project is available with the GPLv3 licence: https://github.com/joachimhs/EurekaJ
I have written an article about the differnt approaches between server-side MVC and client-side MVC here: http://haagen.name/2011/05/24/The_RIA_MVC_Model.html.
Also SproutCore comes with the MIT licence, so its avaiable for use without (m)any restrictions.

Is Google Web Toolkit similar to AWT and Swing

I've looked breifly into GWT and like the idea that I can develop in Java and have the application compile down to HTML and JavaScript. Is the concept behind GWT and AWT and Swing the same or different?
It is programmed very similarly(patterned after Swing) and the code is 100% java (compiles with a standard Java compiler without errors), but the way it works is very different. Instead of compiling into a Java app, it compiles into Javascript that is sent to your browser.
This ability to program good active Javascript without actually coding Javascript and HTML is pretty nice.
Also, since it programs much like swing, you can do stuff like adding listeners that effect other controls pretty easily.
GWT is very much similar to Swing in its usage of Widgets, Panels and the EventListeners it provides. A different way to look at GWT is to think of Javascript and HTML as Assembly language and GWT as a sort of High level language which generates Javascript and HTML. With GWT its easy to develop desktop-like apps for the web using the same tools you would use for building a desktop app
Define concept.
AWT/Swing are used for desktop Java apps or applets. They both require JVM to run.
GWT is used to translate Java code to Javascript. This only runs on Javascript engines, i.e. browser.
The API design, as stated above, is similar to Swing. You get the same Panels, Buttons and other Component classes as in Swing.
AWT and Swing are for programming stand-alone applications (and to a lesser extent, applets). GWT is supposed to make programming web applications similar to stand-alone apps. I wouldn't program a non-web app using GWT.
GWT is conceptually similar to Swing, but is more a replacement for JSPs than anything else.
GWT is a javascript toolkit that allows you to write the javascript in Java. The only real similarities to Swing and AWT are that they are toolkits for creating user interfaces and they use Java. The end product is different and the real purpose for using them is different. GWT gives you the ability to generate a ajax user interface for a web browser while the other 2 give you a console (or applet) java app. In my mind the real reason for using GWT is to get a quick ajax interface up for prototyping purposes. But I dont think its really production ready- ie I dont thing Google uses it in their own webapps. A better choice for more robust ajax webapps is http://developer.yahoo.com/yui/ or http://script.aculo.us/.
disclamer: While I do work at IT Mill, this is just for information to the original poster. This isn't marketing spam.
If you like the idea of being able to write Java and get a webpage out of that, you might be interested in IT Mill Toolkit. It's a toolkit for making RIA software on top of a J2EE stack, and it uses GWT heavily.
One of the basic ideas are that the code generated by GWT is just as prone to client-side forging attacks as any other JS/Ajax-traffic. IT Mill Toolkit makes sure that the data is validated server-side too.
The toolkit is also designed in such a way that if you are familiar to Swing, you should have no problems picking it up.

Best server-side framework for heavy AJAX Java application

There are zillions of Java web application frameworks.
95% were designed before the modern era of AJAX/DHTML-based development, and that means these new methods are grafted on rather than designed in.
Has any framework been built from the ground up with e.g. GWT + Extjs in mind?
If not, which framework has adapted best to the world of forms with dynamic numbers of fields and pages that morph client-side?
Echo2 / Echo3 by Nextapp (www.nextapp.com) is totally awesome.
Advantages over GWT:
1) It is not limited to a sub-set of java like GWT
2) It is easier (in my estimation) to learn
3) Has extremely robust design studio for almost drag and drop designing.
4) It is very fast, and works very well on all platforms browsers
5) You can write your application using either java script or java
6) It has great and straight forward methods for handling events and actions.
Personally I think that for any web-application in which you are trying to integrate java and speedy delivery I wouldn't hesitate to pick Echo3 or Echo2.
If you're starting from scratch. I'd have to say Google Web Toolkit. I have to say it is incredibly powerful. You get keep using most of your Java tools. Plus, you don't have to duplicate code that exists on both the server and the client, it just gets compiled differently for each area.
I'd consider REST-style frameworks as well as the other recommendations here- Restlet or Jersey may be good choices for the backend, while you use something like JQuery or GWT on the front end. Both frameworks can easily produce JSON, and the REST style provides a nice clean line of demarcation between your client application and your server source; I find that JSF can make that demarcation pretty muddy.
I use JSF and IceFaces. Although JSF has a few limitations, IceFaces seems to work pretty well and has ironed out a few of the problems with JSF.
I haven't used a really good AJAX Java framework as yet, although Echo2 looks interesting.
I like the stripes framework. It lets you use whatever javascript toolkit you want.
Here is their documentation on AJAX
GWT is quite powerful and easy to use (all Java, no Javascript/HTML/CSS coding). If Google has their way it will be a dominant framework/tool in web applications development, and for good reason. It already works with Google Gears (which allows offline access to web apps) - and more than likely will be optimized to work within Google Chrome.
DWR
I use this to dynamically populate drop downs, and even filter them on the fly based on user input in other places on the form.
I like the combination of JBoss Seam and Richfaces, especially with the JBoss tools that are extentions to Eclipse - makes building these sort of RIA's incredibly easy.
Wikipedia contains some useful comparisons:
Comparison of JavaScript frameworks
List of AJAX Frameworks
Your choice depends on several different factors including whether you want the "work" done client-side (most javascript frameworks) or server-side (echo2 etc.). Other things worth looking at are tools like OpenLaszlo that provide Flash (I think) out of the box, but drop back to DHTML if there is no Flash player present.
Unfortunately I think the decision comes down to balancing several competing cocerns. Check out the comparisons and try them out - most come with online demo's for you to try.
Aptana has a server side frame work called Jaxer. This is from their site:
Jaxer's core engine is based on the same Mozilla engine that you'll find in the popular Mozilla Firefox browser. This means that the execution environment you use on both the client and the server are the same. It's Ajax all the way through and through. That means you only need one set of languages -- the languages that are native to the browser -- to create entire applications.
This framework is open source and has a very nice IDE based on Eclipse. Aptana is also working on a Javascript implementation for ActiveRecord called ActiveRecordJS. Potentially you could use this both client and server side with their framework.
GWT is one of the best AJAX framework that I used ever. Most important thing about this framework is that its maintained by Google. And Everyone know "Who is Google ?"
GWT is used by many products at Google, including Google AdWords and Google
Wallet. It's open source, completely free, and used by thousands of
enthusiastic developers around the world.
GWT provide rich widgets that can be used to built any application. Almost all the widgets they have.
Another important point is GWT is continuously developing and its also have stable release which is very good thing. Another thing Google has also released GWT-Material which is again a very good thing because everyone is moving toward material.
I hope this will help you!!!

Categories