|
The Problem When a GWT application loads, nothing is actually displayed by your application until all the generated JavaScript has been downloaded by the browser. I was looking for way to display a loading screen while my GWT application was loading, and then remove it once the GWT application is loaded. The SolutionSince every GWT application has to be embedded in an HTML Host Page, an easy way to display a loading message is to place the loading message in a <div> in the HTML Host Page. Once all the GWT application JavaScript is done loading, we can have the GWT application remove the loading message by doing some DOM manipulation on the HTML Host Page. Here is a sample HTML Host Page. The loading message, along with a loading animation image is contained in a <div> named “Loading-Message”. 1: <html> 2:
3: <head> 4: <title>GWT Application</title> 5: <link rel="stylesheet" href="style.css"> 6: </head> 7:
8: <body> 9:
10: <script type="text/javascript" language="javascript" src="gwtapp.nocache.js"></script> 11:
12: <h2>GWT Application</h2> 13:
14: <!-- The loading message div --> 15: <div id="Loading-Message"> 16: <img src="loading-animation.gif" alt="loading"> Loading GWT Application, please wait... 17: </div> 18:
19: <!-- The Application's UI elements will be placed in this div by the Application module's --> 20: <!-- entry point class when it is loaded --> 21: <div id="GWT-Application-Panel"> 22: </div> 23:
24: </body> 25:
26: </html> The “Loading-Message” <div> can be removed from the HTML Host Page using the following line of Java Code: DOM.setInnerHTML(RootPanel.get("Loading-Message").getElement(), ""); Where would you put this line of code? You can put it anywhere in your GWT application. However, a good place to put it would be in your GWT application EntryPoint class’s onModuleLoad method. You can place it either before or after your application loads the UI elements. Here is an example onModuleLoad method: 1: public void onModuleLoad() { 2: // Remove the loading message 3: DOM.setInnerHTML(RootPanel.get(“Loading-Message”).getElement(), “”);
4:
5: // Get the Application Container div from the DOM 6: mainPanel = RootPanel.get(“GWT-Application_Panel”);
7:
8: // Add GWT UI components 9: addWidgetsTo(mainPanel);
10: }
If you aren’t the artistic type, here is a website you can use to download a customized animation image. Here is another website, where you can select some existing animations to use in your app. If you haven’t already, please check out our continuing series of GWT Tutorials beginning with Introduction to GWT. You can find the rest of our GWT tutorials here. |
| Navigation: Go to top of page | Go to The Blog Index | Related Categories: Coding Quickie, GWT, Java, User Experience | Related Tags: Coding Quickie, GWT, loading message Comments: Read comments | Write a comment |
| « Java SceneGraph API released | New Tutorial – Geocoding – Getting address information from an IP address » |
- Coding Quickie
- GWT
- Java
- User Experience
I outline various strategies that can be used to create service-enabled Blackberry applications. These strategies include using Google Protocol Buffers, and the Mobile AJAX toolkit among others.
Google's Protocol Buffer technology - Protocol Buffers are similar to XML schemas, that you can compile from a language neutral schema definition into code (in different languages like Java, C++, and Python). However, there's no XML involved here, it's a lightweight binary encoding/decoding mechanism. You create your schema definitions in a .proto file and you compile that into Java code that you include with your applications (services, and mobile apps).
More information on the Nimbus Look and Feel. How to customize it, etc.
Coding Quickie - Android "SwingWorker" functionality
I've been working with Android recently and people have asked for a background Task API that works with Android, and other non Java SE environments. I plan on releasing the Task API for Android soon, however, it's not ready yet. So I'm writing this coding quickie to help those of you who need to spawn a background thread in Android, and have this thread rejoin the UI thread when it's done. The code below is just the rough skeleton of what is required to do such a thing. I'm going to release 3 new Android tutorials on developerlife this week, so stay tuned.
Coding Quickie - Get URL param string from GWT
Coding Quickie - Wordpress mod - adding links & excerpts to related posts
I added some PHP code to make it easier for people to find related documents, when they are viewing any post on developerlife.com/tutorials. The PHP code can be downloaded from this post.
Lots of great new features in GWT 1.5.
SproutCore - Apple MobileMe JS library
SproutCore is Apple's open source JS library. Pundits claim that it will kill Flash and it can be used to write desktop apps for web browsers. Using a JS library that uses CSS styling that makes it resemble OSX's look and feel doesn't make it a desktop app :) .
Interesting videos on GWT from Google IO 2008. New DOM access API in GWT 1.5. Using Google APIs (search, maps) in GWT 1.5. And doing crazy stuff in GWT 1.5.
Ext has pulled some shenanigans to trick it's users... they adopted a bait 'n switch business policy to screw the OSS community and lots of their users... went from LGPL to GPL silently in the night. Classy and smart move on their part (sarcasm).
New Tutorial - Using GWT History to create an RSS client
This tutorial takes the background information on GWT History Management provided in the Managing History and Hyperlinks tutorial and uses it to create an RSS reader application that uses this history mechanism to load initialization parameters. The application that's built in this tutorial takes the RSS feed URL as a parameter passed to the web app's URL. You will also learn how to use ROME API, and explore different approaches to displaying application loading (splash) screens.
GWT Ext 2.0 was just released.
A conversation with Joshua Bloch on GWT
Great interview with Joshua Bloch about GWT.
New Tutorial - Using Browser History and Hyperlinks
When you are building GWT apps, that run in the context of a web browser, what should happen when the user of your app presses the Back or Forward button in their browser? GWT provides a way for your apps to hook into the browser's history mechanism, so that you can control what happens when a user hits Back or Forward in their browser. You can also programmatically manipulate the browser's history, and even create hyperlinks in your apps that can hook into the browser's history mechanism. You can even intercept these hyperlinks when a user clicks on them, instead of having the browser handle it, or both. This tutorial will show you how to leverage GWT's history mechanism and do some creative things with histories and hyperlinks that will be useful in your applications.
Coding Quickie - Get URL param string from GWT
New Tutorial - Deploying GWT Apps
There are two aspects to deploying a GWT application: client side deployment, and server side packaging and deployment. In this tutorial, I will cover the different sets of issues that are tied to each aspect of deployment and packaging. Issues around cross site scripting, integration into existing webpages/apps, deployment as widgets, and much more are discussed in detail.
New Tutorial - Using Servlet Sessions in GWT
Because GWT web applications run inside of a browser, they are limited to making requests over HTTP. HTTP is a “stateless” protocol and it doesn’t provide any facilities for tracking previous transactions. In this tutorial you will learn how to use GWT’s RPC mechanism, specifically the RemoteServiceServlet, to enable session support in your GWT application.
New Tutorial - Using and creating GWT modules
If you are trying to build a complex GWT application that needs to be split into multiple modules, or if you need to import 3rd party modules into your application, this tutorial will show you how to do both of these things. We will import the GWT Log module, and we will also create a new module that you can include as a dependency for other modules/projects.
New Tutorial - Create GWT projects using IDEA
In this tutorial, I will walk you through the tasks you need to perform in IDEA 7 to create GWT projects. We will do the following: create a new project, add resources to it (images, stylesheets), create a web facet for deployment to an app server/servlet engine, add a loading screen for your app.
Dion Almaer talks about GWT, Google Gears, Java and JavaScript
Dion Almaer talks about GWT, Google Gears, Java and JavaScript
GWT version 1.4.61 has been released.
New Tutorial - Transport Objects over RPC - GWT Object Serialization
This tutorial will teach you how to create and use Serializable objects that can be transported over GWT's RPC mechanism.
New Tutorial - Building a GWT RPC Service
One of the most important pieces of the GWT framework is the GWT Remote Procedure Call (RPC) mechanism. This RPC mechanism makes it easy for a GWT application client to make a call to server-side code. GWT RPC makes it simple to get data between the client and the server. The server-side code that gets called from the client is referred to as a service. This tutorial will teach you how to build a GWT RPC Service.
New Tutorial - Anatomy of a GWT Project
The first step in writing any GWT application is setting up a GWT Project. This tutorial will introduce you to the ins and outs of GWT projects.
New Tutorial - Introduction to GWT
The first in developerlife.com's series of GWT tutorials has been posted. This first tutorial is a technical overview of GWT.
Update - GWT Tutorials coming soon
Web 2.0 is upon us and building an AJAX web application is a vital and marketable skill. Most AJAX web application development is done using HTML and JavaScript. But what are Java developers that aren't proficient in JavaScript supposed to do. Fear not, the Google Web Toolkit (GWT) is here to the rescue. You don't have to step too far outside your comfort zone and learn JavaScript, or delve too deeply into the potential hell that is Browser development. GWT provides a Java API that lets you build component based GUIs while avoiding JavaScript, and abstracting the HTTP protocol and HTML DOM model.
New Tutorial - Twitter API Integration
I’ve been building web, mobile, desktop apps that are powered by the ScreamingToaster ONE Platform for the last 3 years. I’ve had to integrate with a lot of services, like weather, credit card payment processing gateways, GeoIP lookups, CellID lookups, etc. One of the easiest integrations I’ve had to perform is with Twitter :) . Twitter has a simple to use API that can be accessed using Java or just about any other language. There are some really good Java wrappers for this API, and I’m going to highlight a really good one in this tutorial. I’m also going to show you how to integrate with Twitpic using Java.
RIM just released a new JDE version, you can download it here. Here’s a review of an early release of OS 5.0 on an actual Bold. 5.0 is going to be an awesome OS! In writing software for OS 4.6 for some time now, I’ve run into lots of limitations in media capture that are being addressed by 5.0! Video capture is coming in 5.0!
Sun has just been purchased by Oracle, as you must have read already. After the IBM buyout offer fell through, Oracle snapped Sun up. I’m selfish. I have a software company that uses lots and lots of Java technologies, and I’m wondering what this means to me in the long term :) . I’m sure there are lots of changes that Sun employees are going to have to go through, but I’m not worried about that, just being honest.
BlackBerry Mobile Blogging App for Drivelikeagirl.com
Download v1 of the BlackBerry App for Drivelikeagirl.com community. Must have BB OS 4.6 device or higher.
BlackBerry Application Storefront
RIM is launching it's app store in March 09. They are currently accepting submissions online. I'm planning on submitting all my apps for sale on the storefront, will you be doing the same?
Objective C introduction for Java developers, and creating iPhone apps with Java
This is a great video that shows Dr. Arno Puder giving a one hour presentation at Google. The highlights are a great introduction to the Objective C language for Java developers. The syntax is very strange, and very Smalltalk-like. Very interesting language... no runtime garbage collection, it uses reference counting.
JWebPane (WebKit for Java) details
JWebPane details from the new tech lead of the component... Looks very promising.
JavaFX 1.0 released - where is JWebPane?
JavaFX 1.0 was released last week, and it's great that it's out for Windows, but there are lots of things missing from it (like support for OSX or Linux). The biggest missing item for me is the Webkit browser component called JWebPane. I have been looking forward to using this component for months now, and it's still not out.
After months and months of beta testing, Update 10 is finally GA'd! Wohooo!
Google's Protocol Buffer technology - Protocol Buffers are similar to XML schemas, that you can compile from a language neutral schema definition into code (in different languages like Java, C++, and Python). However, there's no XML involved here, it's a lightweight binary encoding/decoding mechanism. You create your schema definitions in a .proto file and you compile that into Java code that you include with your applications (services, and mobile apps).
More information on the Nimbus Look and Feel. How to customize it, etc.
JavaFX Preview SDK just got released!
Lightweight UI Toolkit for JavaME
Rich UI toolkit for JavaME inspired by Swing. It's open source and on java.net.
Java 6 for OSX Leopard was released. No support for 32 bit Intel CPUs or PowerPC CPUs, only 64 bit Intel CPUs supported.
More on Java WebKit and Filthy Rich Client presentations
More information on WebKit for Java (JWebPane) for JavaFX. Great presentation from Chet Haase & Romain Guy at this years JavaOne 2008, Filthy Rich Client session with a timingframework fix.
JavaFX goodies - WebKit for Java and much much more!!!
Some interesting APIs are coming with JavaFX. This post talks about Scene Graph API and JWebPane component.
JDK6 Update10 Beta D3D problems - 15x slowdown fixed
15x slowdown on certain Java2D operations using the d3d hardware accelerated pipeline on JDK6 Update 10 BETA Build 22.
Native font rasterization limitations in Java 6 Update 10
2 issues with native font rasterization on Java 6 Update 10.
Native font rasterization in Java! :)
Native font rasterization in Java! Finally!
iPhone SDK and it's problems. Java on iPhone? ActiveSync vs. RIM's NOC-based-approach of pushing email.
Java 6 Update N, Beta Build b13 available for download
Exciting details on Java 6 Update N - new Java Plug-In for applet/Webstart app deployment, JS Deployment Toolkit for applets, Java Kernel, etc.
New Tutorial - Using GWT History to create an RSS client
This tutorial takes the background information on GWT History Management provided in the Managing History and Hyperlinks tutorial and uses it to create an RSS reader application that uses this history mechanism to load initialization parameters. The application that's built in this tutorial takes the RSS feed URL as a parameter passed to the web app's URL. You will also learn how to use ROME API, and explore different approaches to displaying application loading (splash) screens.
Java SceneGraph Effects Framework
Java SceneGraph Effects Framework API demos.
SwingX 0.9.2 release coming soon
SwingX 0.9.2. coming soon...
Android SDK to get "significant updates" - Android Developer Challenge deadline extended
Google has apparently been paying attention to the widespread developer frustration with their Android SDK and has announced that they will be releasing a major update to the Android SDK "in the next several weeks". Google has also decided to extend the deadline for their Android Developer Challenge.
Detailed overview of the Sun SPOT - Small Programmable Object Technology.
New Tutorial - SwingX JXBusyLabel
This tutorial will show you how to use SwingX's JXBusyLabel component to display an indeterminate progress indicator. It will also show you advanced configuration options that allow you to create different and interesting indeterminate progress indicators using the BusyPainter.
Text component add-ons for Java Swing/SwingX
XSwingX, created by Peter Weishapl, is a set of components that add much needed functionality to textboxes, and textareas. You can add prompts inside of text components themselves, and add "buddy components" to these text components as well.
New Tutorial - SwingX JXTaskPane and JXTaskPaneContainer
This tutorial will walk you through the steps required to use JXTaskPane and JXTaskPaneContainer in SwingX. You will learn how to change the default color schemes of these components, and add components and actions to task panes.
Java 6 Update N - hello "java kernel"
Say hello to Java Kernel. Part of great things to come with Java 6 Update N, Java 7, and JavaFX...
New Tutorial - Using Browser History and Hyperlinks
When you are building GWT apps, that run in the context of a web browser, what should happen when the user of your app presses the Back or Forward button in their browser? GWT provides a way for your apps to hook into the browser's history mechanism, so that you can control what happens when a user hits Back or Forward in their browser. You can also programmatically manipulate the browser's history, and even create hyperlinks in your apps that can hook into the browser's history mechanism. You can even intercept these hyperlinks when a user clicks on them, instead of having the browser handle it, or both. This tutorial will show you how to leverage GWT's history mechanism and do some creative things with histories and hyperlinks that will be useful in your applications.
Coding Quickie - Get URL param string from GWT
New Tutorial - Deploying GWT Apps
There are two aspects to deploying a GWT application: client side deployment, and server side packaging and deployment. In this tutorial, I will cover the different sets of issues that are tied to each aspect of deployment and packaging. Issues around cross site scripting, integration into existing webpages/apps, deployment as widgets, and much more are discussed in detail.
New Tutorial - Using Servlet Sessions in GWT
Because GWT web applications run inside of a browser, they are limited to making requests over HTTP. HTTP is a “stateless” protocol and it doesn’t provide any facilities for tracking previous transactions. In this tutorial you will learn how to use GWT’s RPC mechanism, specifically the RemoteServiceServlet, to enable session support in your GWT application.
New Tutorial - Using and creating GWT modules
If you are trying to build a complex GWT application that needs to be split into multiple modules, or if you need to import 3rd party modules into your application, this tutorial will show you how to do both of these things. We will import the GWT Log module, and we will also create a new module that you can include as a dependency for other modules/projects.
Web browser and Flash player for Java Swing!
Integrate native browser components and Flash player into your Java Swing apps with DJ!
New Tutorial - Create GWT projects using IDEA
In this tutorial, I will walk you through the tasks you need to perform in IDEA 7 to create GWT projects. We will do the following: create a new project, add resources to it (images, stylesheets), create a web facet for deployment to an app server/servlet engine, add a loading screen for your app.
Kind words for Eclipse Europa, from a die hard IntelliJ IDEA power user.
These are some of my initial thoughts on Google's Android, after having spent a few days working with the SDK.
Neal Gafter offers a rebuttal to Closure Controversy Presentation by Joshua Bloch
Neal Gafter offers a rebuttal to Joshua Bloch's Closure Controversy Presentation
Great presentation by Joshua Bloch - The Closures Controversy
Great presentation by Joshua Bloch on the current debate over Closures in Java
Does Java really need expanded Closure support. A humorous take on the issue.
Dion Almaer talks about GWT, Google Gears, Java and JavaScript
Dion Almaer talks about GWT, Google Gears, Java and JavaScript
Lots of wonderful things are happening for Java desktop apps. Enter the new SceneGraph API for Java. What is a SceneGraph? Java2D is an immediate mode API, which means that your code is executed when the screen must be refreshed/painted, and your code draws to the screen immediately. SceneGraph in contrast is a retained mode API, which means that you declare what you want to happen and when. But the API figures out the caching, dealing with repaints, clipping, and lots of other low level details that you normally have to deal with - which makes it easier to use!
SoyLatte - Java 6 on OSX Release 1.0
There is an open source effort to create a Java 6 VM for Leopard. You can get more details on SoyLatte here - http://landonf.bikemonkey.org/code/macosx/.
IntelliJ IDEA 7.0.2 just released
IDEA v7.0.2 maintenance update just released
Java is an awesome language. I'd forgotten how wonderful it is, until I started coding in other languages and environments. Java does not face the innovators dilemma, it's stronger than it's ever been before!
We use the Zen Application Framework exclusively to build our mobile applications, and so can you. Zen is free for all ScreamingToaster Consulting clients, and its source code comes as part of the deliverables at the end of every consulting project. Zen training courses are available upon request to consulting clients only. ScreamingToaster has a commitment to open source software (OSS) and democratizing knowledge for the good of the developer community, and humanity as a whole, which is why we give Zen away for free to our consulting clients. Our clients can make changes or additions to the applications we build them, and they can also use Zen to build applications in-house after taking our BlackBerry developer training courses.
RainOrShine is a free location-based weather application for BlackBerry. It provides real-time, current weather conditions for your current location. Using ScreamingToaster technology, RainOrShine also delivers location-based real-time updates for any Wikipedia information available for your current location, and movie show times for theaters near your current location. RainOrShine is a showcase of location-based services (LBS) possible on the BlackBerry platform, brought to you by ScreamingToaster.
Great TED talks on design, learning, belief, oceans, life, and biomimicry.
What is an enterprise BlackBerry app?
In this article, I am going to define what a BB app is. I will define the building blocks of every service-enabled BB app: the UI, enterprise information integration, and service orchestration. And I will tell you why there is no 80% complete, template-based, simple, BlackBerry app.
New How-To – Set Security & Application Permissions For BlackBerry Apps
If you are a BlackBerry developer, you are familiar with BlackBerry code signing keys. If you are consumer you may not know that in order for a company to make BlackBerry apps, it must apply for “code signing keys ” from RIM. RIM requires certification that companies are legitimate, legal, and properly registered before they will give out code signing keys to them, and developers must put these keys into the apps they make in order for them to work. That is just one level of security that RIM employs to ensure good quality, and safe apps for the consumer. When you install an app on your BlackBerry, you are probably familiar with permissions, and the permissions pop-ups you get when you run an app for the first time. If you have BES you have been asked to “grant an app trusted application status”. I am going to go into more details about permissions and the multiple levels of security from device-level to server-level security that every consumer should be aware of.
New How-to - Setup Exchange & BES on your BlackBerry
I highly recommend that any serious BlackBerry user and anyone with a busy life gets Exchange for their BlackBerry. If you truly want to experience the seamless integration that a BlackBerry can offer you, you must have BES and must have a hosted Exchange provider. Many people don’t have this because it is complicated to set up, and they don’t know where to start. This is why I didn’t have it for a long time. I spent many hours researching how to get it setup, and I have condensed all that into an easy how-to guide so that all of you can enjoy the awesomeness that is Exchange on BlackBerry (minus any frustration). It isn’t cheap, I will be honest, but neither is the BlackBerry Bold or it’s data plan, but it is one of the single best investments you can make in your digital lifestyle.
New How-To - Install, Evaluate, and Delete BlackBerry Apps
This article is about installing, evaluating, and deleting BlackBerry Apps. It is about a process for evaluating apps and deciding if they are good, well written apps, or bad apps that will brick your BlackBerry and make you have to wipe it. If you have ever installed a “bad” app, you know how it can wreak havoc on your BlackBerry and make it completely unstable. I will go over how to remove bad apps and wipe all traces of them from your BlackBerry, but most importantly, I will go over how to prevent this from happening in the first place. There are many more bad apps than good ones, and there are very few talented BlackBerry developers that write good quality software. BlackBerry development is complex, and lots of things have to be taken into account when writing apps - things like: CPU consumption, bandwidth usage, power consumption, caching, multithreading, compression, UI responsiveness, intuitive & easy-to-use UIs, tight integration with BlackBerry platform, etc.These are all things that the development team at ScreamingToaster take into account when developing apps such as Wicked Blogging App, which is a blogging app with social features, and MyListy, which is a list application.
Browser bookmarks and their limitations
My thoughts on how difficult it is to manage browser bookmarks, and sync them across multiple machines and muliple types of browsers. And maybe what can be done to make this better?
Make IE7 more usable with IE7Pro
Make IE7 more usable with IE7Pro
Pointui - make Windows Mobile a little more like the iPhone
Makes Windows Mobile more usable and less fugly with Pointui
Microsoft Sync Vehicle Telematics
Microsoft's in vehicle telematics system - Sync. Ford is offering it in all their vehicles.
Coding Quickie - Wordpress mod - adding links & excerpts to related posts
I added some PHP code to make it easier for people to find related documents, when they are viewing any post on developerlife.com/tutorials. The PHP code can be downloaded from this post.

December 29th, 2007 at 9:55 am
I know this is easy to visualize in your mind, but maybe an example might be nice?
December 29th, 2007 at 7:30 pm
Click on this link to see an example. When you click on the link, your browser will complain that the SSL certificate is not trusted (since it’s self signed)… just click Ok and continue to load the page.
We have examples of GWT apps in action in our GWT tutorials.
December 30th, 2007 at 6:13 am
Very nice! Thanks.
(btw. you included the ending dot so the link isn’t usable “as-is”. This works: https://screamingtoaster.com/StringReverser/StringReverser.html )
December 30th, 2007 at 1:22 pm
Glad you liked the example Søren. You are most welcome.
Thanks for the fix to the URL
.
Seasons Greetings and Happy New Year
March 22nd, 2008 at 2:08 pm
Nice tutorial!
One little typo: The upper code example uses “Loading-Message”, the lower one uses “Loading-Panel”.
March 24th, 2008 at 11:30 am
Hi Jens,
Thanks for the good catch
The typo has been fixed.