Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Using legacy code from Swing Application
If I have a large application with a lot of business logic in a jar file which was originally written to be used on a workstation and as such is not especially thread safe can it be used by vaadin or do I need to re-invent it. I know that servlets have to have thread safe code so I was wondering how legacy code would work in a vaadin enviroment.
migrating from Swing to Vaadin is well possible (personally been part of a huuuuge transition with
a 1200+ number of screens) and we provide this as a professional service even.
We help with having a look at the code and kicking off the project, documenting what needs to be done
or even carry out the whole migration project (https://vaadin.com/tools-and-services).
Sorry I cannot say anything less generic not being able to see your code. Of course thread issues need
to be analysed and mitigated.
For transitions that take a lot of time but need to be further developed in the meanwhile, you can start
adding new parts implemented in Vaadin and shown on your Swing boxes in JxBrowser frames until
you're finished, wenn you move to full Web.
Also, there's a way to run legacy Swing applications in a browser frame (google for it!),
but this is probably not what you want to have or maintain -- call it a quick fix.
HTH, Best Regards,
Oh, and have a look at the MVP pattern: https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93presenter
(also part of our Best Practices training https://vaadin.com/training).
You can start refactoring your application to have view implementations in Swing, then move those
to Vaadin one after another. As an architectural idea.
I'll do a bold statement here as nobody can blame me in the way you could blame an Vaadin-employee (hey, I'm just some guy from the internet, don't trust me!):
If your code works fine in a Swing-app it will (except for the GUI-code of course) work in a Vaadin-app as well. You are correct that Servlets need to be thread-safe, but Vaadin takes care of this. Your UI won't be used by different threads at the same time as Vaadin instantiates a fresh one for every user and holds it in the Session. So as long as you do not create threads on your own, you do not need to think too much about thread-safety. Code that has been designed for a single-threaded Swing-app should just work in this case.
But this is just an educated guess - to be sure, one must of course check your code.