KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > wings > session > BrowserType


1 /*
2  * $Id: BrowserType.java,v 1.4 2005/05/20 09:15:32 neurolabs Exp $
3  * Copyright 2000,2005 wingS development team.
4  *
5  * This file is part of wingS (http://www.j-wings.org).
6  *
7  * wingS is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU Lesser General Public License
9  * as published by the Free Software Foundation; either version 2.1
10  * of the License, or (at your option) any later version.
11  *
12  * Please see COPYING for the complete licence.
13  */

14 package org.wings.session;
15
16 /**
17  * Typesafe enumeration class of operating systems on browsers client side.
18  */

19 public class BrowserType {
20     public class BrowserID {
21         public static final int UNKNOWN = 0;
22         public static final int GECKO = 1;
23         public static final int MOZILLA = 2;
24         public static final int IE = 3;
25         public static final int OPERA = 4;
26         public static final int KONQUEROR = 5;
27     }
28     /**
29      * Unknown browser type
30      */

31     public static final BrowserType UNKNOWN = new BrowserType(BrowserID.UNKNOWN, "default", "Unknown");
32
33     /**
34      * Gecko based browser type.
35      */

36     public static final BrowserType GECKO = new BrowserType(BrowserID.GECKO, "gecko", "Gecko");
37
38     /**
39      * Old mozilla browser type.
40      */

41     public static final BrowserType MOZILLA = new BrowserType(BrowserID.MOZILLA, "mozilla", "Mozilla (non-Gecko)");
42
43     /**
44      * Internet Explorere variant.
45      */

46     public static final BrowserType IE = new BrowserType(BrowserID.IE, "msie", "Internet Exploder");
47
48     /**
49      * Opera browser type on Linux/KDE.
50      */

51     public static final BrowserType OPERA = new BrowserType(BrowserID.OPERA, "opera", "Opera");
52
53     /**
54      * Konqueror browser type on Linux/KDE.
55      */

56     public static final BrowserType KONQUEROR = new BrowserType(BrowserID.KONQUEROR, "konqueror", "Konqueror");
57
58     private int id;
59     private String JavaDoc description;
60     private String JavaDoc shortName;
61
62     /**
63      * Typesafe enum constructor.
64      */

65     private BrowserType(int id, String JavaDoc shortName, String JavaDoc description) {
66         this.id = id;
67         this.shortName = shortName;
68         this.description = description;
69     }
70
71     /**
72      * @return A unique id for this browser type.
73      */

74     public int getId() {
75         return id;
76     }
77
78     /**
79      * @return Clear-Text browserName of this browser type
80      */

81     public String JavaDoc getDescription() {
82         return description;
83     }
84
85     /**
86      * @return Short name, used also to assemble i.e. css. file names
87      */

88     public String JavaDoc getShortName() {
89         return shortName;
90     }
91
92     public String JavaDoc toString() {
93         return getDescription();
94     }
95 }
96
Popular Tags