View Javadoc
1   /*
2    * Copyright (c) 2002-2025 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 <a href="mailto:mbowler@GargoyleSoftware.com">Mike Bowler</a>
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      /**
35       * Creates an instance.
36       * @param webClient the client this belongs to
37       */
38      public Screen(final WebClient webClient) {
39          super();
40          screenHeight_ = webClient.getOptions().getScreenHeight();
41          screenWidth_ =  webClient.getOptions().getScreenWidth();
42      }
43  
44      /**
45       * @return the {@code availHeight} property
46       */
47      public int getAvailHeight() {
48          return 1040;
49      }
50  
51      /**
52       * Sets the {@code availHeight} property.
53       * @param availHeight the {@code availHeight} property
54       */
55      public void setAvailHeight(final int availHeight) {
56          // ignore
57      }
58  
59      /**
60       * @return the {@code availLeft} property
61       */
62      public int getAvailLeft() {
63          return 0;
64      }
65  
66      /**
67       * Sets the {@code availLeft} property.
68       * @param availLeft the {@code availLeft} property
69       */
70      public void setAvailLeft(final int availLeft) {
71          // ignore
72      }
73  
74      /**
75       * @return the {@code availTop} property
76       */
77      public int getAvailTop() {
78          return 0;
79      }
80  
81      /**
82       * Sets the {@code availTop} property.
83       * @param availTop the {@code availTop} property
84       */
85      public void setAvailTop(final int availTop) {
86          // ignore
87      }
88  
89      /**
90       * @return the {@code availWidth} property
91       */
92      public int getAvailWidth() {
93          return 1920;
94      }
95  
96      /**
97       * Sets the {@code availWidth} property.
98       * @param availWidth the {@code availWidth} property
99       */
100     public void setAvailWidth(final int availWidth) {
101         // ignore
102     }
103 
104     /**
105      * @return the {@code colorDepth} property
106      */
107     public int getColorDepth() {
108         return 24;
109     }
110 
111     /**
112      * Sets the {@code colorDepth} property.
113      * @param colorDepth the {@code colorDepth} property
114      */
115     public void setColorDepth(final int colorDepth) {
116         // ignore
117     }
118 
119     /**
120      * @return the {@code deviceXDPI} property
121      */
122     public int getDeviceXDPI() {
123         return 96;
124     }
125 
126     /**
127      * Sets the {@code deviceXDPI} property.
128      * @param deviceXDPI the {@code deviceXDPI} property
129      */
130     public void setDeviceXDPI(final int deviceXDPI) {
131         // ignore
132     }
133 
134     /**
135      * @return the {@code deviceYDPI} property
136      */
137     public int getDeviceYDPI() {
138         return 96;
139     }
140 
141     /**
142      * Sets the {@code deviceYDPI} property.
143      * @param deviceYDPI the {@code deviceYDPI} property
144      */
145     public void setDeviceYDPI(final int deviceYDPI) {
146         // ignore
147     }
148 
149     /**
150      * @return the {@code height} property
151      */
152     public int getHeight() {
153         return screenHeight_;
154     }
155 
156     /**
157      * Sets the {@code height} property.
158      * @param height the {@code height} property
159      */
160     public void setHeight(final int height) {
161         // ignore
162     }
163 
164     /**
165      * @return the {@code left} property
166      */
167     public int getLeft() {
168         return 0;
169     }
170 
171     /**
172      * Sets the {@code left} property.
173      * @param left the {@code left} property
174      */
175     public void setLeft(final int left) {
176         // ignore
177     }
178 
179     /**
180      * @return the {@code pixelDepth} property
181      */
182     public int getPixelDepth() {
183         return 24;
184     }
185 
186     /**
187      * Sets the {@code pixelDepth} property.
188      * @param pixelDepth the {@code pixelDepth} property
189      */
190     public void setPixelDepth(final int pixelDepth) {
191         // ignore
192     }
193 
194     /**
195      * @return the {@code top} property
196      */
197     public int getTop() {
198         return 0;
199     }
200 
201     /**
202      * Sets the {@code top} property.
203      * @param top the {@code top} property
204      */
205     public void setTop(final int top) {
206         // ignore
207     }
208 
209     /**
210      * @return the {@code width} property
211      */
212     public int getWidth() {
213         return screenWidth_;
214     }
215 
216     /**
217      * Sets the {@code width} property.
218      * @param width the {@code width} property
219      */
220     public void setWidth(final int width) {
221         // ignore
222     }
223 }