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 minimap
36   */
37  @SuppressWarnings("serial")
38  public class EditorMinimapOptions extends JSONObject implements Serializable {
39      private Object writeReplace() throws ObjectStreamException {
40          return new SerializedEditorMinimapOptions(this);
41      }
42  
43      private static class SerializedEditorMinimapOptions implements Serializable {
44          private String json;
45  
46          public SerializedEditorMinimapOptions(EditorMinimapOptions editorMinimapOptions) {
47              this.json = editorMinimapOptions.toString();
48          }
49  
50          private Object readResolve() throws ObjectStreamException {
51              final EditorMinimapOptions editorMinimapOptions = new EditorMinimapOptions();
52              final JSONObject data = new JSONObject(json);
53              for (final String key : data.keySet()) {
54                  final Object value = data.get(key);
55                  editorMinimapOptions.put(key, value);
56              }
57              return editorMinimapOptions;
58          }
59      }
60  
61      /**
62       * @return Control the rendering of minimap.
63       */
64      public Boolean isAutohide() {
65          return (Boolean) (has("autohide") ? get("autohide") : null);
66      }
67  
68      /**
69       * @param autohide Control the rendering of minimap.
70       * @return This same instance, useful for chaining multiple setter methods in one call.
71       */
72      public EditorMinimapOptions setAutohide(final Boolean autohide) {
73          put("autohide", autohide);
74          return this;
75      }
76  
77      /**
78       * @return Enable the rendering of the minimap. Defaults to {@code true}.
79       */
80      public Boolean isEnabled() {
81          return (Boolean) (has("enabled") ? get("enabled") : null);
82      }
83  
84      /**
85       * @param enabled Enable the rendering of the minimap. Defaults to {@code true}.
86       * @return This same instance, useful for chaining multiple setter methods in one call.
87       */
88      public EditorMinimapOptions setEnabled(final Boolean enabled) {
89          put("enabled", enabled);
90          return this;
91      }
92  
93      /**
94       * @return Limit the width of the minimap to render at most a certain number of columns. Defaults to {@code 120}.
95       */
96      public Number getMaxColumn() {
97          return (Number) (has("maxColumn") ? get("maxColumn") : null);
98      }
99  
100     /**
101      * @param maxColumn Limit the width of the minimap to render at most a certain number of columns. Defaults to {@code
102      * 120}.
103      * @return This same instance, useful for chaining multiple setter methods in one call.
104      */
105     public EditorMinimapOptions setMaxColumn(final Number maxColumn) {
106         put("maxColumn", maxColumn);
107         return this;
108     }
109 
110     /**
111      * @return Render the actual text on a line (as opposed to color blocks). Defaults to {@code true}.
112      */
113     public Boolean isRenderCharacters() {
114         return (Boolean) (has("renderCharacters") ? get("renderCharacters") : null);
115     }
116 
117     /**
118      * @param renderCharacters Render the actual text on a line (as opposed to color blocks). Defaults to {@code true}.
119      * @return This same instance, useful for chaining multiple setter methods in one call.
120      */
121     public EditorMinimapOptions setRenderCharacters(final Boolean renderCharacters) {
122         put("renderCharacters", renderCharacters);
123         return this;
124     }
125 
126     /**
127      * @return Relative size of the font in the minimap. Defaults to {@code 1}.
128      */
129     public Number getScale() {
130         return (Number) (has("scale") ? get("scale") : null);
131     }
132 
133     /**
134      * @param scale Relative size of the font in the minimap. Defaults to {@code 1}.
135      * @return This same instance, useful for chaining multiple setter methods in one call.
136      */
137     public EditorMinimapOptions setScale(final Number scale) {
138         put("scale", scale);
139         return this;
140     }
141 
142     /**
143      * @return Font size of section headers. Defaults to {@code 9}.
144      */
145     public Number getSectionHeaderFontSize() {
146         return (Number) (has("sectionHeaderFontSize") ? get("sectionHeaderFontSize") : null);
147     }
148 
149     /**
150      * @param sectionHeaderFontSize Font size of section headers. Defaults to {@code 9}.
151      * @return This same instance, useful for chaining multiple setter methods in one call.
152      */
153     public EditorMinimapOptions setSectionHeaderFontSize(final Number sectionHeaderFontSize) {
154         put("sectionHeaderFontSize", sectionHeaderFontSize);
155         return this;
156     }
157 
158     /**
159      * @return Spacing between the section header characters (in CSS px). Defaults to {@code 1}.
160      */
161     public Number getSectionHeaderLetterSpacing() {
162         return (Number) (has("sectionHeaderLetterSpacing") ? get("sectionHeaderLetterSpacing") : null);
163     }
164 
165     /**
166      * @param sectionHeaderLetterSpacing Spacing between the section header characters (in CSS px). Defaults to {@code
167      * 1}.
168      * @return This same instance, useful for chaining multiple setter methods in one call.
169      */
170     public EditorMinimapOptions setSectionHeaderLetterSpacing(final Number sectionHeaderLetterSpacing) {
171         put("sectionHeaderLetterSpacing", sectionHeaderLetterSpacing);
172         return this;
173     }
174 
175     /**
176      * @return Whether to show MARK: comments as section headers. Defaults to {@code true}.
177      */
178     public Boolean isShowMarkSectionHeaders() {
179         return (Boolean) (has("showMarkSectionHeaders") ? get("showMarkSectionHeaders") : null);
180     }
181 
182     /**
183      * @param showMarkSectionHeaders Whether to show MARK: comments as section headers. Defaults to {@code true}.
184      * @return This same instance, useful for chaining multiple setter methods in one call.
185      */
186     public EditorMinimapOptions setShowMarkSectionHeaders(final Boolean showMarkSectionHeaders) {
187         put("showMarkSectionHeaders", showMarkSectionHeaders);
188         return this;
189     }
190 
191     /**
192      * @return Whether to show named regions as section headers. Defaults to {@code true}.
193      */
194     public Boolean isShowRegionSectionHeaders() {
195         return (Boolean) (has("showRegionSectionHeaders") ? get("showRegionSectionHeaders") : null);
196     }
197 
198     /**
199      * @param showRegionSectionHeaders Whether to show named regions as section headers. Defaults to {@code true}.
200      * @return This same instance, useful for chaining multiple setter methods in one call.
201      */
202     public EditorMinimapOptions setShowRegionSectionHeaders(final Boolean showRegionSectionHeaders) {
203         put("showRegionSectionHeaders", showRegionSectionHeaders);
204         return this;
205     }
206 
207     /**
208      * @return Control the rendering of the minimap slider. Defaults to {@code mouseover}.
209      */
210     public String getShowSlider() {
211         return (String) (has("showSlider") ? get("showSlider") : null);
212     }
213 
214     /**
215      * @param showSlider Control the rendering of the minimap slider. Defaults to {@code mouseover}.
216      * @return This same instance, useful for chaining multiple setter methods in one call.
217      */
218     public EditorMinimapOptions setShowSlider(final EMinimapShowSlider showSlider) {
219         put("showSlider", showSlider != null ? showSlider.toString() : null);
220         return this;
221     }
222 
223     /**
224      * @param showSlider Control the rendering of the minimap slider. Defaults to {@code mouseover}.
225      * @return This same instance, useful for chaining multiple setter methods in one call.
226      */
227     public EditorMinimapOptions setShowSlider(final String showSlider) {
228         put("showSlider", showSlider);
229         return this;
230     }
231 
232     /**
233      * @return Control the side of the minimap in editor. Defaults to {@code right}.
234      */
235     public String getSide() {
236         return (String) (has("side") ? get("side") : null);
237     }
238 
239     /**
240      * @param side Control the side of the minimap in editor. Defaults to {@code right}.
241      * @return This same instance, useful for chaining multiple setter methods in one call.
242      */
243     public EditorMinimapOptions setSide(final EMinimapSide side) {
244         put("side", side != null ? side.toString() : null);
245         return this;
246     }
247 
248     /**
249      * @param side Control the side of the minimap in editor. Defaults to {@code right}.
250      * @return This same instance, useful for chaining multiple setter methods in one call.
251      */
252     public EditorMinimapOptions setSide(final String side) {
253         put("side", side);
254         return this;
255     }
256 
257     /**
258      * @return Control the minimap rendering mode. Defaults to actual.
259      */
260     public String getSize() {
261         return (String) (has("size") ? get("size") : null);
262     }
263 
264     /**
265      * @param size Control the minimap rendering mode. Defaults to actual.
266      * @return This same instance, useful for chaining multiple setter methods in one call.
267      */
268     public EditorMinimapOptions setSize(final EMinimapSize size) {
269         put("size", size != null ? size.toString() : null);
270         return this;
271     }
272 
273     /**
274      * @param size Control the minimap rendering mode. Defaults to actual.
275      * @return This same instance, useful for chaining multiple setter methods in one call.
276      */
277     public EditorMinimapOptions setSize(final String size) {
278         put("size", size);
279         return this;
280     }
281 
282     /**
283      * @return This options object as a serializable JSON object
284      */
285     JSONObject getJSONObject() {
286         return this;
287     }
288 }