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.javascript.host.html;
16
17 import org.htmlunit.corejs.javascript.Function;
18 import org.htmlunit.html.HtmlFrameSet;
19 import org.htmlunit.javascript.configuration.JsxClass;
20 import org.htmlunit.javascript.configuration.JsxConstructor;
21 import org.htmlunit.javascript.configuration.JsxGetter;
22 import org.htmlunit.javascript.configuration.JsxSetter;
23 import org.htmlunit.javascript.host.event.Event;
24
25 /**
26 * The JavaScript object {@code HTMLFrameSetElement}.
27 *
28 * @author Bruce Chapman
29 * @author Ahmed Ashour
30 * @author Ronald Brill
31 *
32 * @see <a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLFrameSetElement">MDN Documentation</a>
33 */
34 @JsxClass(domClass = HtmlFrameSet.class)
35 public class HTMLFrameSetElement extends HTMLElement {
36
37 /**
38 * JavaScript constructor.
39 */
40 @Override
41 @JsxConstructor
42 public void jsConstructor() {
43 super.jsConstructor();
44 }
45
46 /**
47 * {@inheritDoc}
48 */
49 @Override
50 protected boolean isEventHandlerOnWindow() {
51 return true;
52 }
53
54 /**
55 * Sets the {@code rows} property.
56 *
57 * @param rows the {@code rows} attribute value
58 */
59 @JsxSetter
60 public void setRows(final String rows) {
61 final HtmlFrameSet htmlFrameSet = (HtmlFrameSet) getDomNodeOrNull();
62 if (htmlFrameSet != null) {
63 htmlFrameSet.setAttribute("rows", rows);
64 }
65 }
66
67 /**
68 * Gets the {@code rows} property.
69 *
70 * @return the {@code rows} attribute value
71 */
72 @JsxGetter
73 public String getRows() {
74 final HtmlFrameSet htmlFrameSet = (HtmlFrameSet) getDomNodeOrNull();
75 return htmlFrameSet.getRowsAttribute();
76 }
77
78 /**
79 * Sets the {@code cols} property.
80 *
81 * @param cols the {@code cols} attribute value
82 */
83 @JsxSetter
84 public void setCols(final String cols) {
85 final HtmlFrameSet htmlFrameSet = (HtmlFrameSet) getDomNodeOrNull();
86 if (htmlFrameSet != null) {
87 htmlFrameSet.setAttribute("cols", cols);
88 }
89 }
90
91 /**
92 * Gets the {@code cols} property.
93 *
94 * @return the {@code cols} attribute value
95 */
96 @JsxGetter
97 public String getCols() {
98 final HtmlFrameSet htmlFrameSet = (HtmlFrameSet) getDomNodeOrNull();
99 return htmlFrameSet.getColsAttribute();
100 }
101
102 /**
103 * Returns the {@code onbeforeunload} event handler for this element.
104 * @return the {@code onbeforeunload} event handler for this element
105 */
106 @JsxGetter
107 public Function getOnbeforeunload() {
108 return getEventHandler(Event.TYPE_BEFORE_UNLOAD);
109 }
110
111 /**
112 * Sets the {@code onbeforeunload} event handler for this element.
113 * @param beforeunload the {@code onbeforeunload} event handler for this element
114 */
115 @JsxSetter
116 public void setOnbeforeunload(final Object beforeunload) {
117 setEventHandler(Event.TYPE_BEFORE_UNLOAD, beforeunload);
118 }
119
120 /**
121 * Returns the {@code ongamepadconnected} event handler for this element.
122 * @return the {@code ongamepadconnected} event handler for this element
123 */
124 @JsxGetter
125 public Function getOngamepadconnected() {
126 return getEventHandler(Event.TYPE_GAMEPAD_CONNECTED);
127 }
128
129 /**
130 * Sets the {@code ongamepadconnected} event handler for this element.
131 * @param gamepadconnected the {@code ongamepadconnected} event handler for this element
132 */
133 @JsxSetter
134 public void setOngamepadconnected(final Object gamepadconnected) {
135 setEventHandler(Event.TYPE_GAMEPAD_CONNECTED, gamepadconnected);
136 }
137
138 /**
139 * Returns the {@code ongamepaddisconnected} event handler for this element.
140 * @return the {@code ongamepaddisconnected} event handler for this element
141 */
142 @JsxGetter
143 public Function getOngamepaddisconnected() {
144 return getEventHandler(Event.TYPE_GAMEPAD_DISCONNECTED);
145 }
146
147 /**
148 * Sets the {@code ongamepaddisconnected} event handler for this element.
149 * @param gamepaddisconnected the {@code ongamepaddisconnected} event handler for this element
150 */
151 @JsxSetter
152 public void setOngamepaddisconnected(final Object gamepaddisconnected) {
153 setEventHandler(Event.TYPE_GAMEPAD_DISCONNECTED, gamepaddisconnected);
154 }
155
156 /**
157 * Returns the {@code onhashchange} event handler for this element.
158 * @return the {@code onhashchange} event handler for this element
159 */
160 @JsxGetter
161 public Function getOnhashchange() {
162 return getEventHandler(Event.TYPE_HASH_CHANGE);
163 }
164
165 /**
166 * Sets the {@code onhashchange} event handler for this element.
167 * @param hashchange the {@code onhashchange} event handler for this element
168 */
169 @JsxSetter
170 public void setOnhashchange(final Object hashchange) {
171 setEventHandler(Event.TYPE_HASH_CHANGE, hashchange);
172 }
173
174 /**
175 * Returns the {@code onlanguagechange} event handler for this element.
176 * @return the {@code onlanguagechange} event handler for this element
177 */
178 @JsxGetter
179 public Function getOnlanguagechange() {
180 return getEventHandler(Event.TYPE_LANGUAGECHANGE);
181 }
182
183 /**
184 * Sets the {@code onlanguagechange} event handler for this element.
185 * @param languagechange the {@code onlanguagechange} event handler for this element
186 */
187 @JsxSetter
188 public void setOnlanguagechange(final Object languagechange) {
189 setEventHandler(Event.TYPE_LANGUAGECHANGE, languagechange);
190 }
191
192 /**
193 * Returns the {@code onmessage} event handler for this element.
194 * @return the {@code onmessage} event handler for this element
195 */
196 @JsxGetter
197 public Function getOnmessage() {
198 return getEventHandler(Event.TYPE_MESSAGE);
199 }
200
201 /**
202 * Sets the {@code onmessage} event handler for this element.
203 * @param message the {@code onmessage} event handler for this element
204 */
205 @JsxSetter
206 public void setOnmessage(final Object message) {
207 setEventHandler(Event.TYPE_MESSAGE, message);
208 }
209
210 /**
211 * Returns the {@code onmessageerror} event handler for this element.
212 * @return the {@code onmessageerror} event handler for this element
213 */
214 @JsxGetter
215 public Function getOnmessageerror() {
216 return getEventHandler(Event.TYPE_ONMESSAGEERROR);
217 }
218
219 /**
220 * Sets the {@code onmessageerror} event handler for this element.
221 * @param onmessageerror the {@code onmessageerror} event handler for this element
222 */
223 @JsxSetter
224 public void setOnmessageerror(final Object onmessageerror) {
225 setEventHandler(Event.TYPE_ONMESSAGEERROR, onmessageerror);
226 }
227
228 /**
229 * Returns the {@code onoffline} event handler for this element.
230 * @return the {@code onoffline} event handler for this element
231 */
232 @JsxGetter
233 public Function getOnoffline() {
234 return getEventHandler(Event.TYPE_OFFLINE);
235 }
236
237 /**
238 * Sets the {@code onoffline} event handler for this element.
239 * @param offline the {@code onoffline} event handler for this element
240 */
241 @JsxSetter
242 public void setOnoffline(final Object offline) {
243 setEventHandler(Event.TYPE_OFFLINE, offline);
244 }
245
246 /**
247 * Returns the {@code ononline} event handler for this element.
248 * @return the {@code ononline} event handler for this element
249 */
250 @JsxGetter
251 public Function getOnonline() {
252 return getEventHandler(Event.TYPE_ONLINE);
253 }
254
255 /**
256 * Sets the {@code ononline} event handler for this element.
257 * @param online the {@code ononline} event handler for this element
258 */
259 @JsxSetter
260 public void setOnonline(final Object online) {
261 setEventHandler(Event.TYPE_ONLINE, online);
262 }
263
264 /**
265 * Returns the {@code onpagehide} event handler for this element.
266 * @return the {@code onpagehide} event handler for this element
267 */
268 @JsxGetter
269 public Function getOnpagehide() {
270 return getEventHandler(Event.TYPE_PAGEHIDE);
271 }
272
273 /**
274 * Sets the {@code onpagehide} event handler for this element.
275 * @param pagehide the {@code onpagehide} event handler for this element
276 */
277 @JsxSetter
278 public void setOnpagehide(final Object pagehide) {
279 setEventHandler(Event.TYPE_PAGEHIDE, pagehide);
280 }
281
282 /**
283 * Returns the {@code onpageshow} event handler for this element.
284 * @return the {@code onpageshow} event handler for this element
285 */
286 @JsxGetter
287 public Function getOnpageshow() {
288 return getEventHandler(Event.TYPE_PAGESHOW);
289 }
290
291 /**
292 * Sets the {@code onpageshow} event handler for this element.
293 * @param pageshow the {@code onpageshow} event handler for this element
294 */
295 @JsxSetter
296 public void setOnpageshow(final Object pageshow) {
297 setEventHandler(Event.TYPE_PAGESHOW, pageshow);
298 }
299
300 /**
301 * Returns the {@code onpopstate} event handler for this element.
302 * @return the {@code onpopstate} event handler for this element
303 */
304 @JsxGetter
305 public Function getOnpopstate() {
306 return getEventHandler(Event.TYPE_POPSTATE);
307 }
308
309 /**
310 * Sets the {@code onpopstate} event handler for this element.
311 * @param popstate the {@code onpopstate} event handler for this element
312 */
313 @JsxSetter
314 public void setOnpopstate(final Object popstate) {
315 setEventHandler(Event.TYPE_POPSTATE, popstate);
316 }
317
318 /**
319 * Returns the {@code onrejectionhandled} event handler for this element.
320 * @return the {@code onrejectionhandled} event handler for this element
321 */
322 @JsxGetter
323 public Function getOnrejectionhandled() {
324 return getEventHandler(Event.TYPE_REJECTIONHANDLED);
325 }
326
327 /**
328 * Sets the {@code onrejectionhandled} event handler for this element.
329 * @param rejectionhandled the {@code onrejectionhandled} event handler for this element
330 */
331 @JsxSetter
332 public void setOnrejectionhandled(final Object rejectionhandled) {
333 setEventHandler(Event.TYPE_REJECTIONHANDLED, rejectionhandled);
334 }
335
336 /**
337 * Returns the {@code onstorage} event handler for this element.
338 * @return the {@code onstorage} event handler for this element
339 */
340 @JsxGetter
341 public Function getOnstorage() {
342 return getEventHandler(Event.TYPE_STORAGE);
343 }
344
345 /**
346 * Sets the {@code onstorage} event handler for this element.
347 * @param storage the {@code onstorage} event handler for this element
348 */
349 @JsxSetter
350 public void setOnstorage(final Object storage) {
351 setEventHandler(Event.TYPE_STORAGE, storage);
352 }
353
354 /**
355 * Returns the {@code onunhandledrejection} event handler for this element.
356 * @return the {@code onunhandledrejection} event handler for this element
357 */
358 @JsxGetter
359 public Function getOnunhandledrejection() {
360 return getEventHandler(Event.TYPE_UNHANDLEDREJECTION);
361 }
362
363 /**
364 * Sets the {@code onunhandledrejection} event handler for this element.
365 * @param unhandledrejection the {@code onunhandledrejection} event handler for this element
366 */
367 @JsxSetter
368 public void setOnunhandledrejection(final Object unhandledrejection) {
369 setEventHandler(Event.TYPE_UNHANDLEDREJECTION, unhandledrejection);
370 }
371
372 /**
373 * Returns the {@code onunload} event handler for this element.
374 * @return the {@code onunload} event handler for this element
375 */
376 @JsxGetter
377 public Function getOnunload() {
378 return getEventHandler(Event.TYPE_UNLOAD);
379 }
380
381 /**
382 * Sets the {@code onunload} event handler for this element.
383 * @param unload the {@code onunload} event handler for this element
384 */
385 @JsxSetter
386 public void setOnunload(final Object unload) {
387 setEventHandler(Event.TYPE_UNLOAD, unload);
388 }
389
390 /**
391 * Returns the {@code onafterprint} event handler for this element.
392 * @return the {@code onafterprint} event handler for this element
393 */
394 @JsxGetter
395 public Function getOnafterprint() {
396 return getEventHandler(Event.TYPE_AFTERPRINT);
397 }
398
399 /**
400 * Sets the {@code onafterprint} event handler for this element.
401 * @param afterprint the {@code onafterprint} event handler for this element
402 */
403 @JsxSetter
404 public void setOnafterprint(final Object afterprint) {
405 setEventHandler(Event.TYPE_AFTERPRINT, afterprint);
406 }
407
408 /**
409 * Returns the {@code onbeforeprint} event handler for this element.
410 * @return the {@code onbeforeprint} event handler for this element
411 */
412 @JsxGetter
413 public Function getOnbeforeprint() {
414 return getEventHandler(Event.TYPE_BEFOREPRINT);
415 }
416
417 /**
418 * Sets the {@code onbeforeprint} event handler for this element.
419 * @param beforeprint the {@code onbeforeprint} event handler for this element
420 */
421 @JsxSetter
422 public void setOnbeforeprint(final Object beforeprint) {
423 setEventHandler(Event.TYPE_BEFOREPRINT, beforeprint);
424 }
425 }