001package Torello.Browser.JavaScriptAPI; 002 003// *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** 004// Java-HTML Imports 005// *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** 006 007import Torello.Browser.*; 008import Torello.Browser.helper.*; 009import Torello.Browser.BrowserAPI.*; 010import Torello.JSON.*; 011 012import Torello.Java.ReadOnly.ReadOnlyList; 013import Torello.Java.ReadOnly.ReadOnlyArrayList; 014 015import Torello.JavaDoc.Annotations.StaticFunctional; 016import Torello.JavaDoc.Annotations.JDHeaderBackgroundImg; 017 018 019// *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** 020// JDK Imports 021// *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** 022 023import javax.json.JsonObject; 024import javax.json.JsonValue; 025 026/** 027 * <SPAN CLASS=COPIEDJDK><B>This domain is deprecated - use RunTime or Log instead.</B></SPAN> 028 * <EMBED CLASS='external-html' DATA-FILE-ID=CDP.CODE_GEN_NOTE> 029 */ 030@StaticFunctional@JDHeaderBackgroundImg(EmbedTagFileID="CDP.WOOD_PLANK_NOTE") 031public class Console 032{ 033 // No Pubic Constructors 034 private Console() { } 035 036 037 038 // ******************************************************************************************** 039 // ******************************************************************************************** 040 // Basic Types 041 // ******************************************************************************************** 042 // ******************************************************************************************** 043 044 045 /** 046 * Console message. 047 * 048 * <EMBED CLASS=globalDefs DATA-DOMAIN=Console DATA-API=JavaScriptAPI> 049 */ 050 @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_TYPE_JDHBI") 051 public static class ConsoleMessage 052 extends BaseType<ConsoleMessage> 053 implements java.io.Serializable 054 { 055 /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */ 056 protected static final long serialVersionUID = 1; 057 058 private static final NestedHelper<Console.ConsoleMessage> singleton = 059 Torello.Browser.JavaScriptAPI.NestedHelpers.Types. 060 Console$$ConsoleMessage$$.singleton; 061 062 /** 063 * Message source. 064 * <EMBED CLASS='external-html' DATA-D=Console DATA-C=ConsoleMessage DATA-F=source DATA-FILE-ID=CDP.EL1> 065 * @see BaseType#enumStrList(String) 066 */ 067 public final String source; 068 069 /** 070 * Message severity. 071 * <EMBED CLASS='external-html' DATA-D=Console DATA-C=ConsoleMessage DATA-F=level DATA-FILE-ID=CDP.EL1> 072 * @see BaseType#enumStrList(String) 073 */ 074 public final String level; 075 076 /** Message text. */ 077 public final String text; 078 079 /** 080 * URL of the message origin. 081 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 082 */ 083 public final String url; 084 085 /** 086 * Line number in the resource that generated this message (1-based). 087 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 088 */ 089 public final Integer line; 090 091 /** 092 * Column number in the resource that generated this message (1-based). 093 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 094 */ 095 public final Integer column; 096 097 /** Constructor. Please review this class' fields for documentation. */ 098 public ConsoleMessage( 099 ReadOnlyList<Boolean> isPresent, String source, String level, String text, 100 String url, Integer line, Integer column 101 ) 102 { 103 super(singleton, Domains.Console, "ConsoleMessage", 6); 104 105 this.source = source; 106 this.level = level; 107 this.text = text; 108 this.url = url; 109 this.line = line; 110 this.column = column; 111 112 this.isPresent = (isPresent == null) 113 ? singleton.generateIsPresentList(this) 114 : THROWS.check(isPresent, 6, "Console.ConsoleMessage"); 115 } 116 117 /** Creates an instance of this class from a {@link JsonObject}.*/ 118 public static ConsoleMessage fromJSON(JsonObject jo) 119 { return singleton.fromJSON(jo); } 120 121 /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/ 122 public static NestedDescriptor<ConsoleMessage> descriptor() 123 { return singleton.descriptor(); } 124 } 125 126 127 // ******************************************************************************************** 128 // ******************************************************************************************** 129 // Event Types 130 // ******************************************************************************************** 131 // ******************************************************************************************** 132 133 134 /** 135 * Issued when new console message is added. 136 * 137 * <EMBED CLASS=globalDefs DATA-DOMAIN=Console DATA-API=JavaScriptAPI> 138 */ 139 @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_EVENT_JDHBI") 140 public static class messageAdded 141 extends BrowserEvent<messageAdded> 142 implements java.io.Serializable 143 { 144 /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */ 145 protected static final long serialVersionUID = 1; 146 147 private static final NestedHelper<Console.messageAdded> singleton = 148 Torello.Browser.JavaScriptAPI.NestedHelpers.Events. 149 Console$$messageAdded$$.singleton; 150 151 /** Console message that has been added. */ 152 public final Console.ConsoleMessage message; 153 154 /** Constructor. Please review this class' fields for documentation. */ 155 public messageAdded(ReadOnlyList<Boolean> isPresent, ConsoleMessage message) 156 { 157 super(singleton, Domains.Console, "messageAdded", 1); 158 159 this.message = message; 160 161 this.isPresent = (isPresent == null) 162 ? singleton.generateIsPresentList(this) 163 : THROWS.check(isPresent, 1, "Console.messageAdded"); 164 } 165 166 /** Creates an instance of this class from a {@link JsonObject}.*/ 167 public static messageAdded fromJSON(JsonObject jo) 168 { return singleton.fromJSON(jo); } 169 170 /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/ 171 public static NestedDescriptor<messageAdded> descriptor() 172 { return singleton.descriptor(); } 173 } 174 175 176 177 178 // ******************************************************************************************** 179 // ******************************************************************************************** 180 // Commands 181 // ******************************************************************************************** 182 // ******************************************************************************************** 183 184 185 /** 186 * Does nothing. 187 * 188 * @return An instance of <CODE>{@link Script}<Void></CODE> 189 * 190 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 191 * browser receives the invocation-request. 192 * 193 * <BR /><BR /><DIV CLASS=JDHint> 194 * This Browser-Function <I>does not have</I> a return-value. You may choose to 195 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that 196 * the Browser Function has run to completion. 197 * </DIV> 198 */ 199 public static Script<Void> clearMessages() 200 { 201 // Ultra-Simple Request JSON - Because this method has no parameters 202 final String requestJSON = "{\"method\":\"Console.clearMessages\"}"; 203 204 return Script.NO_RET(Domains.Console, "clearMessages", requestJSON); 205 } 206 207 /** 208 * Disables console domain, prevents further console messages from being reported to the client. 209 * 210 * @return An instance of <CODE>{@link Script}<Void></CODE> 211 * 212 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 213 * browser receives the invocation-request. 214 * 215 * <BR /><BR /><DIV CLASS=JDHint> 216 * This Browser-Function <I>does not have</I> a return-value. You may choose to 217 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that 218 * the Browser Function has run to completion. 219 * </DIV> 220 */ 221 public static Script<Void> disable() 222 { 223 // Ultra-Simple Request JSON - Because this method has no parameters 224 final String requestJSON = "{\"method\":\"Console.disable\"}"; 225 226 return Script.NO_RET(Domains.Console, "disable", requestJSON); 227 } 228 229 /** 230 * Enables console domain, sends the messages collected so far to the client by means of the 231 * <CODE>messageAdded</CODE> notification. 232 * 233 * @return An instance of <CODE>{@link Script}<Void></CODE> 234 * 235 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 236 * browser receives the invocation-request. 237 * 238 * <BR /><BR /><DIV CLASS=JDHint> 239 * This Browser-Function <I>does not have</I> a return-value. You may choose to 240 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that 241 * the Browser Function has run to completion. 242 * </DIV> 243 */ 244 public static Script<Void> enable() 245 { 246 // Ultra-Simple Request JSON - Because this method has no parameters 247 final String requestJSON = "{\"method\":\"Console.enable\"}"; 248 249 return Script.NO_RET(Domains.Console, "enable", requestJSON); 250 } 251 252 253}