01: package com.sun.portal.proxylet.client.common.browser;
02:
03: public class BrowserType {
04: private String type;
05:
06: public static BrowserType IE = new BrowserType("IE");
07: public static BrowserType Netscape6 = new BrowserType("NETSCAPE6");
08: public static BrowserType Netscape = new BrowserType("NETSCAPE");
09: public static BrowserType Firefox = new BrowserType("FIREFOX");
10: public static BrowserType Mozilla = new BrowserType("MOZILLA");
11: public static BrowserType Unsupported = new BrowserType(
12: "Unsupported");
13: public static BrowserType ParamMissing = new BrowserType(
14: "ParamMissing");
15:
16: public BrowserType(String type) {
17: this .type = type;
18: }
19:
20: public String toString() {
21: return type;
22: }
23:
24: public static BrowserType getType(String type) {
25: if (type == null)
26: return ParamMissing;
27: if (type.equals("IE") || type.equals("msie5up"))
28: return IE;
29: else if (type.equals("NETSCAPE") || type.equals("nav6up"))
30: return Netscape;
31: else if (type.equals("FIREFOX"))
32: return Firefox;
33: else if (type.equals("MOZILLA"))
34: return Mozilla;
35: else
36: return Unsupported;
37: }
38:
39: public boolean equals(BrowserType that) {
40: if (this .toString().equals(that.toString()))
41: return true;
42:
43: return false;
44: }
45: }
|