litesoft
Diff Revisions
947
vs
948
for /trunk/GWT_Sandbox/FormEngine/src/com/temp/client/foundation/support/useragent/UserAgent.java
|
@@ -1,7 +1,6 @@ |
1 |
1 |
|
package com.temp.client.foundation.support.useragent; |
2 |
2 |
|
|
3 |
|
- |
|
4 |
|
- |
import com.google.gwt.core.client.GWT; |
|
3 |
+ |
import com.google.gwt.core.client.*; |
5 |
4 |
|
|
6 |
5 |
|
/** |
7 |
6 |
|
* This class provides extended support over the built in GWT User Agent code |
|
@@ -27,8 +26,8 @@ |
27 |
26 |
|
private static UserAgent sInstance = null; |
28 |
27 |
|
|
29 |
28 |
|
public static UserAgent getInstance() { |
30 |
|
- |
if (sInstance == null) { |
31 |
|
- |
sInstance = (UserAgent) GWT.create(UserAgent.class); |
|
29 |
+ |
if ( sInstance == null ) { |
|
30 |
+ |
sInstance = (UserAgent) GWT.create( UserAgent.class ); |
32 |
31 |
|
} |
33 |
32 |
|
return sInstance; |
34 |
33 |
|
} |
|
@@ -38,16 +37,16 @@ |
38 |
37 |
|
protected String mSpecific; |
39 |
38 |
|
|
40 |
39 |
|
protected UserAgent() { |
41 |
|
- |
this(BrowserFamily.Other, ""); |
|
40 |
+ |
this( BrowserFamily.Other, "" ); |
42 |
41 |
|
} |
43 |
42 |
|
|
44 |
|
- |
protected UserAgent(BrowserFamily pFamily, String pSpecific) { |
|
43 |
+ |
protected UserAgent( BrowserFamily pFamily, String pSpecific ) { |
45 |
44 |
|
mFamily = pFamily; |
46 |
45 |
|
mSpecific = pSpecific; |
47 |
46 |
|
String zUserAgent = getBrowserUserAgent().toLowerCase(); |
48 |
|
- |
if (zUserAgent.contains("win")) { |
|
47 |
+ |
if ( zUserAgent.contains( "win" ) ) { |
49 |
48 |
|
mPlatform = Platform.Win; |
50 |
|
- |
} else if (zUserAgent.contains("mac")) { |
|
49 |
+ |
} else if ( zUserAgent.contains( "mac" ) ) { |
51 |
50 |
|
mPlatform = Platform.Mac; |
52 |
51 |
|
} else { |
53 |
52 |
|
mPlatform = Platform.Other; |
|
@@ -71,15 +70,15 @@ |
71 |
70 |
|
} |
72 |
71 |
|
|
73 |
72 |
|
public static native String getBrowserUserAgent() /*-{ |
74 |
|
- |
return navigator.userAgent; |
|
73 |
+ |
return navigator.userAgent; |
75 |
74 |
|
}-*/; |
76 |
75 |
|
|
77 |
76 |
|
@Override |
78 |
77 |
|
public String toString() { |
79 |
78 |
|
StringBuilder sb = new StringBuilder(); |
80 |
|
- |
sb.append(mPlatform); |
81 |
|
- |
sb.append('-').append(mFamily).append('-').append(mSpecific); |
82 |
|
- |
sb.append(" '").append(getBrowserUserAgent()).append("'"); |
|
79 |
+ |
sb.append( mPlatform ); |
|
80 |
+ |
sb.append( '-' ).append( mFamily ).append( '-' ).append( mSpecific ); |
|
81 |
+ |
sb.append( " '" ).append( getBrowserUserAgent() ).append( "'" ); |
83 |
82 |
|
return sb.toString(); |
84 |
83 |
|
} |
85 |
84 |
|
} |