View Javadoc
1   
2   /*
3    * Copyright (c) 2011-2022 PrimeFaces Extensions
4    *
5    *  Permission is hereby granted, free of charge, to any person obtaining a copy
6    *  of this software and associated documentation files (the "Software"), to deal
7    *  in the Software without restriction, including without limitation the rights
8    *  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9    *  copies of the Software, and to permit persons to whom the Software is
10   *  furnished to do so, subject to the following conditions:
11   *
12   *  The above copyright notice and this permission notice shall be included in
13   *  all copies or substantial portions of the Software.
14   *
15   *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16   *  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17   *  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18   *  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19   *  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20   *  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21   *  THE SOFTWARE.
22   */
23  
24  package org.primefaces.extensions.model.monacoeditor;
25  
26  import org.primefaces.shaded.json.*;
27  import java.io.ObjectStreamException;
28  import java.io.Serializable;
29  
30  // ============================================================
31  // THIS FILE WAS GENERATED AUTOMATICALLY. DO NOT EDIT DIRECTLY.
32  // ============================================================
33  
34  /**
35   * Configuration options for editor scrollbars
36   */
37  @SuppressWarnings("serial")
38  public class EditorScrollbarOptions extends JSONObject implements Serializable {
39      private Object writeReplace() throws ObjectStreamException {
40          return new SerializedEditorScrollbarOptions(this);
41      }
42  
43      private static class SerializedEditorScrollbarOptions implements Serializable {
44          private String json;
45  
46          public SerializedEditorScrollbarOptions(EditorScrollbarOptions editorScrollbarOptions) {
47              this.json = editorScrollbarOptions.toString();
48          }
49  
50          private Object readResolve() throws ObjectStreamException {
51              final EditorScrollbarOptions editorScrollbarOptions = new EditorScrollbarOptions();
52              final JSONObject data = new JSONObject(json);
53              for (final String key : data.keySet()) {
54                  final Object value = data.get(key);
55                  editorScrollbarOptions.put(key, value);
56              }
57              return editorScrollbarOptions;
58          }
59      }
60  
61      /**
62       * @return Always consume mouse wheel events (always call {@code preventDefault()} and {@code stopPropagation()} on
63       * the browser events). Defaults to {@code true}.
64       */
65      public Boolean isAlwaysConsumeMouseWheel() {
66          return (Boolean) (has("alwaysConsumeMouseWheel") ? get("alwaysConsumeMouseWheel") : null);
67      }
68  
69      /**
70       * @param alwaysConsumeMouseWheel Always consume mouse wheel events (always call {@code preventDefault()} and {@code
71       * stopPropagation()} on the browser events). Defaults to {@code true}.
72       * @return This same instance, useful for chaining multiple setter methods in one call.
73       */
74      public EditorScrollbarOptions setAlwaysConsumeMouseWheel(final Boolean alwaysConsumeMouseWheel) {
75          put("alwaysConsumeMouseWheel", alwaysConsumeMouseWheel);
76          return this;
77      }
78  
79      /**
80       * @return The size of arrows (if displayed). Defaults to {@code 11}.
81       */
82      public Number getArrowSize() {
83          return (Number) (has("arrowSize") ? get("arrowSize") : null);
84      }
85  
86      /**
87       * @param arrowSize The size of arrows (if displayed). Defaults to {@code 11}.
88       * @return This same instance, useful for chaining multiple setter methods in one call.
89       */
90      public EditorScrollbarOptions setArrowSize(final Number arrowSize) {
91          put("arrowSize", arrowSize);
92          return this;
93      }
94  
95      /**
96       * @return Listen to mouse wheel events and react to them by scrolling. Defaults to {@code true}.
97       */
98      public Boolean isHandleMouseWheel() {
99          return (Boolean) (has("handleMouseWheel") ? get("handleMouseWheel") : null);
100     }
101 
102     /**
103      * @param handleMouseWheel Listen to mouse wheel events and react to them by scrolling. Defaults to {@code true}.
104      * @return This same instance, useful for chaining multiple setter methods in one call.
105      */
106     public EditorScrollbarOptions setHandleMouseWheel(final Boolean handleMouseWheel) {
107         put("handleMouseWheel", handleMouseWheel);
108         return this;
109     }
110 
111     /**
112      * @return Render horizontal scrollbar. Defaults to {@code auto}.
113      */
114     public String getHorizontal() {
115         return (String) (has("horizontal") ? get("horizontal") : null);
116     }
117 
118     /**
119      * @param horizontal Render horizontal scrollbar. Defaults to {@code auto}.
120      * @return This same instance, useful for chaining multiple setter methods in one call.
121      */
122     public EditorScrollbarOptions setHorizontal(final EScrollbarHorizontal horizontal) {
123         put("horizontal", horizontal != null ? horizontal.toString() : null);
124         return this;
125     }
126 
127     /**
128      * @param horizontal Render horizontal scrollbar. Defaults to {@code auto}.
129      * @return This same instance, useful for chaining multiple setter methods in one call.
130      */
131     public EditorScrollbarOptions setHorizontal(final String horizontal) {
132         put("horizontal", horizontal);
133         return this;
134     }
135 
136     /**
137      * @return Render arrows at the left and right of the horizontal scrollbar. Defaults to {@code false}.
138      */
139     public Boolean isHorizontalHasArrows() {
140         return (Boolean) (has("horizontalHasArrows") ? get("horizontalHasArrows") : null);
141     }
142 
143     /**
144      * @param horizontalHasArrows Render arrows at the left and right of the horizontal scrollbar. Defaults to {@code
145      * false}.
146      * @return This same instance, useful for chaining multiple setter methods in one call.
147      */
148     public EditorScrollbarOptions setHorizontalHasArrows(final Boolean horizontalHasArrows) {
149         put("horizontalHasArrows", horizontalHasArrows);
150         return this;
151     }
152 
153     /**
154      * @return Height in pixels for the horizontal scrollbar. Defaults to {@code 10} (px).
155      */
156     public Number getHorizontalScrollbarSize() {
157         return (Number) (has("horizontalScrollbarSize") ? get("horizontalScrollbarSize") : null);
158     }
159 
160     /**
161      * @param horizontalScrollbarSize Height in pixels for the horizontal scrollbar. Defaults to {@code 10} (px).
162      * @return This same instance, useful for chaining multiple setter methods in one call.
163      */
164     public EditorScrollbarOptions setHorizontalScrollbarSize(final Number horizontalScrollbarSize) {
165         put("horizontalScrollbarSize", horizontalScrollbarSize);
166         return this;
167     }
168 
169     /**
170      * @return Height in pixels for the horizontal slider. Defaults to {@code horizontalScrollbarSize}.
171      */
172     public Number getHorizontalSliderSize() {
173         return (Number) (has("horizontalSliderSize") ? get("horizontalSliderSize") : null);
174     }
175 
176     /**
177      * @param horizontalSliderSize Height in pixels for the horizontal slider. Defaults to {@code
178      * horizontalScrollbarSize}.
179      * @return This same instance, useful for chaining multiple setter methods in one call.
180      */
181     public EditorScrollbarOptions setHorizontalSliderSize(final Number horizontalSliderSize) {
182         put("horizontalSliderSize", horizontalSliderSize);
183         return this;
184     }
185 
186     /**
187      * @return When set, the horizontal scrollbar will not increase content height. Defaults to {@code false}.
188      */
189     public Boolean isIgnoreHorizontalScrollbarInContentHeight() {
190         return (Boolean) (has("ignoreHorizontalScrollbarInContentHeight") ? get("ignoreHorizontalScrollbarInContentHeight") : null);
191     }
192 
193     /**
194      * @param ignoreHorizontalScrollbarInContentHeight When set, the horizontal scrollbar will not increase content
195      * height. Defaults to {@code false}.
196      * @return This same instance, useful for chaining multiple setter methods in one call.
197      */
198     public EditorScrollbarOptions setIgnoreHorizontalScrollbarInContentHeight(final Boolean ignoreHorizontalScrollbarInContentHeight) {
199         put("ignoreHorizontalScrollbarInContentHeight", ignoreHorizontalScrollbarInContentHeight);
200         return this;
201     }
202 
203     /**
204      * @return Scroll gutter clicks move by page vs jump to position. Defaults to {@code false}.
205      */
206     public Boolean isScrollByPage() {
207         return (Boolean) (has("scrollByPage") ? get("scrollByPage") : null);
208     }
209 
210     /**
211      * @param scrollByPage Scroll gutter clicks move by page vs jump to position. Defaults to {@code false}.
212      * @return This same instance, useful for chaining multiple setter methods in one call.
213      */
214     public EditorScrollbarOptions setScrollByPage(final Boolean scrollByPage) {
215         put("scrollByPage", scrollByPage);
216         return this;
217     }
218 
219     /**
220      * @return Cast horizontal and vertical shadows when the content is scrolled. Defaults to {@code true}.
221      */
222     public Boolean isUseShadows() {
223         return (Boolean) (has("useShadows") ? get("useShadows") : null);
224     }
225 
226     /**
227      * @param useShadows Cast horizontal and vertical shadows when the content is scrolled. Defaults to {@code true}.
228      * @return This same instance, useful for chaining multiple setter methods in one call.
229      */
230     public EditorScrollbarOptions setUseShadows(final Boolean useShadows) {
231         put("useShadows", useShadows);
232         return this;
233     }
234 
235     /**
236      * @return Render vertical scrollbar. Defaults to {@code auto}.
237      */
238     public String getVertical() {
239         return (String) (has("vertical") ? get("vertical") : null);
240     }
241 
242     /**
243      * @param vertical Render vertical scrollbar. Defaults to {@code auto}.
244      * @return This same instance, useful for chaining multiple setter methods in one call.
245      */
246     public EditorScrollbarOptions setVertical(final EScrollbarVertical vertical) {
247         put("vertical", vertical != null ? vertical.toString() : null);
248         return this;
249     }
250 
251     /**
252      * @param vertical Render vertical scrollbar. Defaults to {@code auto}.
253      * @return This same instance, useful for chaining multiple setter methods in one call.
254      */
255     public EditorScrollbarOptions setVertical(final String vertical) {
256         put("vertical", vertical);
257         return this;
258     }
259 
260     /**
261      * @return Render arrows at the top and bottom of the vertical scrollbar. Defaults to {@code false}.
262      */
263     public Boolean isVerticalHasArrows() {
264         return (Boolean) (has("verticalHasArrows") ? get("verticalHasArrows") : null);
265     }
266 
267     /**
268      * @param verticalHasArrows Render arrows at the top and bottom of the vertical scrollbar. Defaults to {@code
269      * false}.
270      * @return This same instance, useful for chaining multiple setter methods in one call.
271      */
272     public EditorScrollbarOptions setVerticalHasArrows(final Boolean verticalHasArrows) {
273         put("verticalHasArrows", verticalHasArrows);
274         return this;
275     }
276 
277     /**
278      * @return Width in pixels for the vertical scrollbar. Defaults to {@code 10} (px).
279      */
280     public Number getVerticalScrollbarSize() {
281         return (Number) (has("verticalScrollbarSize") ? get("verticalScrollbarSize") : null);
282     }
283 
284     /**
285      * @param verticalScrollbarSize Width in pixels for the vertical scrollbar. Defaults to {@code 10} (px).
286      * @return This same instance, useful for chaining multiple setter methods in one call.
287      */
288     public EditorScrollbarOptions setVerticalScrollbarSize(final Number verticalScrollbarSize) {
289         put("verticalScrollbarSize", verticalScrollbarSize);
290         return this;
291     }
292 
293     /**
294      * @return Width in pixels for the vertical slider. Defaults to {@code verticalScrollbarSize}.
295      */
296     public Number getVerticalSliderSize() {
297         return (Number) (has("verticalSliderSize") ? get("verticalSliderSize") : null);
298     }
299 
300     /**
301      * @param verticalSliderSize Width in pixels for the vertical slider. Defaults to {@code verticalScrollbarSize}.
302      * @return This same instance, useful for chaining multiple setter methods in one call.
303      */
304     public EditorScrollbarOptions setVerticalSliderSize(final Number verticalSliderSize) {
305         put("verticalSliderSize", verticalSliderSize);
306         return this;
307     }
308 
309     /**
310      * @return This options object as a serializable JSON object
311      */
312     JSONObject getJSONObject() {
313         return this;
314     }
315 }