View Javadoc
1   /*
2    * Copyright (c) 2002-2026 Gargoyle Software Inc.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * https://www.apache.org/licenses/LICENSE-2.0
8    *
9    * Unless required by applicable law or agreed to in writing, software
10   * distributed under the License is distributed on an "AS IS" BASIS,
11   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12   * See the License for the specific language governing permissions and
13   * limitations under the License.
14   */
15  package org.htmlunit;
16  
17  import java.io.Serializable;
18  
19  /**
20   * {@code Screen}.
21   *
22   * @author Mike Bowler
23   * @author Daniel Gredler
24   * @author Chris Erskine
25   * @author Ronald Brill
26   * @author Ahmed Ashour
27   * @author cd alexndr
28   */
29  public class Screen implements Serializable {
30  
31      private final int screenHeight_;
32      private final int screenWidth_;
33  
34      private final int colorDepth_;
35  
36      /**
37       * Creates an instance.
38       * @param webClient the client this belongs to
39       */
40      public Screen(final WebClient webClient) {
41          super();
42          screenHeight_ = webClient.getOptions().getScreenHeight();
43          screenWidth_ =  webClient.getOptions().getScreenWidth();
44  
45          colorDepth_ = 24;
46      }
47  
48      /**
49       * Returns the value of the {@code availHeight} property.
50       *
51       * @return the {@code availHeight} property
52       */
53      public int getAvailHeight() {
54          return 1032;
55      }
56  
57      /**
58       * Sets the {@code availHeight} property.
59       * @param availHeight the {@code availHeight} property
60       */
61      public void setAvailHeight(final int availHeight) {
62          // ignore
63      }
64  
65      /**
66       * Returns the value of the {@code availLeft} property.
67       *
68       * @return the {@code availLeft} property
69       */
70      public int getAvailLeft() {
71          return 0;
72      }
73  
74      /**
75       * Sets the {@code availLeft} property.
76       * @param availLeft the {@code availLeft} property
77       */
78      public void setAvailLeft(final int availLeft) {
79          // ignore
80      }
81  
82      /**
83       * Returns the value of the {@code availTop} property.
84       *
85       * @return the {@code availTop} property
86       */
87      public int getAvailTop() {
88          return 0;
89      }
90  
91      /**
92       * Sets the {@code availTop} property.
93       * @param availTop the {@code availTop} property
94       */
95      public void setAvailTop(final int availTop) {
96          // ignore
97      }
98  
99      /**
100      * Returns the value of the {@code availWidth} property.
101      *
102      * @return the {@code availWidth} property
103      */
104     public int getAvailWidth() {
105         return 1920;
106     }
107 
108     /**
109      * Sets the {@code availWidth} property.
110      * @param availWidth the {@code availWidth} property
111      */
112     public void setAvailWidth(final int availWidth) {
113         // ignore
114     }
115 
116     /**
117      * Returns the value of the {@code colorDepth} property.
118      *
119      * @return the {@code colorDepth} property
120      */
121     public int getColorDepth() {
122         return colorDepth_;
123     }
124 
125     /**
126      * Sets the {@code colorDepth} property.
127      * @param colorDepth the {@code colorDepth} property
128      */
129     public void setColorDepth(final int colorDepth) {
130         // ignore
131     }
132 
133     /**
134      * Returns the value of the {@code deviceXDPI} property.
135      *
136      * @return the {@code deviceXDPI} property
137      */
138     public int getDeviceXDPI() {
139         return 96;
140     }
141 
142     /**
143      * Sets the {@code deviceXDPI} property.
144      * @param deviceXDPI the {@code deviceXDPI} property
145      */
146     public void setDeviceXDPI(final int deviceXDPI) {
147         // ignore
148     }
149 
150     /**
151      * Returns the value of the {@code deviceYDPI} property.
152      *
153      * @return the {@code deviceYDPI} property
154      */
155     public int getDeviceYDPI() {
156         return 96;
157     }
158 
159     /**
160      * Sets the {@code deviceYDPI} property.
161      * @param deviceYDPI the {@code deviceYDPI} property
162      */
163     public void setDeviceYDPI(final int deviceYDPI) {
164         // ignore
165     }
166 
167     /**
168      * Returns the value of the {@code height} property.
169      *
170      * @return the {@code height} property
171      */
172     public int getHeight() {
173         return screenHeight_;
174     }
175 
176     /**
177      * Sets the {@code height} property.
178      * @param height the {@code height} property
179      */
180     public void setHeight(final int height) {
181         // ignore
182     }
183 
184     /**
185      * Returns the value of the {@code left} property.
186      *
187      * @return the {@code left} property
188      */
189     public int getLeft() {
190         return 0;
191     }
192 
193     /**
194      * Sets the {@code left} property.
195      * @param left the {@code left} property
196      */
197     public void setLeft(final int left) {
198         // ignore
199     }
200 
201     /**
202      * Returns the value of the {@code pixelDepth} property.
203      *
204      * @return the {@code pixelDepth} property
205      */
206     public int getPixelDepth() {
207         return colorDepth_;
208     }
209 
210     /**
211      * Sets the {@code pixelDepth} property.
212      * @param pixelDepth the {@code pixelDepth} property
213      */
214     public void setPixelDepth(final int pixelDepth) {
215         // ignore
216     }
217 
218     /**
219      * Returns the value of the {@code top} property.
220      *
221      * @return the {@code top} property
222      */
223     public int getTop() {
224         return 0;
225     }
226 
227     /**
228      * Sets the {@code top} property.
229      * @param top the {@code top} property
230      */
231     public void setTop(final int top) {
232         // ignore
233     }
234 
235     /**
236      * Returns the value of the {@code width} property.
237      *
238      * @return the {@code width} property
239      */
240     public int getWidth() {
241         return screenWidth_;
242     }
243 
244     /**
245      * Sets the {@code width} property.
246      * @param width the {@code width} property
247      */
248     public void setWidth(final int width) {
249         // ignore
250     }
251 }