Share Coding

Tutorials, Problems, Stuffs …

Tag Archives: gwt

The most clear and easy understanding Comet(Server-push) Tutorial

Nucular... It's pronounced Nucular

Yesterday I’ve discovered GWTEventService. Today i started to play around with it, after some research in the example-svn and reading the docs, I was able to write my own “Hello World”.

This Hello World is a small chatting application. You are only able to send messages but not set a nickname or something similar.

Here you can see what it will look like:gwteventservice-helloworld1

In this short overview I’ll just show you the parts that are associated with the GWTEventSerice. The whole regular GWT UI/RPC stuff is left out. If you want to see the complete example, you can download it here.

First of all you need an Event:

This Event gets fired when the server gets a new message from a client.

The next thing you need is a EventListener that gets notified when an Event occures:

The Listener receives the Events from the server an processes…

View original post 67 more words

Advertisements

Recognize Devices on GWT

static final String[] MOBILE_SPECIFIC_SUBSTRING = {
	"iPhone","Android","MIDP","Opera Mobi",
	"Opera Mini","BlackBerry","HP iPAQ","IEMobile",
	"MSIEMobile","Windows Phone","HTC","LG",
	"MOT","Nokia","Symbian","Fennec",
	"Maemo","Tear","Midori","armv",
	"Windows CE","WindowsCE","Smartphone","240x320",
	"176x220","320x320","160x160","webOS",
	"Palm","Sagem","Samsung","SGH",
	" SIE","SonyEricsson","MMP","UCWEB"
};

 

private boolean checkMobile() {
	String userAgent = Window.Navigator.getUserAgent();
	for (String mobile: MOBILE_SPECIFIC_SUBSTRING){
		if (userAgent.contains(mobile)
			|| userAgent.contains(mobile.toUpperCase())
			|| userAgent.contains(mobile.toLowerCase())){
			return true;
		}
	}
	return false;
}