KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > gargoylesoftware > htmlunit > javascript > host > Screen


1 /*
2  * Copyright (c) 2002, 2005 Gargoyle Software Inc. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are met:
6  *
7  * 1. Redistributions of source code must retain the above copyright notice,
8  * this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright notice,
10  * this list of conditions and the following disclaimer in the documentation
11  * and/or other materials provided with the distribution.
12  * 3. The end-user documentation included with the redistribution, if any, must
13  * include the following acknowledgment:
14  *
15  * "This product includes software developed by Gargoyle Software Inc.
16  * (http://www.GargoyleSoftware.com/)."
17  *
18  * Alternately, this acknowledgment may appear in the software itself, if
19  * and wherever such third-party acknowledgments normally appear.
20  * 4. The name "Gargoyle Software" must not be used to endorse or promote
21  * products derived from this software without prior written permission.
22  * For written permission, please contact info@GargoyleSoftware.com.
23  * 5. Products derived from this software may not be called "HtmlUnit", nor may
24  * "HtmlUnit" appear in their name, without prior written permission of
25  * Gargoyle Software Inc.
26  *
27  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
28  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
29  * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GARGOYLE
30  * SOFTWARE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
31  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
32  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
33  * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
36  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37  */

38 package com.gargoylesoftware.htmlunit.javascript.host;
39
40 import com.gargoylesoftware.htmlunit.javascript.SimpleScriptable;
41
42 /**
43  * A javascript object for a Screen. Combines properties from both Mozilla's DOM
44  * and IE's DOM.
45  *
46  * @version $Revision: 100 $
47  * @author <a HREF="mailto:mbowler@GargoyleSoftware.com">Mike Bowler</a>
48  * @author Daniel Gredler
49  * @author Chris Erskine
50  *
51  * @see <a HREF="http://msdn.microsoft.com/workshop/author/dhtml/reference/objects/obj_screen.asp">
52  * MSDN documentation</a>
53  * @see <a HREF="http://www.mozilla.org/docs/dom/domref/dom_window_ref.html">Mozilla documentation</a>
54  */

55 public class Screen extends SimpleScriptable {
56
57     private static final long serialVersionUID = 7775024295042666245L;
58
59     private int left_;
60     private int top_;
61     private int width_;
62     private int height_;
63     private int colorDepth_;
64     private int bufferDepth_;
65     private int dpi_;
66     private boolean fontSmoothingEnabled_;
67     private int updateInterval_;
68
69     /**
70      * Create an instance. Javascript objects must have a default constructor.
71      */

72     public Screen() {
73         left_ = 0;
74         top_ = 0;
75         width_ = 800;
76         height_ = 600;
77         colorDepth_ = 24;
78         bufferDepth_ = 24;
79         dpi_ = 96;
80         fontSmoothingEnabled_ = true;
81         updateInterval_ = 0;
82     }
83
84     /**
85      * Return the <tt>availHeight</tt> property.
86      * @return the <tt>availHeight</tt> property
87      */

88     public int jsxGet_availHeight() {
89         return height_;
90     }
91
92     /**
93      * Return the <tt>availLeft</tt> property.
94      * @return the <tt>availLeft</tt> property
95      */

96     public int jsxGet_availLeft() {
97         return left_;
98     }
99
100     /**
101      * Return the <tt>availTop</tt> property.
102      * @return the <tt>availTop</tt> property
103      */

104     public int jsxGet_availTop() {
105         return top_;
106     }
107
108     /**
109      * Return the <tt>availWidth</tt> property.
110      * @return the <tt>availWidth</tt> property
111      */

112     public int jsxGet_availWidth() {
113         return width_;
114     }
115
116     /**
117      * Return the <tt>bufferDepth</tt> property.
118      * @return the <tt>bufferDepth</tt> property
119      */

120     public int jsxGet_bufferDepth() {
121         return bufferDepth_;
122     }
123
124     /**
125      * Sets the <tt>bufferDepth</tt> property.
126      * @param bufferDepth the <tt>bufferDepth</tt> property
127      */

128     public void jsxSet_bufferDepth(final int bufferDepth) {
129         bufferDepth_ = bufferDepth;
130     }
131
132     /**
133      * Return the <tt>colorDepth</tt> property.
134      * @return the <tt>colorDepth</tt> property
135      */

136     public int jsxGet_colorDepth() {
137         return colorDepth_;
138     }
139
140     /**
141      * Return the <tt>deviceXDPI</tt> property.
142      * @return the <tt>deviceXDPI</tt> property
143      */

144     public int jsxGet_deviceXDPI() {
145         return dpi_;
146     }
147
148     /**
149      * Return the <tt>deviceYDPI</tt> property.
150      * @return the <tt>deviceYDPI</tt> property
151      */

152     public int jsxGet_deviceYDPI() {
153         return dpi_;
154     }
155
156     /**
157      * Return the <tt>fontSmoothingEnabled</tt> property.
158      * @return the <tt>fontSmoothingEnabled</tt> property
159      */

160     public boolean jsxGet_fontSmoothingEnabled() {
161         return fontSmoothingEnabled_;
162     }
163
164     /**
165      * Return the <tt>height</tt> property.
166      * @return the <tt>height</tt> property
167      */

168     public int jsxGet_height() {
169         return height_;
170     }
171
172     /**
173      * Return the <tt>left</tt> property.
174      * @return the <tt>left</tt> property
175      */

176     public int jsxGet_left() {
177         return left_;
178     }
179
180     /**
181      * Sets the <tt>left</tt> property.
182      * @param left the <tt>left</tt> property
183      */

184     public void jsxSet_left(final int left) {
185         left_ = left;
186     }
187
188     /**
189      * Return the <tt>logicalXDPI</tt> property.
190      * @return the <tt>logicalXDPI</tt> property
191      */

192     public int jsxGet_logicalXDPI() {
193         return dpi_;
194     }
195
196     /**
197      * Return the <tt>logicalYDPI</tt> property.
198      * @return the <tt>logicalYDPI</tt> property
199      */

200     public int jsxGet_logicalYDPI() {
201         return dpi_;
202     }
203
204     /**
205      * Return the <tt>pixelDepth</tt> property.
206      * @return the <tt>pixelDepth</tt> property
207      */

208     public int jsxGet_pixelDepth() {
209         return colorDepth_;
210     }
211
212     /**
213      * Return the <tt>top</tt> property.
214      * @return the <tt>top</tt> property
215      */

216     public int jsxGet_top() {
217         return top_;
218     }
219
220     /**
221      * Sets the <tt>top</tt> property.
222      * @param top the <tt>top</tt> property
223      */

224     public void jsxSet_top(final int top) {
225         top_ = top;
226     }
227
228     /**
229      * Return the <tt>updateInterval</tt> property.
230      * @return the <tt>updateInterval</tt> property
231      */

232     public int jsxGet_updateInterval() {
233         return updateInterval_;
234     }
235
236     /**
237      * Sets the <tt>updateInterval</tt> property.
238      * @param updateInterval the <tt>updateInterval</tt> property
239      */

240     public void jsxSet_updateInterval(final int updateInterval) {
241         updateInterval_ = updateInterval;
242     }
243
244     /**
245      * Return the <tt>width</tt> property.
246      * @return the <tt>width</tt> property
247      */

248     public int jsxGet_width() {
249         return width_;
250     }
251 }
252
Popular Tags