Use an existing GWT component in vaadin 21 - gwt

We have a pre-existing (vaadin 7) gwt component which we are looking to bring forward to vaadin 21.
We don't want to use the Multiplatform Runtime as the pricing is excessive.
In the end the gwt component just compiles to javascript so there must be someway of wiring it into vaadin 21?
The component is seriously non-trivial so we want to avoid having to redevelop it.

Maybe you should look into GWT Exporter: https://code.google.com/archive/p/gwt-exporter/

From an architectural point of view, what you need to be able to use a GWT component from something like Vaadin 21 is that the component needs to have its API exported as JavaScript.
If the component has a small API surface, then it might make sense to do that manually using JsInterop (or JSNI if that's what you have experience with).
If the API surface is bigger, then some additional tooling might be more appropriate.

Related

Understanding available Vaadin 7 Widgets/addons 'GWT'

From my understanding Vaadin consumes GWT and adds an engine on the browser end to interact with server side UI. In looking for a 'Confluence' Vaadin add on I came up with nothing. I would like to use Javascript instead of Vaadin pure Java to talk with Confluence 'rest'. However I believe that I found find some GWT Confluence plugins. Since Vaadin uses GWT already do you think a GWT confluence plugin is the way to go? Also there is a angularjs/vaadin addon and then I could us angularjs with Confluence. Your thoughts please...
The traditional Vaadin Framework consists of a java backend on the server and components which are rendered on client side. Most of those are client side rendering are written with Java/GWT.
In addition to this, there exist the Vaadin Elements, which are "pure" JS components for the frontend.
Is Vaadin Elements meant to be used with the Vaadin Framework?
If you wish to write a app with all logic client side (And perhaps calling some REST api), then you will need to write this in JS (perhaps with Angular/Polymer etc.).
In that case you could use the vaadin elements for some of the tasks, but you will remain in the JS world.
To answer your question:
Using a GWT thing and combining it with JS isn't the most up-to-date way to handle things.
GWT makes sense when you wish to write frontend code with Java but certainly not for JS.

Is it a good idea to use Wicket with GWT widgets?

In the past I have worked a lot with GWT and GXT and I'm rather new at Wicket.
We want to have widgets in an existing Wicket application.
These widgets are completely stand-alone "applications". Would GWT be a good solution to do this?
Also we use a lot of Ajax requests (in the current widgets) to update / retrieve data. Since I found that GWT handles those ajax requests very nicely with RPC mechanism I thought it might be a good idea.
I've used GWT and Wicket in a moderately complicated environment. The integration is pretty smooth as long as you use JavaScript for any of your integration points. Make sure you setOutputMarkupId on components that you need to update from the GWT end of things and you’ll be set.
Whether it’s a good idea or not is completely dependent on your team and project. I used it to integrate an older drag & drop tool into our new wicket based application. It worked well as a stopgap until we redesign the GWT app using wicket + jquery.

GWT or Other Presentation Layer Technologies with Spring WebFlow/MVC Framework

First off, I've never used GWT before. I have good experience in HTML/CSS/JS/JSP.
I'm looking for people's opinions on the suitability of Google Web Toolkit for a brand new web app I'm developing.
A big requirement is that the UI is attractive and well designed (Does not look like a clunky Java/Swing App).
It should look like any typical HTML/CSS/JS based modern website.
It is an internal company application so no SEO is required.
JSF is not an option.
The web app frameworks used will be Spring Webflow and Spring MVC. It will use lightweight controllers to communicate with a service layer.
Would Spring Tiles combined with JSP be an easier or more flexible option than GWT for what I am trying to achieve?
Advantages/Disadvantages of GWT and other options welcome.
Thanks
Advantages of GWT
You don't really need to know any JavaScript, since all your client side code will be in Java
This is usually the main reason people go for GWT. They're backend developers who know Java but don't know Javascript, and they don't really want to learn it. Still, you should be careful about this. GWT is a very complete and complex framework with many concepts that are specific to GWT. Even though you'll be coding in Java you will still have to go through many tutorials and documentation before you can build a clean GWT app
Ready to use widgets, like date pickers, dynamic tables, layout panels, popups
It's not really specific to GWT. Other front end framework, like jQuery or Dojo or whatever also give you these. You can have a look at the GWT Showcase to see what GWT has to offer.
GWT takes care of a lot of complex and potentially dangerous stuff for you.
Stuff like Cross-Browser Support, Internationalization, Image and static resources bundling, Front end security, Ajax communication with a server, Events and MVP (just like MVC) framework support. Have a look at the documentation, it is very well done and very thorough.
Debugging is easy
GWT has two different 'modes'. When you're building your app for production, gwt will compile all the java code for the front-end that you wrote into javascript. This javascript will be executed in your clients' browsers. But when you're developping, you can run your app without compiling your java code to javascript. This lets you use a debugger to debug your interface. It's a very good tool.
Disadvantages of GWT
As I said before, GWT is a full framework, with concepts specific to it. Don't think that just because it's in java and you know java that you won't have to learn new stuff.
Interfacing GWT with back end frameworks is not easy
The most common way for your GWT client code to communicate with a server is by using GWT RPC mechanism. It means that you will need to have servlets that implement specific interfaces. You should definetly read the docs on client-server communication to see if that fits well with Spring. A search on SO or Google should give you pointers to setup your application.

GWT Background Study For Project help!

I am currently doing a project on GWT and in the background study, I need to perform research on GWT. I have included many things which I will list below. Can anyone point out something that I may be missing or what other interesting thing concerning GWT I can include? The following is a list of all the topics that are currently included:
GWT Java to JavaScript Compiler
Deferred Binding
JSNI (JavaScript Native Interface)
JRE Emulation Library
GWT-I18N (Internationalization and Configuration tools)
GWT’s XMLParser
Widgets and Panels
Custom Composite Widget
Event and Listeners
Styling through CSS
GWT History Management
GWT Hibernate Integration (through GLead)
MVP (Model-View-Presenter) for GWT through Model View Presenter Application
Controller and Event Bus
Server Calls using RPC and request builder
Comet
Serialization in GWT
JSON (JavaScript Object Notation)
Testing Web Application with GWT
JUnit Benchmarking Selenium
Further work in GWT such as Ext-GWT and smart GWT
Here my additions may be helpful to you
GWT Logging
Editors
Speed Tracer
RequestFactory
GWT animation
Formatter (NumberFormat, DateFormat)
one of the most important things
GWT <-> GAE(Google App Engine)
and last (you forgot)
GWT modules :)
I am not sure if it is implicitly included in one of the points you listed but :
Client Bundle
The resources in a deployed GWT
application can be roughly categorized
into resources to never cache
(.nocache.js), to cache forever
(.cache.html), and everything else
(myapp.css). The ClientBundle
interface moves entries from the
everything-else category into the
cache-forever category.
You may want to take a look into UiBinder and RequestFactory as well as some of the development and testing tools such as GWT Designer and Speed Tracer.
If you are planning to use Spring , on server side, you should consider gwt-spring integration.
although, gwt designers do not provide reflection and recommend not to use the reflection, using reflection is inevitable, and if you use carefully, its cost is bearable..

