1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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
32
33
34
35
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
72
73 public String getAutoFindInSelection() {
74 return (String) (has("autoFindInSelection") ? get("autoFindInSelection") : null);
75 }
76
77
78
79
80
81 public EditorFindOptions setAutoFindInSelection(final EAutoFindInSelection autoFindInSelection) {
82 put("autoFindInSelection", autoFindInSelection != null ? autoFindInSelection.toString() : null);
83 return this;
84 }
85
86
87
88
89
90 public EditorFindOptions setAutoFindInSelection(final String autoFindInSelection) {
91 put("autoFindInSelection", autoFindInSelection);
92 return this;
93 }
94
95
96
97
98 public Boolean isCursorMoveOnType() {
99 return (Boolean) (has("cursorMoveOnType") ? get("cursorMoveOnType") : null);
100 }
101
102
103
104
105
106 public EditorFindOptions setCursorMoveOnType(final Boolean cursorMoveOnType) {
107 put("cursorMoveOnType", cursorMoveOnType);
108 return this;
109 }
110
111
112
113
114
115 public Boolean isLoop() {
116 return (Boolean) (has("loop") ? get("loop") : null);
117 }
118
119
120
121
122
123
124 public EditorFindOptions setLoop(final Boolean loop) {
125 put("loop", loop);
126 return this;
127 }
128
129
130
131
132 public String getSeedSearchStringFromSelection() {
133 return (String) (has("seedSearchStringFromSelection") ? get("seedSearchStringFromSelection") : null);
134 }
135
136
137
138
139
140 public EditorFindOptions setSeedSearchStringFromSelection(final ESeedSearchStringFromSelection seedSearchStringFromSelection) {
141 put("seedSearchStringFromSelection", seedSearchStringFromSelection != null ? seedSearchStringFromSelection.toString() : null);
142 return this;
143 }
144
145
146
147
148
149 public EditorFindOptions setSeedSearchStringFromSelection(final String seedSearchStringFromSelection) {
150 put("seedSearchStringFromSelection", seedSearchStringFromSelection);
151 return this;
152 }
153
154
155
156
157 JSONObject getJSONObject() {
158 return this;
159 }
160 }