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 hover
36   */
37  @SuppressWarnings("serial")
38  public class EditorHoverOptions extends JSONObject implements Serializable {
39      private Object writeReplace() throws ObjectStreamException {
40          return new SerializedEditorHoverOptions(this);
41      }
42  
43      private static class SerializedEditorHoverOptions implements Serializable {
44          private String json;
45  
46          public SerializedEditorHoverOptions(EditorHoverOptions editorHoverOptions) {
47              this.json = editorHoverOptions.toString();
48          }
49  
50          private Object readResolve() throws ObjectStreamException {
51              final EditorHoverOptions editorHoverOptions = new EditorHoverOptions();
52              final JSONObject data = new JSONObject(json);
53              for (final String key : data.keySet()) {
54                  final Object value = data.get(key);
55                  editorHoverOptions.put(key, value);
56              }
57              return editorHoverOptions;
58          }
59      }
60  
61      /**
62       * @return Should the hover be shown above the line if possible? Defaults to {@code false}.
63       */
64      public Boolean isAbove() {
65          return (Boolean) (has("above") ? get("above") : null);
66      }
67  
68      /**
69       * @param above Should the hover be shown above the line if possible? Defaults to {@code false}.
70       * @return This same instance, useful for chaining multiple setter methods in one call.
71       */
72      public EditorHoverOptions setAbove(final Boolean above) {
73          put("above", above);
74          return this;
75      }
76  
77      /**
78       * @return Delay for showing the hover. Defaults to 300.
79       */
80      public Number getDelay() {
81          return (Number) (has("delay") ? get("delay") : null);
82      }
83  
84      /**
85       * @param delay Delay for showing the hover. Defaults to 300.
86       * @return This same instance, useful for chaining multiple setter methods in one call.
87       */
88      public EditorHoverOptions setDelay(final Number delay) {
89          put("delay", delay);
90          return this;
91      }
92  
93      /**
94       * @return Enable the hover. Defaults to {@code true}.
95       */
96      public Boolean isEnabled() {
97          return (Boolean) (has("enabled") ? get("enabled") : null);
98      }
99  
100     /**
101      * @param enabled Enable the hover. Defaults to {@code true}.
102      * @return This same instance, useful for chaining multiple setter methods in one call.
103      */
104     public EditorHoverOptions setEnabled(final Boolean enabled) {
105         put("enabled", enabled);
106         return this;
107     }
108 
109     /**
110      * @return Is the hover sticky such that it can be clicked and its contents selected? Defaults to {@code true}.
111      */
112     public Boolean isSticky() {
113         return (Boolean) (has("sticky") ? get("sticky") : null);
114     }
115 
116     /**
117      * @param sticky Is the hover sticky such that it can be clicked and its contents selected? Defaults to {@code
118      * true}.
119      * @return This same instance, useful for chaining multiple setter methods in one call.
120      */
121     public EditorHoverOptions setSticky(final Boolean sticky) {
122         put("sticky", sticky);
123         return this;
124     }
125 
126     /**
127      * @return This options object as a serializable JSON object
128      */
129     JSONObject getJSONObject() {
130         return this;
131     }
132 }