KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > lobobrowser > html > js > Navigator


1 /*
2     GNU LESSER GENERAL PUBLIC LICENSE
3     Copyright (C) 2006 The Lobo Project
4
5     This library is free software; you can redistribute it and/or
6     modify it under the terms of the GNU Lesser General Public
7     License as published by the Free Software Foundation; either
8     version 2.1 of the License, or (at your option) any later version.
9
10     This library is distributed in the hope that it will be useful,
11     but WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13     Lesser General Public License for more details.
14
15     You should have received a copy of the GNU Lesser General Public
16     License along with this library; if not, write to the Free Software
17     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
19     Contact info: xamjadmin@users.sourceforge.net
20 */

21
22 package org.lobobrowser.html.js;
23
24 import org.lobobrowser.html.*;
25 import org.lobobrowser.js.*;
26
27 public class Navigator extends AbstractScriptableDelegate {
28     private final UserAgentContext context;
29
30     /**
31      * @param context
32      */

33     public Navigator(UserAgentContext context) {
34         super();
35         this.context = context;
36     }
37         
38     public String JavaDoc getAppCodeName() {
39         return this.context.getAppCodeName();
40     }
41
42     public String JavaDoc getAppName() {
43         return this.context.getAppName();
44     }
45     
46     public String JavaDoc getAppVersion() {
47         return this.context.getAppVersion();
48     }
49
50     public String JavaDoc getAppMinorVersion() {
51         return this.context.getAppMinorVersion();
52     }
53     
54     public String JavaDoc getPlatform() {
55         return this.context.getPlatform();
56     }
57     
58     public String JavaDoc getUserAgent() {
59         return this.context.getUserAgent();
60     }
61     
62     public boolean javaEnabled() {
63         // True always?
64
return true;
65     }
66     
67     private MimeTypesCollection mimeTypes;
68     
69     public MimeTypesCollection getMimeTypes() {
70         synchronized(this) {
71             MimeTypesCollection mt = this.mimeTypes;
72             if(mt == null) {
73                 mt = new MimeTypesCollection();
74                 this.mimeTypes = mt;
75             }
76             return mt;
77         }
78     }
79
80     public class MimeTypesCollection {
81         // Class must be public to allow JavaScript access
82
public int getLength() {
83             return 0;
84         }
85
86         public Object JavaDoc item(int index) {
87             return null;
88         }
89
90         public Object JavaDoc namedItem(String JavaDoc name) {
91             return null;
92         }
93     }
94 }
Popular Tags