I am upgrading my Vaadin 6 application to Vaadin 7 and things are going pretty well in general. I am running under JBoss AS 7.3.2.
However, I am converting all of my notifications from :
getWindow().showNotification("Under Vaadin 6 this works just fine");
to
Notification.show("Under Vaadin 7 this does not work for me");
and the none of the messages render in the browser. They do not show up in the browser. At all. On Firefox, Chrome and IE. The Vaadin 6 to 7 migration guide addresses this in one sentence:
The API for Notifications has also changed, static methods Notification.show() are
now used instead of Window.showNotification()
so I assumed that changing that one line of code is all I needed to do. Maven dependencies went from this:
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin</artifactId>
<version>6.8.14</version>
</dependency>
to this:
<properties>
<vaadin.version>7.3.6</vaadin.version>
</properties>
. . .
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-server</artifactId>
<version>${vaadin.version}</version>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-client-compiled</artifactId>
<version>${vaadin.version}</version>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-client</artifactId>
<version>${vaadin.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-push</artifactId>
<version>${vaadin.version}</version>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-themes</artifactId>
<version>${vaadin.version}</version>
</dependency>
But the messages do not render in the browser.
UPDATE: I can get the Notification to show up, but only if I manually refresh the browser window (after I make sure #PreserveOnRefresh is set in my UI subclass). This is because the Notification is added to a List of Notifications inside the Page object, and rendered to the browser when paintContent() is called. Unfortunately, the only way I have gotten paintContent() to be called thus far is to manually refresh the browser window.
With Vaadin 6.x I saw the message in the browser. With Vaadin 7.3.6 I see nothing. The message simply fails to render. My application works fine (I also use log4j to log each message that is supposed to be displayed to the user, so I can tell my code paths are still solid). The user messages simply do not show up.
Thinking maybe there is some sort of error under the covers, I installed a DefaultErrorHandler in my UI class and see no output (like many frameworks Vaadin eats exceptions, but the ErrorHandler is supposed to bring them to light).
I tried adding ?debug to the end of my URL to see if additional information showed up that way. Still nothing.
From the lack of posts on this topic, it would appear that I am the only one having this issue. I hope that is not the case, thus I appeal to the forum for help.
If you have migrated from 6 to 7 and have seen issues like this one, your help would be much appreciated. If you have not, please don't bother. I have tried all the obvious stuff.
If you would like to see source code, it is above.
The short answer to this is NEVER EVER (EVER) do this in your UI subclass:
#Override
public void markAsDirty() {
// Empty body (except for this comment)
}
"But, Steve, why not?" you ask. Well, this method lets the Vaadin framework know that there are unrendered changes that occurred during the normal request/response cycle that need to be rendered back to the browser upon return.
Overriding this method with an empty method body short circuits the "dirty" check and the Notification is not rendered back to the browser in the response in which you expect it. It's still sitting there, though, and if your UI subclass is marked #PreserveOnRefresh you will see the notification on the next response (which occurs if you refresh the browser Window, as I discovered).
If you need to override markAsDirty() for some reason, for heaven's sake do this:
#Override
public void markAsDirty() {
super.markAsDirty();// VERY IMPORTANT
}
In the course of research and code changes, I do not exactly recall when I decided to override this method in my UI subclass with an empty method body. But I do know this: overriding markAsDirty() with an empty method body was the source of this problem.
I'm not sure if this was such a mind-numbingly stupid thing to do (probably) that I should keep quiet, or if I should warn others. In the interest of caution, and for completeness (and closure) I decided to humbly confess and post this answer as a cautionary tale.
If you insist on commenting, please be kind, for Karma often has her way, and one day you will be the idiot.
JSP
Related
I'm trying to display the currently playing audio from my app in the watches Now Playing app.
I'm streaming the audio using the AVPlayer and set the AVAudioSession category and activated the session.
I've also tried to use the MPNowPlayingInfoCenter without any luck.
Is there another way to provide this information.
And just as I hit post I figured it out!
You also have to setup the MPRemoteCommandCenter. 🤦♂️
Leaving this here for future reference.
Please show some code for reference, but MvNowPlayingInfoCentre should work fine.
Take a look at this for more information: https://stackoverflow.com/a/41686834/12149235
I am implementing a feature using "connectivity" from essentials that when the app goes "offline" no wifi etc.. it navigates to a specific page.
It works in most cases however if I set the phone on "Airplane Mode" when I am on a modal page it does not navigate to my page.
In Prism is there a way to detect if the current page "IsModal" and either goback or kill it so that I can navigate to my specific Page?
THanks
You'd have to write some crazy lookup logic to figure it out. Unfortunately the helper for that doesn't currently exist. However the latest Prism 7.2 preview has some enhancements that specifically attempt to eliminate the need to figure out whether you require Modal Navigation and automatically use the proper type of Navigation. I would encourage you to try the preview. If you come up with a scenario where GoBack isn't working correctly please open an issue.
I am trying to get the inner active add Api to work with QML. I have found this Nokia example: http://projects.developer.nokia.com/fifteenpuzzle on how to do it. I plan to just use the add widget they use in my own app but when I compile the app it gives this error: "'KErrNone' was not declared in this scope" on anything excpet Symbian and once it runs on Symbian the add area is just black and after a while I get this error: "AdBannerWidget::onNetworkError = "Error downloading http://cdn1.inner-active.mobi/mnt/InnerActive/Resources/USAGC/eng_pic.gif - server replied: Not Found"".
Please help I have no idea what could be causing this, it's probably something stupid but I really need help.
I also get a error while trying to design the qml because of it not being able to "import Analytics 1.0"
I do have a inner active account and I have tried it using my own tag they generated for me but it still doesn't work.
My name is Nirit and I'm a support manager at inneractive.
we just released our new Beta QML open-sourced project, it is now available on your Dashboard (the SDKs tab).
Please download the .zip file and take the time to read through our clear and concise documentation.
If you have any questions or comments, please don't hesitate to contact me.
Nirit (nirit#inner-active.com).
For the black widget and network error, I bet you have to register first with inneractive to get an actual account.
"KErrNone" seems indeed symbian only. Might be that the project is just no meant to compiled on desktop as such. You maybe would have to #ifdef Q_OS_SYMBIAN some parts of it.
I have a Flex 3.5 Air Application; The main window has, besides the header, a TabNavigator. In a Tab, I've put a Google Maps object. It works fine, except that it "loads" very slow and the whole application freezes ( not responding problem ).
Now I would like to fix that but don't really now how to implement one of these solutions:
1) Load the API before the whole application loads.
2) Load the API somehow async, when the tab is clicked. I don't really need a fancy preloader, it's enough that my app doesn't freeze.
Please note that I'm "110%" sure that it's the GoogleMaps's fault since the tab canvas is empty, and no other code is there [double checked that]. Also please note that the map only loads, then I call the setCenter method, so no other operations that could freeze it.
EDIT: I managed to determine that not the Api Object creation is slow, but the actual display of it on the GUI. Here's the line of code. ResellersMapClass only extends the Google Maps API class since I intend to add there extra functionality. But right now is clean.
this.map = new ResellersMapClass();
//between here
this.mapContainer.addChild( this.map );
//and here
Now is there a way to preload this ? Or any other solution that will prevent the GUI from freezing.
Thanks,
Gabriel
I had the same problem with the Yahoo! map API. I ended up just dropping it in a module and gave it a ProgressBar for the load. That should help with the async issues at least. If the problem is a heavy algorithm in the library, there is no way around that until flash rolls out true multi-threading (crosses fingers).
My application has to call server several times per one second (to check if position on board changed or not). I didn't find anything better for now then implement a timer and call server so often to check if something was updated (actually only small amount of data is sent so I think nothing bad will happen). Anyway some browsers like firefox, shows in status line something like "Transferring data...", and the text which flicker there is annoying.
I wonder if there is a way to control the status line from the flex application?
There's nothing you can use out-of-the-box in Flex (or Flash, for that matter) to control the status bar, you need to use JavaScript for that. Communicating Flash and JS is easy, just take a look to ExternalInterface.
Problem is this never ending "Transferring data" message in Firefox, it's annoying as hell, and I still haven't found how to get rid of it. I was once told sending some specific headers would do the trick, but just didn't fully work for me at that time.
I'd love to hear a definitive answer on this one as well.
Juan