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 find widget
36   */
37  @SuppressWarnings("serial")
38  public class EditorFindOptions extends JSONObject implements Serializable {
39      private Object writeReplace() throws ObjectStreamException {
40          return new SerializedEditorFindOptions(this);
41      }
42  
43      private static class SerializedEditorFindOptions implements Serializable {
44          private String json;
45  
46          public SerializedEditorFindOptions(EditorFindOptions editorFindOptions) {
47              this.json = editorFindOptions.toString();
48          }
49  
50          private Object readResolve() throws ObjectStreamException {
51              final EditorFindOptions editorFindOptions = new EditorFindOptions();
52              final JSONObject data = new JSONObject(json);
53              for (final String key : data.keySet()) {
54                  final Object value = data.get(key);
55                  editorFindOptions.put(key, value);
56              }
57              return editorFindOptions;
58          }
59      }
60  
61      public Boolean isAddExtraSpaceOnTop() {
62          return (Boolean) (has("addExtraSpaceOnTop") ? get("addExtraSpaceOnTop") : null);
63      }
64  
65      public EditorFindOptions setAddExtraSpaceOnTop(final Boolean addExtraSpaceOnTop) {
66          put("addExtraSpaceOnTop", addExtraSpaceOnTop);
67          return this;
68      }
69  
70      /**
71       * @return Controls if Find in Selection flag is turned on in the editor.
72       */
73      public String getAutoFindInSelection() {
74          return (String) (has("autoFindInSelection") ? get("autoFindInSelection") : null);
75      }
76  
77      /**
78       * @param autoFindInSelection Controls if Find in Selection flag is turned on in the editor.
79       * @return This same instance, useful for chaining multiple setter methods in one call.
80       */
81      public EditorFindOptions setAutoFindInSelection(final EAutoFindInSelection autoFindInSelection) {
82          put("autoFindInSelection", autoFindInSelection != null ? autoFindInSelection.toString() : null);
83          return this;
84      }
85  
86      /**
87       * @param autoFindInSelection Controls if Find in Selection flag is turned on in the editor.
88       * @return This same instance, useful for chaining multiple setter methods in one call.
89       */
90      public EditorFindOptions setAutoFindInSelection(final String autoFindInSelection) {
91          put("autoFindInSelection", autoFindInSelection);
92          return this;
93      }
94  
95      /**
96       * @return Controls whether the cursor should move to find matches while typing.
97       */
98      public Boolean isCursorMoveOnType() {
99          return (Boolean) (has("cursorMoveOnType") ? get("cursorMoveOnType") : null);
100     }
101 
102     /**
103      * @param cursorMoveOnType Controls whether the cursor should move to find matches while typing.
104      * @return This same instance, useful for chaining multiple setter methods in one call.
105      */
106     public EditorFindOptions setCursorMoveOnType(final Boolean cursorMoveOnType) {
107         put("cursorMoveOnType", cursorMoveOnType);
108         return this;
109     }
110 
111     /**
112      * @return Controls whether the search automatically restarts from the beginning (or the end) when no further
113      * matches can be found.
114      */
115     public Boolean isLoop() {
116         return (Boolean) (has("loop") ? get("loop") : null);
117     }
118 
119     /**
120      * @param loop Controls whether the search automatically restarts from the beginning (or the end) when no further
121      * matches can be found.
122      * @return This same instance, useful for chaining multiple setter methods in one call.
123      */
124     public EditorFindOptions setLoop(final Boolean loop) {
125         put("loop", loop);
126         return this;
127     }
128 
129     /**
130      * @return Controls if we seed search string in the Find Widget with editor selection.
131      */
132     public String getSeedSearchStringFromSelection() {
133         return (String) (has("seedSearchStringFromSelection") ? get("seedSearchStringFromSelection") : null);
134     }
135 
136     /**
137      * @param seedSearchStringFromSelection Controls if we seed search string in the Find Widget with editor selection.
138      * @return This same instance, useful for chaining multiple setter methods in one call.
139      */
140     public EditorFindOptions setSeedSearchStringFromSelection(final ESeedSearchStringFromSelection seedSearchStringFromSelection) {
141         put("seedSearchStringFromSelection", seedSearchStringFromSelection != null ? seedSearchStringFromSelection.toString() : null);
142         return this;
143     }
144 
145     /**
146      * @param seedSearchStringFromSelection Controls if we seed search string in the Find Widget with editor selection.
147      * @return This same instance, useful for chaining multiple setter methods in one call.
148      */
149     public EditorFindOptions setSeedSearchStringFromSelection(final String seedSearchStringFromSelection) {
150         put("seedSearchStringFromSelection", seedSearchStringFromSelection);
151         return this;
152     }
153 
154     /**
155      * @return This options object as a serializable JSON object
156      */
157     JSONObject getJSONObject() {
158         return this;
159     }
160 }