Differences between GWT and Vaadin

Can anyone suggest whether "GWT" or "Vaadin" are a better choice to design an application? Also: what are the differences in coding style?
In GWT application logic is normally run on client side. It only calls server when it needs to read/save some data.
In Vaadin application logic is on server side. Client side must normally call server after every user interaction.
GWT advantage:
App logic (replies to user interaction) is faster as it is run locally in the browser. It's also relatively insensitive to bad network conditions. Network is used only when needed (to read/save new data), which saves net traffic (important for high traffic sites).
In this regard Vaadin is slower and introduces a lag in UI interaction which is annoying to user. If network is bad this will show in UI responsiveness.
Vaadin advantage:
App logic is run on the server so it can not be inspected by the user. Arguably (Vaadin claims) that makes it more secure.
A few more points:
A fundamental difference is that in GWT you have to separate your application into Client and Server code, no such distinction in Vaadin. This will affect the architecture of your application.
In GWT client code, you must code in Java, and have a limited subset of language features available (that the GWT compiler can translate into Javascript). In Vaadin, you can code in any JVM language, since everything runs in the server (I'm using Vaadin with Scala). This may or may not be relevant to you.
GWT compilation is VERY slow, although in development mode you have the emulator. This makes production environment updates painful (a GWT application I developed has grown pretty big, and currently takes around 15 minutes to compile).
It's very simple to extend GWT with 3rd party widgets, or roll your own. Creating new Vaadin widgets is more complex.
Another Vaadin advantage: you don't have to design or implement the client-server communication, that's built-in.
With Vaadin you can also use built-in GWT when you want to do something on the client-side. This gives you both simplicity of server-side programming model (no communications, no browser programming needed) with being full control of what happens in the browser.
Differences between Vaadin and GWT:
A) Vaadin includes a server-side development model that:
Cuts number of code lines to half by reducing layers one has to
implement for user interface.
Allows you to use any JVM based language for user interface - Scala,
Groovy
Increases security by keeping user interface logic in the server
Allows synchronous calls to any backend API from the web server
Allows use of any standard Java libraries and tools for UI layer- in
server side architecture applications
Does not need Java to JavaScript compilation step that often takes
time or makes tooling complicated in GWT projects - instead you have
the Vaadin client engine
Provides server push out of the box with no extra code needed
B) Vaadin provides a large set of high level user interface components. For GWT one would need to use commercial Sencha GXT for comparable component set.
C) Vaadin includes SASS based Valo theme engine that makes it easy to build good looking custom themes from your application. Valo is the latest theming for Vaadin.
D) Data binding: Vaadin has incorporated the ability to associate any widget directly to a data source such as database, file or anything else in the server-side. This enables to define default behavior of the widgets to act on data sources.
Vaadin vs GWT
tl;dr
whether "GWT" or "Vaadin" are a better choice to design an application
It is not an “either-or” question.
With Vaadin, you get GWT (or its counterpart, Web Components) plus much more.
Vaadin is a framework for building desktop-style web apps by writing pure Java code on the server-side including declaring a user-interface. That user-interface is rendered in a web browser by Vaadin automatically generating on-the-fly the necessary browser code: HTML, CSS, JavaScript, etc. Business logic executes only on the server-side. User events (buttons clicked, data typed into fields, etc.) on the web client trigger Java code to run on the server side.
How that browser code is generated and executed, and how the client and server communicate, depends on 3rd party technology:
In Vaadin 8 and earlier, GWT
In Vaadin 10 and later, Web Components
Vaadin 8 and earlier uses GWT
Vaadin 8 and earlier was built on top of Google Web Toolkit (GWT). GWT has been spun-out of Google, as a fully open-sourced project: http://www.GWTProject.org/
GWT cross-compiles Java code into standalone JavaScript files. GWT provides other important features such as support of UI components and client-server communications.
The Vaadin Ltd company is a major supporter of GWT, including having hosted GWT developer conferences, and providing consulting expertise services.
Vaadin is only one of many products built on GWT.
Vaadin 10 and later uses Web Components
Vaadin 10 and later, known as Vaadin Flow, is a major rewrite of the framework. Instead of using GWT underneath, Vaadin Flow is built on top of Web Components technology.
Web Components is actually a suite of technologies including Custom Elements, Shadow DOM, and HTML Templates. These technologies are now built into most every modern web browser, and supported on many older browsers via polyfills.
Writing a new widget component for Vaadin is much easier with Web Components than with GWT. And most any existing Web Components based component can be wrapped to provide access via Java from the Vaadin server-side framework.
I don't have a source at hand to cite, but as I recall, Web Components based widgets may run faster and use less memory than their GWT-based equivalents.
By the way, both generations of Vaadin depend on some other technology, such as the Atmosphere library for help with WebSocket and HTTP.
I haven't tried Vaadin. I'm a GWT fan, but I CAN say that I've been a bit disappointed by the default widget set provided with GWT. You really need something like SmartGWT to fill the framework out.
I belive Vaadin is a much more advanced framework than GWT
BUT
When it comes to optimise performance on the client side there is nothing much you can do unless you build your own components (and that's where the beauty of Vaadin stops)
In a project i'm working right now 90% of the staff I've done worked as a charm
And then I had to use an event timeline next to a couple of tables. When I loaded more than 400events on the timeline my web page was almost unusable not to mention terrible slow on initialisation. I've been trying to optimise the code the last two months. At the end I used a GWT component.
As any application has to show display information coming from the server, a major requirement for simple coding is automated data binding to your forms and tables.
With Vaadin, this is as simple as a few lines of code.
In GWT, first you have no table mapping.
As for forms, you can map an object to a form, but to do so you have to implement a so called GWT Editor for your object (and one for every object inside of it). An Editor is nothing else than the definition of the form to use to show/modify the object. So all in all, there is no automation here.
GWT enables you to write web-clients with Java. The GWT cross-compiler creates JavaScript code for the client-side. You have to care for the server for your own as well as client-server communication. The generated client-code is already optimized for many browsers. My personal opinion is, GWT was very popular until Google focused on Angular. Today it is not much popular anymore.
Vaadin provides two different solutions:
1) a UI widget-set based implementing the web-component standard, and
2) the Vaadin serverside Java framework. It allows you to write web-clients with Java. However, Vaadin generates the web-client through runtime on the server dynamically. Vaadin cares for the entire client-server communication. For rendering the UI, Vaadin until version 8 used a pre-compiled UI widget-set. Vaadin from version 10 uses the Vaadin web-components.
Further benefits of Vaadin:
You do not get in contact with HTML and JavaScript and you need not bother for DOM manipulation, browser history and other low-level problems
The serverside architecture provides better security
Modern themes
Individual styling with CSS
RapidClipse provides a powerful UI builder for Vaadin based on Eclipse containing a Vaadin <> JPA databinding, internationalization, UI persistence, extended Hibernate tools, JPA-SQL query language and MicroStream integration for creating Java in-memory database apps and microservices