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 * Defines how to style a certain token in the Monaco code editor. 36 */ 37 @SuppressWarnings("serial") 38 public class EditorTokenThemeRule extends JSONObject implements Serializable { 39 private Object writeReplace() throws ObjectStreamException { 40 return new SerializedEditorTokenThemeRule(this); 41 } 42 43 private static class SerializedEditorTokenThemeRule implements Serializable { 44 private String json; 45 46 public SerializedEditorTokenThemeRule(EditorTokenThemeRule editorTokenThemeRule) { 47 this.json = editorTokenThemeRule.toString(); 48 } 49 50 private Object readResolve() throws ObjectStreamException { 51 final EditorTokenThemeRule editorTokenThemeRule = new EditorTokenThemeRule(); 52 final JSONObject data = new JSONObject(json); 53 for (final String key : data.keySet()) { 54 final Object value = data.get(key); 55 editorTokenThemeRule.put(key, value); 56 } 57 return editorTokenThemeRule; 58 } 59 } 60 61 /** 62 * @return CSS color for the background that is applied to these tokens. 63 */ 64 public String getBackground() { 65 return (String) (has("background") ? get("background") : null); 66 } 67 68 /** 69 * @param background CSS color for the background that is applied to these tokens. 70 * @return This same instance, useful for chaining multiple setter methods in one call. 71 */ 72 public EditorTokenThemeRule setBackground(final String background) { 73 put("background", background); 74 return this; 75 } 76 77 /** 78 * @return Value for the CSS font-style property that is applied to these tokens. 79 */ 80 public String getFontStyle() { 81 return (String) (has("fontStyle") ? get("fontStyle") : null); 82 } 83 84 /** 85 * @param fontStyle Value for the CSS font-style property that is applied to these tokens. 86 * @return This same instance, useful for chaining multiple setter methods in one call. 87 */ 88 public EditorTokenThemeRule setFontStyle(final String fontStyle) { 89 put("fontStyle", fontStyle); 90 return this; 91 } 92 93 /** 94 * @return CSS color for the text color that is applied to these tokens. 95 */ 96 public String getForeground() { 97 return (String) (has("foreground") ? get("foreground") : null); 98 } 99 100 /** 101 * @param foreground CSS color for the text color that is applied to these tokens. 102 * @return This same instance, useful for chaining multiple setter methods in one call. 103 */ 104 public EditorTokenThemeRule setForeground(final String foreground) { 105 put("foreground", foreground); 106 return this; 107 } 108 109 /** 110 * @return Type of token to which to apply these rules. Can be suffixed with the language ID to which they should 111 * apply. E.g. {@code comment} would apply to comment tokens of all languages, {@code comment.js} would only apply 112 * to JavaScript comment tokens. You can inspect the tokens in the Monaco editor. Right click on the editor and 113 * choose {@code Command Palette}. Then search for {@code Developer: Inspect Tokens}. 114 */ 115 public String getToken() { 116 return (String) (has("token") ? get("token") : null); 117 } 118 119 /** 120 * @param token Type of token to which to apply these rules. Can be suffixed with the language ID to which they 121 * should apply. E.g. {@code comment} would apply to comment tokens of all languages, {@code comment.js} would only 122 * apply to JavaScript comment tokens. You can inspect the tokens in the Monaco editor. Right click on the editor 123 * and choose {@code Command Palette}. Then search for {@code Developer: Inspect Tokens}. 124 * @return This same instance, useful for chaining multiple setter methods in one call. 125 */ 126 public EditorTokenThemeRule setToken(final String token) { 127 put("token", token); 128 return this; 129 } 130 131 /** 132 * @return This options object as a serializable JSON object 133 */ 134 JSONObject getJSONObject() { 135 return this; 136 } 137 }