Software Development

Android Time Picker Preference

When developing applications for Google Android, there's a great way to implement your preferences using an xml, much like you would for a regular layout. The added benifit of doing it this way is that you don't have to implement how the preference values are saved. However, one of the problems is that there are only a couple of preference types implemented.

GWT Overlay Manager for Google Maps

In a previous post, GWT Implementation of GMaps Utility Library's Marker Manager, I mentioned that I was working on some new features that would allow for more versatility in managing Markers, and possibly any Overlay.  I've successfully created an Overlay Manager implementation that I believe works pretty well.  You can download the source code here.

The OverlayManagerImpl class has the following features:

Hiding/showing embedded flash in Firefox

Recently, I created an AJAX web site that had to hide and show a container that had a flash object element inside of it based on the user's actions.

I first created an html block like this:

<div id="flashContainer"><br />	<object></object></div>

Then I created the following two css classes.  As you can see, by default, my flash object is shown and the flash player runs.

GWT Implementation of GMaps Utility Library's Marker Manager

UPDATE: Many of the features in the Future Implementations section below are in GWT Overlay Manager for Google Maps.

Scrolling to an Element

Note: This is not my code, but a friend of mine's.

When writing AJAX websites, developers sometimes need to scroll to a particular element within the DOM on the page. The most common approach, using javascript, is:

Google Web Toolkit Tooltip Extension

Using the Google Web Kit Google Group post, contrib: tooltip listener, as a guide, I came up with a little more general tooltip panel. You can specify a delay before showing the tooltip and/or a delay to automatically hide it after it opens. I've also included the CSS that I use.

Dynamically Switch Locales in GWT

Like me, a lot of people want their GWT applications to be able to change locale on the fly. While mine still only has one locale, I wanted to make sure that it could expand to more if necessary. Here's how I implemented dynamic local switching.

First, I store my languages in an XML configuration file, along with some other stuff for the application. A language element looks like this:

Get Locale via Javascript

Since a lot of websites need to be available in multiple languages, or localized, developers need a way to figure out what language the user prefers. Most modern browsers have a setting in their preferences or options that the user can change. If the user doesn't, then the browser most likely uses the operating system's locale (language and country) setting.

XSLT for GWT

Here's a little lesson that I learned regarding client side XML and processing it. If your app requires any XML processing over about 50 nodes, use a native DOM implementation.

My app stores some Google Map locations in xml. Each location has the lat/long and an info node that I process in my app with XSLT to create the html for the marker window. Well, one file has 700+ of these location nodes, and when I wrapped AJAX-XSLT using the GWT, it took 2 full minutes to download the file, parse it, and process each location.

Syndicate content