How does Vaadin work? - vaadin

Can anybody explain to me how Vaadin's server side Java components work? They seem to do a sync between server-side state with a client-side javascript engine called a "widgetset".
Does anybody have a more detailed explanation of Vaadin's internals? I have been trying to explain it to my coworkers and am at a loss for words.

Basically Vaadin runs your UI code on the server and uses the browser as a "thin client" (the widgetset) to create and update the DOM. All server-client communication is automated and taken care of by Vaadin. The end result in the browser is just a plain HTML5 application as far as the browser is concerned, no plugins are needed and it will work across different devices.
Going a bit deeper, each component in the framework has both a server side and a browser implementation. Both share a state that is maintained and communicated by the framework. As all communication is taken care of by the framework, it is able to optimize the transport quite a bit by only sending diffs and skip sending defaults etc. Also, since the widgetset contains the JS implementation of the browser component, no HTML templates are generated on the server and sent over, only the actual component state which is much more light weight.
Here is a more in-depth explanation from the docs: https://vaadin.com/docs/-/part/framework/introduction/intro-overview.html

Related

Programming with swift backend and Angular 2 front. Is it possible?

I didn't find anything on Google saying about it.. so, is it possible?
i.e discard the XCode's Storyboard and use Angular 2 to make apps.
PS: Swift isn't discartable for me due frameworks and done backend code. I am using FFT algorythm from Swift's AudioKit Framework.
Angular2 can be used with any compliant web server written in any language. As long as it speaks HTTP correctly it doesn't matter what it's written in.
Angular2 is a front end JavaScript based technology. As long as you have a web viewer that can render HTML and has a standards compliant JavaScript runtime you can make it talk to your back end.
You can wrap it in an app store compatible package but it will still be a JavaScript app and will connect to your backend in the exact same way that it would if you targeted the browser. The difference is it'll be able to leverage certain device specific capabilities. You will communicate with your backend by sending JSON (any format can be used) back and forth.
The key point is that all communication will be in the form of serialized messages only.
Even if your backend were running on the same device, there's no shared memory space.
Of course since a mobile app can persist it's own state locally it might not need a backend at all. This last point is very domain specific.
It could be posibble if you use Vapor as your backend engine. Take a look at Vapor's website for more info.

how to create Vaadin handler for when the push has failed?

I workink with Vaadin now. It is support push-server technology.
I need to create a handler when the push is not successful (connection to server lost). I found how do it for Ajax technology here, but for push I can't find anything.
This is the answer of one expert of Vaadin:
That is a relatively advanced matter.
Vaadin is a server-side framework, merely a big server-side extension
to client-side GWT framework. Therefore the following is not possible
to do in Vaadin, but only in GWT whose minimum knowledge is then
required.
The official Vaadin TouchKit addon (Vaadin GUI for mobile)
already includes such an offline functionality, though it does
not use cookies as storage (source code on GitHub).
Anton Nikonienkov

BreezeJS with a Linux backend

I am working on a project where we have a very slim server (Linux, Nginx, Sqlite), but our web application shall not show any signs of shortcomings (should contain charts, dashboards, nice looking controls) – so I need the client to do all the heavy work.
I assume that BreezeJS would be good in this case, because it manages data on the client, in a way that reduces workload on the server. The server only sends the data to the client and at some point gets data back that has to be saved to the database. All caching and other stuff is managed on the client.
I assume AngularJS would also be good in this case, because it is a client-side MVC-framework, again reducing workload on the server. It also works seamlessly together with BreezeJS.
I assume Wijmo would also be good in this case, because it provides nice looking controls and also works seamlessly together with BreezeJS and AngularJS.
Are my assumptions right? Any comments?
My only concerns are how I get BreezeJS to “talk” with the Linux-server (Nginx, Sqlite). Are there any samples regarding this? Is anyone working on something similar?
We will be releasing a NodeJS/Express/Mongo example within the next few weeks that should show how to communicate with an arbitrary non-.NET backend. (also see the current 'Edmunds' example in the Breeze zip). But we don't have anything yet that explicity shows Breeze working with a Linux backend. Please vote for this here: Breeze User Voice

dart:io and dart:html being mutually exclusive

I've run into a similar situation to this chap where I'd like to have dart:io and dart:html in the same application. I know that dart:io is a server-side library and dart:html is a client side. My situation is as follows. I have a program to outputs a huge amount of text to a log file. I've found Dart to be great at text manipulation. I wanted to take the log file text, manipulate it, put some information in headed textareas for readability etc., and view the page.
I have no intentions to put this on the web. It's just for my work computer. I just want the file loading capabilities of dart:io and the nice display of dart:html. The previous post was in April and development on Dart is speedy. Is there now another way of doing what I want?
I know I could write a program to build a HTML file with the manipulated text in the appropriate fields and then open that HTML file but I don't like that idea as much. Is there another way?
You may consider using this library html5lib on server side apps to generate HTML output. Then it's simply a matter of opening the file up in a browser. This can also be automated by calling starting a Process which launches the browser and points to your generated html file.
html5lib is still a work in progress, but I'm sure they would like to hear your feedback.
I do agree that if all you want to do is to create a static web page, then using a lib like html5lib may be the best. However, if you like to do something more I think the way to go is to think of the server side dart as the model and the client side as the "rest". What the rest is depends mostly on if you like MVC, MVP, ...
I have been close to develop a desktop app in dart but I still haven't found an interesting enough example to get me going. I have been thinking of how I would do it though, and I believe that by connecting the two sides (model and "the rest") with a web socket, a make a simple serialization protocol (e.g. json), you can easily create an rpc with a client side wrapper using noSuchMethod() as the proxy and on the server side you use mirrors. You can create callbacks the other way if you like using the web socket. I believe Gilad mentioned a similar rpc technique between isolates in his talk from the HTML5 Dev Conf.
Anyway, what you would get is both dart:io and dart:html in the same "app", but the app would consist of a server side and a client side. This is what I will try for my next desktop app, whatever that will be :)

Web part loading very slow in sharepoint 2007

I have a sharepoint site in which I have deployed 10 different custom web parts. There I have a particular web part which takes lots of time to load. (This particular web part is kind of a blog aggregator which connects to rss' and show the most recent blog post of each of the blogs specified in a list). All my other web parts are pretty much basic web parts. Since my blog aggregator web part takes a lot of time, it takes a considerable time to load the sharepoint site. So, my problem is that, how to load my sharepoint site with other web parts instantly, while loading the blog aggregator in background? (Just like in out-of-the-box RSS aggregator in sharepoint)
Your help is highly appreciable.
Thank you.
If the errant web part is closed source or vendor supplied, there's not much you can do (other than begging them to release an update).
If you can update the web part, one of the things that has worked for me is to split the web part's logic between javascript and a web service, and invoke the web service asynchronously via javascript. This will make the page appear to load faster because the rest of the page can render while your RSS part is waiting for a response. You will need to use a web service, rather than downloading the RSS content directly via javascript, to get around cross-site scripting protection in most browsers.
A javascript library like jquery makes it fairly simple to asynchronously invoke a web service.
The downside of this approach is that you'll probably need to tear out the guts of your web part and start over.

Resources