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 EditorStickyScrollOptions extends JSONObject implements Serializable {
39 private Object writeReplace() throws ObjectStreamException {
40 return new SerializedEditorStickyScrollOptions(this);
41 }
42
43 private static class SerializedEditorStickyScrollOptions implements Serializable {
44 private String json;
45
46 public SerializedEditorStickyScrollOptions(EditorStickyScrollOptions editorStickyScrollOptions) {
47 this.json = editorStickyScrollOptions.toString();
48 }
49
50 private Object readResolve() throws ObjectStreamException {
51 final EditorStickyScrollOptions editorStickyScrollOptions = new EditorStickyScrollOptions();
52 final JSONObject data = new JSONObject(json);
53 for (final String key : data.keySet()) {
54 final Object value = data.get(key);
55 editorStickyScrollOptions.put(key, value);
56 }
57 return editorStickyScrollOptions;
58 }
59 }
60
61
62
63
64 public String getDefaultModel() {
65 return (String) (has("defaultModel") ? get("defaultModel") : null);
66 }
67
68
69
70
71
72 public EditorStickyScrollOptions setDefaultModel(final EStickDefaultModelMode defaultModel) {
73 put("defaultModel", defaultModel != null ? defaultModel.toString() : null);
74 return this;
75 }
76
77
78
79
80
81 public EditorStickyScrollOptions setDefaultModel(final String defaultModel) {
82 put("defaultModel", defaultModel);
83 return this;
84 }
85
86
87
88
89 public Boolean isEnabled() {
90 return (Boolean) (has("enabled") ? get("enabled") : null);
91 }
92
93
94
95
96
97 public EditorStickyScrollOptions setEnabled(final Boolean enabled) {
98 put("enabled", enabled);
99 return this;
100 }
101
102
103
104
105 public Number getMaxLineCount() {
106 return (Number) (has("maxLineCount") ? get("maxLineCount") : null);
107 }
108
109
110
111
112
113 public EditorStickyScrollOptions setMaxLineCount(final Number maxLineCount) {
114 put("maxLineCount", maxLineCount);
115 return this;
116 }
117
118
119
120
121 JSONObject getJSONObject() {
122 return this;
123 }
124 }