annotate Agendas/trunk/src/Agendas.Web/Scripts/MicrosoftAjax.debug.js @ 89:24e9488ac152

mapeo de property UrlInvitacion entre viewmodel y entity
author jorge.rowies
date Tue, 31 May 2011 16:31:24 -0300
parents c62b77fc33f4
children
rev   line source
10
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1 // Name: MicrosoftAjax.debug.js
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2 // Assembly: System.Web.Extensions
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3 // Version: 4.0.0.0
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4 // FileVersion: 4.0.20526.0
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5 //-----------------------------------------------------------------------
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6 // Copyright (C) Microsoft Corporation. All rights reserved.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7 //-----------------------------------------------------------------------
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8 // MicrosoftAjax.js
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
9 // Microsoft AJAX Framework.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
10
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
11 Function.__typeName = 'Function';
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
12 Function.__class = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
13 Function.createCallback = function Function$createCallback(method, context) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
14 /// <summary locid="M:J#Function.createCallback" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
15 /// <param name="method" type="Function"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
16 /// <param name="context" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
17 /// <returns type="Function"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
18 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
19 {name: "method", type: Function},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
20 {name: "context", mayBeNull: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
21 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
22 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
23 return function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
24 var l = arguments.length;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
25 if (l > 0) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
26 var args = [];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
27 for (var i = 0; i < l; i++) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
28 args[i] = arguments[i];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
29 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
30 args[l] = context;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
31 return method.apply(this, args);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
32 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
33 return method.call(this, context);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
34 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
35 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
36 Function.createDelegate = function Function$createDelegate(instance, method) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
37 /// <summary locid="M:J#Function.createDelegate" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
38 /// <param name="instance" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
39 /// <param name="method" type="Function"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
40 /// <returns type="Function"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
41 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
42 {name: "instance", mayBeNull: true},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
43 {name: "method", type: Function}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
44 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
45 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
46 return function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
47 return method.apply(instance, arguments);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
48 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
49 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
50 Function.emptyFunction = Function.emptyMethod = function Function$emptyMethod() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
51 /// <summary locid="M:J#Function.emptyMethod" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
52 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
53 Function.validateParameters = function Function$validateParameters(parameters, expectedParameters, validateParameterCount) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
54 /// <summary locid="M:J#Function.validateParameters" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
55 /// <param name="parameters"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
56 /// <param name="expectedParameters"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
57 /// <param name="validateParameterCount" type="Boolean" optional="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
58 /// <returns type="Error" mayBeNull="true"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
59 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
60 {name: "parameters"},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
61 {name: "expectedParameters"},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
62 {name: "validateParameterCount", type: Boolean, optional: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
63 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
64 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
65 return Function._validateParams(parameters, expectedParameters, validateParameterCount);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
66 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
67 Function._validateParams = function Function$_validateParams(params, expectedParams, validateParameterCount) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
68 var e, expectedLength = expectedParams.length;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
69 validateParameterCount = validateParameterCount || (typeof(validateParameterCount) === "undefined");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
70 e = Function._validateParameterCount(params, expectedParams, validateParameterCount);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
71 if (e) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
72 e.popStackFrame();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
73 return e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
74 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
75 for (var i = 0, l = params.length; i < l; i++) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
76 var expectedParam = expectedParams[Math.min(i, expectedLength - 1)],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
77 paramName = expectedParam.name;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
78 if (expectedParam.parameterArray) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
79 paramName += "[" + (i - expectedLength + 1) + "]";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
80 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
81 else if (!validateParameterCount && (i >= expectedLength)) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
82 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
83 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
84 e = Function._validateParameter(params[i], expectedParam, paramName);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
85 if (e) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
86 e.popStackFrame();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
87 return e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
88 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
89 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
90 return null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
91 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
92 Function._validateParameterCount = function Function$_validateParameterCount(params, expectedParams, validateParameterCount) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
93 var i, error,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
94 expectedLen = expectedParams.length,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
95 actualLen = params.length;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
96 if (actualLen < expectedLen) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
97 var minParams = expectedLen;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
98 for (i = 0; i < expectedLen; i++) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
99 var param = expectedParams[i];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
100 if (param.optional || param.parameterArray) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
101 minParams--;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
102 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
103 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
104 if (actualLen < minParams) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
105 error = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
106 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
107 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
108 else if (validateParameterCount && (actualLen > expectedLen)) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
109 error = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
110 for (i = 0; i < expectedLen; i++) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
111 if (expectedParams[i].parameterArray) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
112 error = false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
113 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
114 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
115 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
116 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
117 if (error) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
118 var e = Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
119 e.popStackFrame();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
120 return e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
121 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
122 return null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
123 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
124 Function._validateParameter = function Function$_validateParameter(param, expectedParam, paramName) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
125 var e,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
126 expectedType = expectedParam.type,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
127 expectedInteger = !!expectedParam.integer,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
128 expectedDomElement = !!expectedParam.domElement,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
129 mayBeNull = !!expectedParam.mayBeNull;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
130 e = Function._validateParameterType(param, expectedType, expectedInteger, expectedDomElement, mayBeNull, paramName);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
131 if (e) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
132 e.popStackFrame();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
133 return e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
134 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
135 var expectedElementType = expectedParam.elementType,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
136 elementMayBeNull = !!expectedParam.elementMayBeNull;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
137 if (expectedType === Array && typeof(param) !== "undefined" && param !== null &&
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
138 (expectedElementType || !elementMayBeNull)) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
139 var expectedElementInteger = !!expectedParam.elementInteger,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
140 expectedElementDomElement = !!expectedParam.elementDomElement;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
141 for (var i=0; i < param.length; i++) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
142 var elem = param[i];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
143 e = Function._validateParameterType(elem, expectedElementType,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
144 expectedElementInteger, expectedElementDomElement, elementMayBeNull,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
145 paramName + "[" + i + "]");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
146 if (e) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
147 e.popStackFrame();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
148 return e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
149 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
150 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
151 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
152 return null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
153 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
154 Function._validateParameterType = function Function$_validateParameterType(param, expectedType, expectedInteger, expectedDomElement, mayBeNull, paramName) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
155 var e, i;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
156 if (typeof(param) === "undefined") {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
157 if (mayBeNull) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
158 return null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
159 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
160 else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
161 e = Error.argumentUndefined(paramName);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
162 e.popStackFrame();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
163 return e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
164 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
165 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
166 if (param === null) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
167 if (mayBeNull) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
168 return null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
169 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
170 else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
171 e = Error.argumentNull(paramName);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
172 e.popStackFrame();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
173 return e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
174 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
175 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
176 if (expectedType && expectedType.__enum) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
177 if (typeof(param) !== 'number') {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
178 e = Error.argumentType(paramName, Object.getType(param), expectedType);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
179 e.popStackFrame();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
180 return e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
181 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
182 if ((param % 1) === 0) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
183 var values = expectedType.prototype;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
184 if (!expectedType.__flags || (param === 0)) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
185 for (i in values) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
186 if (values[i] === param) return null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
187 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
188 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
189 else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
190 var v = param;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
191 for (i in values) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
192 var vali = values[i];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
193 if (vali === 0) continue;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
194 if ((vali & param) === vali) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
195 v -= vali;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
196 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
197 if (v === 0) return null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
198 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
199 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
200 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
201 e = Error.argumentOutOfRange(paramName, param, String.format(Sys.Res.enumInvalidValue, param, expectedType.getName()));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
202 e.popStackFrame();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
203 return e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
204 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
205 if (expectedDomElement && (!Sys._isDomElement(param) || (param.nodeType === 3))) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
206 e = Error.argument(paramName, Sys.Res.argumentDomElement);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
207 e.popStackFrame();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
208 return e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
209 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
210 if (expectedType && !Sys._isInstanceOfType(expectedType, param)) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
211 e = Error.argumentType(paramName, Object.getType(param), expectedType);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
212 e.popStackFrame();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
213 return e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
214 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
215 if (expectedType === Number && expectedInteger) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
216 if ((param % 1) !== 0) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
217 e = Error.argumentOutOfRange(paramName, param, Sys.Res.argumentInteger);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
218 e.popStackFrame();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
219 return e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
220 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
221 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
222 return null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
223 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
224
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
225 Error.__typeName = 'Error';
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
226 Error.__class = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
227 Error.create = function Error$create(message, errorInfo) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
228 /// <summary locid="M:J#Error.create" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
229 /// <param name="message" type="String" optional="true" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
230 /// <param name="errorInfo" optional="true" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
231 /// <returns type="Error"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
232 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
233 {name: "message", type: String, mayBeNull: true, optional: true},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
234 {name: "errorInfo", mayBeNull: true, optional: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
235 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
236 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
237 var err = new Error(message);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
238 err.message = message;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
239 if (errorInfo) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
240 for (var v in errorInfo) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
241 err[v] = errorInfo[v];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
242 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
243 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
244 err.popStackFrame();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
245 return err;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
246 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
247 Error.argument = function Error$argument(paramName, message) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
248 /// <summary locid="M:J#Error.argument" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
249 /// <param name="paramName" type="String" optional="true" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
250 /// <param name="message" type="String" optional="true" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
251 /// <returns></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
252 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
253 {name: "paramName", type: String, mayBeNull: true, optional: true},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
254 {name: "message", type: String, mayBeNull: true, optional: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
255 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
256 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
257 var displayMessage = "Sys.ArgumentException: " + (message ? message : Sys.Res.argument);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
258 if (paramName) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
259 displayMessage += "\n" + String.format(Sys.Res.paramName, paramName);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
260 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
261 var err = Error.create(displayMessage, { name: "Sys.ArgumentException", paramName: paramName });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
262 err.popStackFrame();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
263 return err;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
264 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
265 Error.argumentNull = function Error$argumentNull(paramName, message) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
266 /// <summary locid="M:J#Error.argumentNull" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
267 /// <param name="paramName" type="String" optional="true" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
268 /// <param name="message" type="String" optional="true" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
269 /// <returns></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
270 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
271 {name: "paramName", type: String, mayBeNull: true, optional: true},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
272 {name: "message", type: String, mayBeNull: true, optional: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
273 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
274 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
275 var displayMessage = "Sys.ArgumentNullException: " + (message ? message : Sys.Res.argumentNull);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
276 if (paramName) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
277 displayMessage += "\n" + String.format(Sys.Res.paramName, paramName);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
278 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
279 var err = Error.create(displayMessage, { name: "Sys.ArgumentNullException", paramName: paramName });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
280 err.popStackFrame();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
281 return err;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
282 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
283 Error.argumentOutOfRange = function Error$argumentOutOfRange(paramName, actualValue, message) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
284 /// <summary locid="M:J#Error.argumentOutOfRange" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
285 /// <param name="paramName" type="String" optional="true" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
286 /// <param name="actualValue" optional="true" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
287 /// <param name="message" type="String" optional="true" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
288 /// <returns></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
289 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
290 {name: "paramName", type: String, mayBeNull: true, optional: true},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
291 {name: "actualValue", mayBeNull: true, optional: true},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
292 {name: "message", type: String, mayBeNull: true, optional: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
293 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
294 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
295 var displayMessage = "Sys.ArgumentOutOfRangeException: " + (message ? message : Sys.Res.argumentOutOfRange);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
296 if (paramName) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
297 displayMessage += "\n" + String.format(Sys.Res.paramName, paramName);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
298 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
299 if (typeof(actualValue) !== "undefined" && actualValue !== null) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
300 displayMessage += "\n" + String.format(Sys.Res.actualValue, actualValue);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
301 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
302 var err = Error.create(displayMessage, {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
303 name: "Sys.ArgumentOutOfRangeException",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
304 paramName: paramName,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
305 actualValue: actualValue
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
306 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
307 err.popStackFrame();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
308 return err;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
309 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
310 Error.argumentType = function Error$argumentType(paramName, actualType, expectedType, message) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
311 /// <summary locid="M:J#Error.argumentType" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
312 /// <param name="paramName" type="String" optional="true" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
313 /// <param name="actualType" type="Type" optional="true" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
314 /// <param name="expectedType" type="Type" optional="true" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
315 /// <param name="message" type="String" optional="true" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
316 /// <returns></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
317 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
318 {name: "paramName", type: String, mayBeNull: true, optional: true},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
319 {name: "actualType", type: Type, mayBeNull: true, optional: true},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
320 {name: "expectedType", type: Type, mayBeNull: true, optional: true},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
321 {name: "message", type: String, mayBeNull: true, optional: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
322 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
323 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
324 var displayMessage = "Sys.ArgumentTypeException: ";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
325 if (message) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
326 displayMessage += message;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
327 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
328 else if (actualType && expectedType) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
329 displayMessage +=
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
330 String.format(Sys.Res.argumentTypeWithTypes, actualType.getName(), expectedType.getName());
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
331 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
332 else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
333 displayMessage += Sys.Res.argumentType;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
334 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
335 if (paramName) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
336 displayMessage += "\n" + String.format(Sys.Res.paramName, paramName);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
337 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
338 var err = Error.create(displayMessage, {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
339 name: "Sys.ArgumentTypeException",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
340 paramName: paramName,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
341 actualType: actualType,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
342 expectedType: expectedType
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
343 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
344 err.popStackFrame();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
345 return err;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
346 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
347 Error.argumentUndefined = function Error$argumentUndefined(paramName, message) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
348 /// <summary locid="M:J#Error.argumentUndefined" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
349 /// <param name="paramName" type="String" optional="true" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
350 /// <param name="message" type="String" optional="true" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
351 /// <returns></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
352 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
353 {name: "paramName", type: String, mayBeNull: true, optional: true},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
354 {name: "message", type: String, mayBeNull: true, optional: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
355 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
356 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
357 var displayMessage = "Sys.ArgumentUndefinedException: " + (message ? message : Sys.Res.argumentUndefined);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
358 if (paramName) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
359 displayMessage += "\n" + String.format(Sys.Res.paramName, paramName);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
360 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
361 var err = Error.create(displayMessage, { name: "Sys.ArgumentUndefinedException", paramName: paramName });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
362 err.popStackFrame();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
363 return err;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
364 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
365 Error.format = function Error$format(message) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
366 /// <summary locid="M:J#Error.format" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
367 /// <param name="message" type="String" optional="true" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
368 /// <returns></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
369 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
370 {name: "message", type: String, mayBeNull: true, optional: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
371 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
372 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
373 var displayMessage = "Sys.FormatException: " + (message ? message : Sys.Res.format);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
374 var err = Error.create(displayMessage, {name: 'Sys.FormatException'});
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
375 err.popStackFrame();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
376 return err;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
377 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
378 Error.invalidOperation = function Error$invalidOperation(message) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
379 /// <summary locid="M:J#Error.invalidOperation" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
380 /// <param name="message" type="String" optional="true" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
381 /// <returns></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
382 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
383 {name: "message", type: String, mayBeNull: true, optional: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
384 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
385 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
386 var displayMessage = "Sys.InvalidOperationException: " + (message ? message : Sys.Res.invalidOperation);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
387 var err = Error.create(displayMessage, {name: 'Sys.InvalidOperationException'});
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
388 err.popStackFrame();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
389 return err;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
390 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
391 Error.notImplemented = function Error$notImplemented(message) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
392 /// <summary locid="M:J#Error.notImplemented" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
393 /// <param name="message" type="String" optional="true" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
394 /// <returns></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
395 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
396 {name: "message", type: String, mayBeNull: true, optional: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
397 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
398 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
399 var displayMessage = "Sys.NotImplementedException: " + (message ? message : Sys.Res.notImplemented);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
400 var err = Error.create(displayMessage, {name: 'Sys.NotImplementedException'});
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
401 err.popStackFrame();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
402 return err;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
403 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
404 Error.parameterCount = function Error$parameterCount(message) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
405 /// <summary locid="M:J#Error.parameterCount" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
406 /// <param name="message" type="String" optional="true" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
407 /// <returns></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
408 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
409 {name: "message", type: String, mayBeNull: true, optional: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
410 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
411 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
412 var displayMessage = "Sys.ParameterCountException: " + (message ? message : Sys.Res.parameterCount);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
413 var err = Error.create(displayMessage, {name: 'Sys.ParameterCountException'});
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
414 err.popStackFrame();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
415 return err;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
416 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
417 Error.prototype.popStackFrame = function Error$popStackFrame() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
418 /// <summary locid="M:J#checkParam" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
419 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
420 if (typeof(this.stack) === "undefined" || this.stack === null ||
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
421 typeof(this.fileName) === "undefined" || this.fileName === null ||
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
422 typeof(this.lineNumber) === "undefined" || this.lineNumber === null) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
423 return;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
424 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
425 var stackFrames = this.stack.split("\n");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
426 var currentFrame = stackFrames[0];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
427 var pattern = this.fileName + ":" + this.lineNumber;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
428 while(typeof(currentFrame) !== "undefined" &&
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
429 currentFrame !== null &&
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
430 currentFrame.indexOf(pattern) === -1) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
431 stackFrames.shift();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
432 currentFrame = stackFrames[0];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
433 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
434 var nextFrame = stackFrames[1];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
435 if (typeof(nextFrame) === "undefined" || nextFrame === null) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
436 return;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
437 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
438 var nextFrameParts = nextFrame.match(/@(.*):(\d+)$/);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
439 if (typeof(nextFrameParts) === "undefined" || nextFrameParts === null) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
440 return;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
441 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
442 this.fileName = nextFrameParts[1];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
443 this.lineNumber = parseInt(nextFrameParts[2]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
444 stackFrames.shift();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
445 this.stack = stackFrames.join("\n");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
446 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
447
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
448 Object.__typeName = 'Object';
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
449 Object.__class = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
450 Object.getType = function Object$getType(instance) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
451 /// <summary locid="M:J#Object.getType" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
452 /// <param name="instance"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
453 /// <returns type="Type"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
454 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
455 {name: "instance"}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
456 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
457 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
458 var ctor = instance.constructor;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
459 if (!ctor || (typeof(ctor) !== "function") || !ctor.__typeName || (ctor.__typeName === 'Object')) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
460 return Object;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
461 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
462 return ctor;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
463 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
464 Object.getTypeName = function Object$getTypeName(instance) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
465 /// <summary locid="M:J#Object.getTypeName" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
466 /// <param name="instance"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
467 /// <returns type="String"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
468 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
469 {name: "instance"}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
470 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
471 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
472 return Object.getType(instance).getName();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
473 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
474
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
475 String.__typeName = 'String';
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
476 String.__class = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
477 String.prototype.endsWith = function String$endsWith(suffix) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
478 /// <summary locid="M:J#String.endsWith" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
479 /// <param name="suffix" type="String"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
480 /// <returns type="Boolean"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
481 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
482 {name: "suffix", type: String}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
483 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
484 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
485 return (this.substr(this.length - suffix.length) === suffix);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
486 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
487 String.prototype.startsWith = function String$startsWith(prefix) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
488 /// <summary locid="M:J#String.startsWith" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
489 /// <param name="prefix" type="String"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
490 /// <returns type="Boolean"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
491 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
492 {name: "prefix", type: String}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
493 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
494 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
495 return (this.substr(0, prefix.length) === prefix);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
496 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
497 String.prototype.trim = function String$trim() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
498 /// <summary locid="M:J#String.trim" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
499 /// <returns type="String"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
500 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
501 return this.replace(/^\s+|\s+$/g, '');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
502 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
503 String.prototype.trimEnd = function String$trimEnd() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
504 /// <summary locid="M:J#String.trimEnd" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
505 /// <returns type="String"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
506 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
507 return this.replace(/\s+$/, '');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
508 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
509 String.prototype.trimStart = function String$trimStart() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
510 /// <summary locid="M:J#String.trimStart" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
511 /// <returns type="String"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
512 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
513 return this.replace(/^\s+/, '');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
514 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
515 String.format = function String$format(format, args) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
516 /// <summary locid="M:J#String.format" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
517 /// <param name="format" type="String"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
518 /// <param name="args" parameterArray="true" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
519 /// <returns type="String"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
520 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
521 {name: "format", type: String},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
522 {name: "args", mayBeNull: true, parameterArray: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
523 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
524 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
525 return String._toFormattedString(false, arguments);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
526 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
527 String._toFormattedString = function String$_toFormattedString(useLocale, args) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
528 var result = '';
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
529 var format = args[0];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
530 for (var i=0;;) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
531 var open = format.indexOf('{', i);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
532 var close = format.indexOf('}', i);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
533 if ((open < 0) && (close < 0)) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
534 result += format.slice(i);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
535 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
536 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
537 if ((close > 0) && ((close < open) || (open < 0))) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
538 if (format.charAt(close + 1) !== '}') {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
539 throw Error.argument('format', Sys.Res.stringFormatBraceMismatch);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
540 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
541 result += format.slice(i, close + 1);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
542 i = close + 2;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
543 continue;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
544 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
545 result += format.slice(i, open);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
546 i = open + 1;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
547 if (format.charAt(i) === '{') {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
548 result += '{';
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
549 i++;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
550 continue;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
551 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
552 if (close < 0) throw Error.argument('format', Sys.Res.stringFormatBraceMismatch);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
553 var brace = format.substring(i, close);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
554 var colonIndex = brace.indexOf(':');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
555 var argNumber = parseInt((colonIndex < 0)? brace : brace.substring(0, colonIndex), 10) + 1;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
556 if (isNaN(argNumber)) throw Error.argument('format', Sys.Res.stringFormatInvalid);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
557 var argFormat = (colonIndex < 0)? '' : brace.substring(colonIndex + 1);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
558 var arg = args[argNumber];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
559 if (typeof(arg) === "undefined" || arg === null) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
560 arg = '';
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
561 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
562 if (arg.toFormattedString) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
563 result += arg.toFormattedString(argFormat);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
564 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
565 else if (useLocale && arg.localeFormat) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
566 result += arg.localeFormat(argFormat);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
567 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
568 else if (arg.format) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
569 result += arg.format(argFormat);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
570 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
571 else
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
572 result += arg.toString();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
573 i = close + 1;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
574 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
575 return result;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
576 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
577
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
578 Boolean.__typeName = 'Boolean';
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
579 Boolean.__class = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
580 Boolean.parse = function Boolean$parse(value) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
581 /// <summary locid="M:J#Boolean.parse" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
582 /// <param name="value" type="String"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
583 /// <returns type="Boolean"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
584 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
585 {name: "value", type: String}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
586 ], false);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
587 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
588 var v = value.trim().toLowerCase();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
589 if (v === 'false') return false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
590 if (v === 'true') return true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
591 throw Error.argumentOutOfRange('value', value, Sys.Res.boolTrueOrFalse);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
592 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
593
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
594 Date.__typeName = 'Date';
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
595 Date.__class = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
596
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
597 Number.__typeName = 'Number';
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
598 Number.__class = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
599
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
600 RegExp.__typeName = 'RegExp';
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
601 RegExp.__class = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
602
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
603 if (!window) this.window = this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
604 window.Type = Function;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
605 Type.__fullyQualifiedIdentifierRegExp = new RegExp("^[^.0-9 \\s|,;:&*=+\\-()\\[\\]{}^%#@!~\\n\\r\\t\\f\\\\]([^ \\s|,;:&*=+\\-()\\[\\]{}^%#@!~\\n\\r\\t\\f\\\\]*[^. \\s|,;:&*=+\\-()\\[\\]{}^%#@!~\\n\\r\\t\\f\\\\])?$", "i");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
606 Type.__identifierRegExp = new RegExp("^[^.0-9 \\s|,;:&*=+\\-()\\[\\]{}^%#@!~\\n\\r\\t\\f\\\\][^. \\s|,;:&*=+\\-()\\[\\]{}^%#@!~\\n\\r\\t\\f\\\\]*$", "i");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
607 Type.prototype.callBaseMethod = function Type$callBaseMethod(instance, name, baseArguments) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
608 /// <summary locid="M:J#Type.callBaseMethod" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
609 /// <param name="instance"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
610 /// <param name="name" type="String"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
611 /// <param name="baseArguments" type="Array" optional="true" mayBeNull="true" elementMayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
612 /// <returns></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
613 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
614 {name: "instance"},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
615 {name: "name", type: String},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
616 {name: "baseArguments", type: Array, mayBeNull: true, optional: true, elementMayBeNull: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
617 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
618 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
619 var baseMethod = Sys._getBaseMethod(this, instance, name);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
620 if (!baseMethod) throw Error.invalidOperation(String.format(Sys.Res.methodNotFound, name));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
621 if (!baseArguments) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
622 return baseMethod.apply(instance);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
623 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
624 else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
625 return baseMethod.apply(instance, baseArguments);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
626 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
627 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
628 Type.prototype.getBaseMethod = function Type$getBaseMethod(instance, name) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
629 /// <summary locid="M:J#Type.getBaseMethod" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
630 /// <param name="instance"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
631 /// <param name="name" type="String"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
632 /// <returns type="Function" mayBeNull="true"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
633 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
634 {name: "instance"},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
635 {name: "name", type: String}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
636 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
637 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
638 return Sys._getBaseMethod(this, instance, name);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
639 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
640 Type.prototype.getBaseType = function Type$getBaseType() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
641 /// <summary locid="M:J#Type.getBaseType" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
642 /// <returns type="Type" mayBeNull="true"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
643 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
644 return (typeof(this.__baseType) === "undefined") ? null : this.__baseType;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
645 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
646 Type.prototype.getInterfaces = function Type$getInterfaces() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
647 /// <summary locid="M:J#Type.getInterfaces" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
648 /// <returns type="Array" elementType="Type" mayBeNull="false" elementMayBeNull="false"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
649 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
650 var result = [];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
651 var type = this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
652 while(type) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
653 var interfaces = type.__interfaces;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
654 if (interfaces) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
655 for (var i = 0, l = interfaces.length; i < l; i++) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
656 var interfaceType = interfaces[i];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
657 if (!Array.contains(result, interfaceType)) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
658 result[result.length] = interfaceType;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
659 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
660 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
661 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
662 type = type.__baseType;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
663 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
664 return result;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
665 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
666 Type.prototype.getName = function Type$getName() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
667 /// <summary locid="M:J#Type.getName" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
668 /// <returns type="String"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
669 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
670 return (typeof(this.__typeName) === "undefined") ? "" : this.__typeName;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
671 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
672 Type.prototype.implementsInterface = function Type$implementsInterface(interfaceType) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
673 /// <summary locid="M:J#Type.implementsInterface" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
674 /// <param name="interfaceType" type="Type"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
675 /// <returns type="Boolean"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
676 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
677 {name: "interfaceType", type: Type}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
678 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
679 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
680 this.resolveInheritance();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
681 var interfaceName = interfaceType.getName();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
682 var cache = this.__interfaceCache;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
683 if (cache) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
684 var cacheEntry = cache[interfaceName];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
685 if (typeof(cacheEntry) !== 'undefined') return cacheEntry;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
686 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
687 else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
688 cache = this.__interfaceCache = {};
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
689 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
690 var baseType = this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
691 while (baseType) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
692 var interfaces = baseType.__interfaces;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
693 if (interfaces) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
694 if (Array.indexOf(interfaces, interfaceType) !== -1) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
695 return cache[interfaceName] = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
696 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
697 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
698 baseType = baseType.__baseType;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
699 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
700 return cache[interfaceName] = false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
701 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
702 Type.prototype.inheritsFrom = function Type$inheritsFrom(parentType) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
703 /// <summary locid="M:J#Type.inheritsFrom" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
704 /// <param name="parentType" type="Type"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
705 /// <returns type="Boolean"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
706 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
707 {name: "parentType", type: Type}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
708 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
709 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
710 this.resolveInheritance();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
711 var baseType = this.__baseType;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
712 while (baseType) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
713 if (baseType === parentType) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
714 return true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
715 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
716 baseType = baseType.__baseType;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
717 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
718 return false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
719 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
720 Type.prototype.initializeBase = function Type$initializeBase(instance, baseArguments) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
721 /// <summary locid="M:J#Type.initializeBase" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
722 /// <param name="instance"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
723 /// <param name="baseArguments" type="Array" optional="true" mayBeNull="true" elementMayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
724 /// <returns></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
725 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
726 {name: "instance"},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
727 {name: "baseArguments", type: Array, mayBeNull: true, optional: true, elementMayBeNull: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
728 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
729 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
730 if (!Sys._isInstanceOfType(this, instance)) throw Error.argumentType('instance', Object.getType(instance), this);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
731 this.resolveInheritance();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
732 if (this.__baseType) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
733 if (!baseArguments) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
734 this.__baseType.apply(instance);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
735 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
736 else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
737 this.__baseType.apply(instance, baseArguments);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
738 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
739 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
740 return instance;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
741 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
742 Type.prototype.isImplementedBy = function Type$isImplementedBy(instance) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
743 /// <summary locid="M:J#Type.isImplementedBy" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
744 /// <param name="instance" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
745 /// <returns type="Boolean"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
746 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
747 {name: "instance", mayBeNull: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
748 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
749 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
750 if (typeof(instance) === "undefined" || instance === null) return false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
751 var instanceType = Object.getType(instance);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
752 return !!(instanceType.implementsInterface && instanceType.implementsInterface(this));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
753 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
754 Type.prototype.isInstanceOfType = function Type$isInstanceOfType(instance) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
755 /// <summary locid="M:J#Type.isInstanceOfType" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
756 /// <param name="instance" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
757 /// <returns type="Boolean"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
758 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
759 {name: "instance", mayBeNull: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
760 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
761 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
762 return Sys._isInstanceOfType(this, instance);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
763 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
764 Type.prototype.registerClass = function Type$registerClass(typeName, baseType, interfaceTypes) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
765 /// <summary locid="M:J#Type.registerClass" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
766 /// <param name="typeName" type="String"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
767 /// <param name="baseType" type="Type" optional="true" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
768 /// <param name="interfaceTypes" parameterArray="true" type="Type"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
769 /// <returns type="Type"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
770 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
771 {name: "typeName", type: String},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
772 {name: "baseType", type: Type, mayBeNull: true, optional: true},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
773 {name: "interfaceTypes", type: Type, parameterArray: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
774 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
775 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
776 if (!Type.__fullyQualifiedIdentifierRegExp.test(typeName)) throw Error.argument('typeName', Sys.Res.notATypeName);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
777 var parsedName;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
778 try {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
779 parsedName = eval(typeName);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
780 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
781 catch(e) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
782 throw Error.argument('typeName', Sys.Res.argumentTypeName);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
783 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
784 if (parsedName !== this) throw Error.argument('typeName', Sys.Res.badTypeName);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
785 if (Sys.__registeredTypes[typeName]) throw Error.invalidOperation(String.format(Sys.Res.typeRegisteredTwice, typeName));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
786 if ((arguments.length > 1) && (typeof(baseType) === 'undefined')) throw Error.argumentUndefined('baseType');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
787 if (baseType && !baseType.__class) throw Error.argument('baseType', Sys.Res.baseNotAClass);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
788 this.prototype.constructor = this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
789 this.__typeName = typeName;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
790 this.__class = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
791 if (baseType) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
792 this.__baseType = baseType;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
793 this.__basePrototypePending = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
794 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
795 Sys.__upperCaseTypes[typeName.toUpperCase()] = this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
796 if (interfaceTypes) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
797 this.__interfaces = [];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
798 this.resolveInheritance();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
799 for (var i = 2, l = arguments.length; i < l; i++) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
800 var interfaceType = arguments[i];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
801 if (!interfaceType.__interface) throw Error.argument('interfaceTypes[' + (i - 2) + ']', Sys.Res.notAnInterface);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
802 for (var methodName in interfaceType.prototype) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
803 var method = interfaceType.prototype[methodName];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
804 if (!this.prototype[methodName]) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
805 this.prototype[methodName] = method;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
806 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
807 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
808 this.__interfaces.push(interfaceType);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
809 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
810 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
811 Sys.__registeredTypes[typeName] = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
812 return this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
813 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
814 Type.prototype.registerInterface = function Type$registerInterface(typeName) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
815 /// <summary locid="M:J#Type.registerInterface" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
816 /// <param name="typeName" type="String"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
817 /// <returns type="Type"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
818 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
819 {name: "typeName", type: String}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
820 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
821 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
822 if (!Type.__fullyQualifiedIdentifierRegExp.test(typeName)) throw Error.argument('typeName', Sys.Res.notATypeName);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
823 var parsedName;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
824 try {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
825 parsedName = eval(typeName);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
826 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
827 catch(e) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
828 throw Error.argument('typeName', Sys.Res.argumentTypeName);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
829 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
830 if (parsedName !== this) throw Error.argument('typeName', Sys.Res.badTypeName);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
831 if (Sys.__registeredTypes[typeName]) throw Error.invalidOperation(String.format(Sys.Res.typeRegisteredTwice, typeName));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
832 Sys.__upperCaseTypes[typeName.toUpperCase()] = this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
833 this.prototype.constructor = this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
834 this.__typeName = typeName;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
835 this.__interface = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
836 Sys.__registeredTypes[typeName] = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
837 return this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
838 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
839 Type.prototype.resolveInheritance = function Type$resolveInheritance() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
840 /// <summary locid="M:J#Type.resolveInheritance" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
841 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
842 if (this.__basePrototypePending) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
843 var baseType = this.__baseType;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
844 baseType.resolveInheritance();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
845 for (var memberName in baseType.prototype) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
846 var memberValue = baseType.prototype[memberName];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
847 if (!this.prototype[memberName]) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
848 this.prototype[memberName] = memberValue;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
849 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
850 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
851 delete this.__basePrototypePending;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
852 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
853 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
854 Type.getRootNamespaces = function Type$getRootNamespaces() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
855 /// <summary locid="M:J#Type.getRootNamespaces" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
856 /// <returns type="Array"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
857 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
858 return Array.clone(Sys.__rootNamespaces);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
859 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
860 Type.isClass = function Type$isClass(type) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
861 /// <summary locid="M:J#Type.isClass" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
862 /// <param name="type" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
863 /// <returns type="Boolean"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
864 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
865 {name: "type", mayBeNull: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
866 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
867 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
868 if ((typeof(type) === 'undefined') || (type === null)) return false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
869 return !!type.__class;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
870 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
871 Type.isInterface = function Type$isInterface(type) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
872 /// <summary locid="M:J#Type.isInterface" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
873 /// <param name="type" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
874 /// <returns type="Boolean"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
875 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
876 {name: "type", mayBeNull: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
877 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
878 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
879 if ((typeof(type) === 'undefined') || (type === null)) return false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
880 return !!type.__interface;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
881 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
882 Type.isNamespace = function Type$isNamespace(object) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
883 /// <summary locid="M:J#Type.isNamespace" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
884 /// <param name="object" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
885 /// <returns type="Boolean"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
886 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
887 {name: "object", mayBeNull: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
888 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
889 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
890 if ((typeof(object) === 'undefined') || (object === null)) return false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
891 return !!object.__namespace;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
892 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
893 Type.parse = function Type$parse(typeName, ns) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
894 /// <summary locid="M:J#Type.parse" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
895 /// <param name="typeName" type="String" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
896 /// <param name="ns" optional="true" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
897 /// <returns type="Type" mayBeNull="true"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
898 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
899 {name: "typeName", type: String, mayBeNull: true},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
900 {name: "ns", mayBeNull: true, optional: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
901 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
902 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
903 var fn;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
904 if (ns) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
905 fn = Sys.__upperCaseTypes[ns.getName().toUpperCase() + '.' + typeName.toUpperCase()];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
906 return fn || null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
907 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
908 if (!typeName) return null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
909 if (!Type.__htClasses) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
910 Type.__htClasses = {};
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
911 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
912 fn = Type.__htClasses[typeName];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
913 if (!fn) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
914 fn = eval(typeName);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
915 if (typeof(fn) !== 'function') throw Error.argument('typeName', Sys.Res.notATypeName);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
916 Type.__htClasses[typeName] = fn;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
917 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
918 return fn;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
919 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
920 Type.registerNamespace = function Type$registerNamespace(namespacePath) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
921 /// <summary locid="M:J#Type.registerNamespace" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
922 /// <param name="namespacePath" type="String"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
923 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
924 {name: "namespacePath", type: String}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
925 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
926 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
927 Type._registerNamespace(namespacePath);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
928 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
929 Type._registerNamespace = function Type$_registerNamespace(namespacePath) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
930 if (!Type.__fullyQualifiedIdentifierRegExp.test(namespacePath)) throw Error.argument('namespacePath', Sys.Res.invalidNameSpace);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
931 var rootObject = window;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
932 var namespaceParts = namespacePath.split('.');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
933 for (var i = 0; i < namespaceParts.length; i++) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
934 var currentPart = namespaceParts[i];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
935 var ns = rootObject[currentPart];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
936 var nsType = typeof(ns);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
937 if ((nsType !== "undefined") && (ns !== null)) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
938 if (nsType === "function") {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
939 throw Error.invalidOperation(String.format(Sys.Res.namespaceContainsClass, namespaceParts.splice(0, i + 1).join('.')));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
940 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
941 if ((typeof(ns) !== "object") || (ns instanceof Array)) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
942 throw Error.invalidOperation(String.format(Sys.Res.namespaceContainsNonObject, namespaceParts.splice(0, i + 1).join('.')));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
943 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
944 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
945 if (!ns) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
946 ns = rootObject[currentPart] = {};
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
947 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
948 if (!ns.__namespace) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
949 if ((i === 0) && (namespacePath !== "Sys")) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
950 Sys.__rootNamespaces[Sys.__rootNamespaces.length] = ns;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
951 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
952 ns.__namespace = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
953 ns.__typeName = namespaceParts.slice(0, i + 1).join('.');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
954 var parsedName;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
955 try {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
956 parsedName = eval(ns.__typeName);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
957 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
958 catch(e) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
959 parsedName = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
960 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
961 if (parsedName !== ns) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
962 delete rootObject[currentPart];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
963 throw Error.argument('namespacePath', Sys.Res.invalidNameSpace);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
964 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
965 ns.getName = function ns$getName() {return this.__typeName;}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
966 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
967 rootObject = ns;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
968 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
969 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
970 Type._checkDependency = function Type$_checkDependency(dependency, featureName) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
971 var scripts = Type._registerScript._scripts, isDependent = (scripts ? (!!scripts[dependency]) : false);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
972 if ((typeof(featureName) !== 'undefined') && !isDependent) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
973 throw Error.invalidOperation(String.format(Sys.Res.requiredScriptReferenceNotIncluded,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
974 featureName, dependency));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
975 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
976 return isDependent;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
977 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
978 Type._registerScript = function Type$_registerScript(scriptName, dependencies) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
979 var scripts = Type._registerScript._scripts;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
980 if (!scripts) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
981 Type._registerScript._scripts = scripts = {};
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
982 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
983 if (scripts[scriptName]) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
984 throw Error.invalidOperation(String.format(Sys.Res.scriptAlreadyLoaded, scriptName));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
985 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
986 scripts[scriptName] = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
987 if (dependencies) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
988 for (var i = 0, l = dependencies.length; i < l; i++) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
989 var dependency = dependencies[i];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
990 if (!Type._checkDependency(dependency)) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
991 throw Error.invalidOperation(String.format(Sys.Res.scriptDependencyNotFound, scriptName, dependency));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
992 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
993 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
994 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
995 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
996 Type._registerNamespace("Sys");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
997 Sys.__upperCaseTypes = {};
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
998 Sys.__rootNamespaces = [Sys];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
999 Sys.__registeredTypes = {};
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1000 Sys._isInstanceOfType = function Sys$_isInstanceOfType(type, instance) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1001 if (typeof(instance) === "undefined" || instance === null) return false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1002 if (instance instanceof type) return true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1003 var instanceType = Object.getType(instance);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1004 return !!(instanceType === type) ||
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1005 (instanceType.inheritsFrom && instanceType.inheritsFrom(type)) ||
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1006 (instanceType.implementsInterface && instanceType.implementsInterface(type));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1007 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1008 Sys._getBaseMethod = function Sys$_getBaseMethod(type, instance, name) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1009 if (!Sys._isInstanceOfType(type, instance)) throw Error.argumentType('instance', Object.getType(instance), type);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1010 var baseType = type.getBaseType();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1011 if (baseType) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1012 var baseMethod = baseType.prototype[name];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1013 return (baseMethod instanceof Function) ? baseMethod : null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1014 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1015 return null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1016 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1017 Sys._isDomElement = function Sys$_isDomElement(obj) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1018 var val = false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1019 if (typeof (obj.nodeType) !== 'number') {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1020 var doc = obj.ownerDocument || obj.document || obj;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1021 if (doc != obj) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1022 var w = doc.defaultView || doc.parentWindow;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1023 val = (w != obj);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1024 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1025 else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1026 val = (typeof (doc.body) === 'undefined');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1027 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1028 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1029 return !val;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1030 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1031
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1032 Array.__typeName = 'Array';
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1033 Array.__class = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1034 Array.add = Array.enqueue = function Array$enqueue(array, item) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1035 /// <summary locid="M:J#Array.enqueue" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1036 /// <param name="array" type="Array" elementMayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1037 /// <param name="item" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1038 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1039 {name: "array", type: Array, elementMayBeNull: true},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1040 {name: "item", mayBeNull: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1041 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1042 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1043 array[array.length] = item;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1044 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1045 Array.addRange = function Array$addRange(array, items) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1046 /// <summary locid="M:J#Array.addRange" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1047 /// <param name="array" type="Array" elementMayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1048 /// <param name="items" type="Array" elementMayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1049 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1050 {name: "array", type: Array, elementMayBeNull: true},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1051 {name: "items", type: Array, elementMayBeNull: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1052 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1053 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1054 array.push.apply(array, items);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1055 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1056 Array.clear = function Array$clear(array) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1057 /// <summary locid="M:J#Array.clear" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1058 /// <param name="array" type="Array" elementMayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1059 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1060 {name: "array", type: Array, elementMayBeNull: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1061 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1062 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1063 array.length = 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1064 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1065 Array.clone = function Array$clone(array) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1066 /// <summary locid="M:J#Array.clone" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1067 /// <param name="array" type="Array" elementMayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1068 /// <returns type="Array" elementMayBeNull="true"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1069 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1070 {name: "array", type: Array, elementMayBeNull: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1071 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1072 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1073 if (array.length === 1) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1074 return [array[0]];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1075 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1076 else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1077 return Array.apply(null, array);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1078 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1079 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1080 Array.contains = function Array$contains(array, item) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1081 /// <summary locid="M:J#Array.contains" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1082 /// <param name="array" type="Array" elementMayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1083 /// <param name="item" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1084 /// <returns type="Boolean"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1085 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1086 {name: "array", type: Array, elementMayBeNull: true},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1087 {name: "item", mayBeNull: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1088 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1089 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1090 return (Sys._indexOf(array, item) >= 0);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1091 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1092 Array.dequeue = function Array$dequeue(array) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1093 /// <summary locid="M:J#Array.dequeue" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1094 /// <param name="array" type="Array" elementMayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1095 /// <returns mayBeNull="true"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1096 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1097 {name: "array", type: Array, elementMayBeNull: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1098 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1099 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1100 return array.shift();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1101 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1102 Array.forEach = function Array$forEach(array, method, instance) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1103 /// <summary locid="M:J#Array.forEach" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1104 /// <param name="array" type="Array" elementMayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1105 /// <param name="method" type="Function"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1106 /// <param name="instance" optional="true" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1107 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1108 {name: "array", type: Array, elementMayBeNull: true},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1109 {name: "method", type: Function},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1110 {name: "instance", mayBeNull: true, optional: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1111 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1112 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1113 for (var i = 0, l = array.length; i < l; i++) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1114 var elt = array[i];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1115 if (typeof(elt) !== 'undefined') method.call(instance, elt, i, array);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1116 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1117 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1118 Array.indexOf = function Array$indexOf(array, item, start) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1119 /// <summary locid="M:J#Array.indexOf" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1120 /// <param name="array" type="Array" elementMayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1121 /// <param name="item" optional="true" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1122 /// <param name="start" optional="true" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1123 /// <returns type="Number"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1124 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1125 {name: "array", type: Array, elementMayBeNull: true},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1126 {name: "item", mayBeNull: true, optional: true},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1127 {name: "start", mayBeNull: true, optional: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1128 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1129 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1130 return Sys._indexOf(array, item, start);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1131 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1132 Array.insert = function Array$insert(array, index, item) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1133 /// <summary locid="M:J#Array.insert" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1134 /// <param name="array" type="Array" elementMayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1135 /// <param name="index" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1136 /// <param name="item" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1137 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1138 {name: "array", type: Array, elementMayBeNull: true},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1139 {name: "index", mayBeNull: true},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1140 {name: "item", mayBeNull: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1141 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1142 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1143 array.splice(index, 0, item);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1144 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1145 Array.parse = function Array$parse(value) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1146 /// <summary locid="M:J#Array.parse" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1147 /// <param name="value" type="String" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1148 /// <returns type="Array" elementMayBeNull="true"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1149 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1150 {name: "value", type: String, mayBeNull: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1151 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1152 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1153 if (!value) return [];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1154 var v = eval(value);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1155 if (!Array.isInstanceOfType(v)) throw Error.argument('value', Sys.Res.arrayParseBadFormat);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1156 return v;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1157 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1158 Array.remove = function Array$remove(array, item) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1159 /// <summary locid="M:J#Array.remove" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1160 /// <param name="array" type="Array" elementMayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1161 /// <param name="item" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1162 /// <returns type="Boolean"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1163 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1164 {name: "array", type: Array, elementMayBeNull: true},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1165 {name: "item", mayBeNull: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1166 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1167 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1168 var index = Sys._indexOf(array, item);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1169 if (index >= 0) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1170 array.splice(index, 1);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1171 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1172 return (index >= 0);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1173 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1174 Array.removeAt = function Array$removeAt(array, index) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1175 /// <summary locid="M:J#Array.removeAt" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1176 /// <param name="array" type="Array" elementMayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1177 /// <param name="index" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1178 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1179 {name: "array", type: Array, elementMayBeNull: true},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1180 {name: "index", mayBeNull: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1181 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1182 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1183 array.splice(index, 1);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1184 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1185 Sys._indexOf = function Sys$_indexOf(array, item, start) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1186 if (typeof(item) === "undefined") return -1;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1187 var length = array.length;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1188 if (length !== 0) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1189 start = start - 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1190 if (isNaN(start)) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1191 start = 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1192 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1193 else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1194 if (isFinite(start)) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1195 start = start - (start % 1);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1196 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1197 if (start < 0) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1198 start = Math.max(0, length + start);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1199 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1200 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1201 for (var i = start; i < length; i++) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1202 if ((typeof(array[i]) !== "undefined") && (array[i] === item)) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1203 return i;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1204 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1205 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1206 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1207 return -1;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1208 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1209 Type._registerScript._scripts = {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1210 "MicrosoftAjaxCore.js": true,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1211 "MicrosoftAjaxGlobalization.js": true,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1212 "MicrosoftAjaxSerialization.js": true,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1213 "MicrosoftAjaxComponentModel.js": true,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1214 "MicrosoftAjaxHistory.js": true,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1215 "MicrosoftAjaxNetwork.js" : true,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1216 "MicrosoftAjaxWebServices.js": true };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1217
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1218 Sys.IDisposable = function Sys$IDisposable() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1219 throw Error.notImplemented();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1220 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1221 function Sys$IDisposable$dispose() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1222 throw Error.notImplemented();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1223 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1224 Sys.IDisposable.prototype = {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1225 dispose: Sys$IDisposable$dispose
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1226 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1227 Sys.IDisposable.registerInterface('Sys.IDisposable');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1228
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1229 Sys.StringBuilder = function Sys$StringBuilder(initialText) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1230 /// <summary locid="M:J#Sys.StringBuilder.#ctor" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1231 /// <param name="initialText" optional="true" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1232 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1233 {name: "initialText", mayBeNull: true, optional: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1234 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1235 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1236 this._parts = (typeof(initialText) !== 'undefined' && initialText !== null && initialText !== '') ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1237 [initialText.toString()] : [];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1238 this._value = {};
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1239 this._len = 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1240 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1241 function Sys$StringBuilder$append(text) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1242 /// <summary locid="M:J#Sys.StringBuilder.append" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1243 /// <param name="text" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1244 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1245 {name: "text", mayBeNull: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1246 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1247 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1248 this._parts[this._parts.length] = text;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1249 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1250 function Sys$StringBuilder$appendLine(text) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1251 /// <summary locid="M:J#Sys.StringBuilder.appendLine" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1252 /// <param name="text" optional="true" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1253 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1254 {name: "text", mayBeNull: true, optional: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1255 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1256 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1257 this._parts[this._parts.length] =
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1258 ((typeof(text) === 'undefined') || (text === null) || (text === '')) ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1259 '\r\n' : text + '\r\n';
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1260 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1261 function Sys$StringBuilder$clear() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1262 /// <summary locid="M:J#Sys.StringBuilder.clear" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1263 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1264 this._parts = [];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1265 this._value = {};
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1266 this._len = 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1267 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1268 function Sys$StringBuilder$isEmpty() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1269 /// <summary locid="M:J#Sys.StringBuilder.isEmpty" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1270 /// <returns type="Boolean"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1271 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1272 if (this._parts.length === 0) return true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1273 return this.toString() === '';
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1274 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1275 function Sys$StringBuilder$toString(separator) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1276 /// <summary locid="M:J#Sys.StringBuilder.toString" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1277 /// <param name="separator" type="String" optional="true" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1278 /// <returns type="String"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1279 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1280 {name: "separator", type: String, mayBeNull: true, optional: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1281 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1282 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1283 separator = separator || '';
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1284 var parts = this._parts;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1285 if (this._len !== parts.length) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1286 this._value = {};
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1287 this._len = parts.length;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1288 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1289 var val = this._value;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1290 if (typeof(val[separator]) === 'undefined') {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1291 if (separator !== '') {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1292 for (var i = 0; i < parts.length;) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1293 if ((typeof(parts[i]) === 'undefined') || (parts[i] === '') || (parts[i] === null)) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1294 parts.splice(i, 1);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1295 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1296 else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1297 i++;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1298 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1299 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1300 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1301 val[separator] = this._parts.join(separator);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1302 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1303 return val[separator];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1304 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1305 Sys.StringBuilder.prototype = {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1306 append: Sys$StringBuilder$append,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1307 appendLine: Sys$StringBuilder$appendLine,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1308 clear: Sys$StringBuilder$clear,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1309 isEmpty: Sys$StringBuilder$isEmpty,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1310 toString: Sys$StringBuilder$toString
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1311 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1312 Sys.StringBuilder.registerClass('Sys.StringBuilder');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1313
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1314 Sys.Browser = {};
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1315 Sys.Browser.InternetExplorer = {};
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1316 Sys.Browser.Firefox = {};
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1317 Sys.Browser.Safari = {};
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1318 Sys.Browser.Opera = {};
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1319 Sys.Browser.agent = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1320 Sys.Browser.hasDebuggerStatement = false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1321 Sys.Browser.name = navigator.appName;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1322 Sys.Browser.version = parseFloat(navigator.appVersion);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1323 Sys.Browser.documentMode = 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1324 if (navigator.userAgent.indexOf(' MSIE ') > -1) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1325 Sys.Browser.agent = Sys.Browser.InternetExplorer;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1326 Sys.Browser.version = parseFloat(navigator.userAgent.match(/MSIE (\d+\.\d+)/)[1]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1327 if (Sys.Browser.version >= 8) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1328 if (document.documentMode >= 7) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1329 Sys.Browser.documentMode = document.documentMode;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1330 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1331 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1332 Sys.Browser.hasDebuggerStatement = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1333 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1334 else if (navigator.userAgent.indexOf(' Firefox/') > -1) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1335 Sys.Browser.agent = Sys.Browser.Firefox;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1336 Sys.Browser.version = parseFloat(navigator.userAgent.match(/ Firefox\/(\d+\.\d+)/)[1]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1337 Sys.Browser.name = 'Firefox';
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1338 Sys.Browser.hasDebuggerStatement = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1339 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1340 else if (navigator.userAgent.indexOf(' AppleWebKit/') > -1) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1341 Sys.Browser.agent = Sys.Browser.Safari;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1342 Sys.Browser.version = parseFloat(navigator.userAgent.match(/ AppleWebKit\/(\d+(\.\d+)?)/)[1]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1343 Sys.Browser.name = 'Safari';
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1344 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1345 else if (navigator.userAgent.indexOf('Opera/') > -1) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1346 Sys.Browser.agent = Sys.Browser.Opera;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1347 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1348
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1349 Sys.EventArgs = function Sys$EventArgs() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1350 /// <summary locid="M:J#Sys.EventArgs.#ctor" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1351 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1352 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1353 Sys.EventArgs.registerClass('Sys.EventArgs');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1354 Sys.EventArgs.Empty = new Sys.EventArgs();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1355
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1356 Sys.CancelEventArgs = function Sys$CancelEventArgs() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1357 /// <summary locid="M:J#Sys.CancelEventArgs.#ctor" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1358 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1359 Sys.CancelEventArgs.initializeBase(this);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1360 this._cancel = false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1361 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1362 function Sys$CancelEventArgs$get_cancel() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1363 /// <value type="Boolean" locid="P:J#Sys.CancelEventArgs.cancel"></value>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1364 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1365 return this._cancel;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1366 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1367 function Sys$CancelEventArgs$set_cancel(value) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1368 var e = Function._validateParams(arguments, [{name: "value", type: Boolean}]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1369 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1370 this._cancel = value;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1371 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1372 Sys.CancelEventArgs.prototype = {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1373 get_cancel: Sys$CancelEventArgs$get_cancel,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1374 set_cancel: Sys$CancelEventArgs$set_cancel
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1375 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1376 Sys.CancelEventArgs.registerClass('Sys.CancelEventArgs', Sys.EventArgs);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1377 Type.registerNamespace('Sys.UI');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1378
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1379 Sys._Debug = function Sys$_Debug() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1380 /// <summary locid="M:J#Sys.Debug.#ctor" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1381 /// <field name="isDebug" type="Boolean" locid="F:J#Sys.Debug.isDebug"></field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1382 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1383 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1384 function Sys$_Debug$_appendConsole(text) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1385 if ((typeof(Debug) !== 'undefined') && Debug.writeln) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1386 Debug.writeln(text);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1387 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1388 if (window.console && window.console.log) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1389 window.console.log(text);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1390 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1391 if (window.opera) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1392 window.opera.postError(text);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1393 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1394 if (window.debugService) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1395 window.debugService.trace(text);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1396 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1397 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1398 function Sys$_Debug$_appendTrace(text) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1399 var traceElement = document.getElementById('TraceConsole');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1400 if (traceElement && (traceElement.tagName.toUpperCase() === 'TEXTAREA')) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1401 traceElement.value += text + '\n';
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1402 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1403 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1404 function Sys$_Debug$assert(condition, message, displayCaller) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1405 /// <summary locid="M:J#Sys.Debug.assert" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1406 /// <param name="condition" type="Boolean"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1407 /// <param name="message" type="String" optional="true" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1408 /// <param name="displayCaller" type="Boolean" optional="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1409 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1410 {name: "condition", type: Boolean},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1411 {name: "message", type: String, mayBeNull: true, optional: true},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1412 {name: "displayCaller", type: Boolean, optional: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1413 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1414 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1415 if (!condition) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1416 message = (displayCaller && this.assert.caller) ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1417 String.format(Sys.Res.assertFailedCaller, message, this.assert.caller) :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1418 String.format(Sys.Res.assertFailed, message);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1419 if (confirm(String.format(Sys.Res.breakIntoDebugger, message))) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1420 this.fail(message);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1421 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1422 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1423 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1424 function Sys$_Debug$clearTrace() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1425 /// <summary locid="M:J#Sys.Debug.clearTrace" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1426 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1427 var traceElement = document.getElementById('TraceConsole');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1428 if (traceElement && (traceElement.tagName.toUpperCase() === 'TEXTAREA')) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1429 traceElement.value = '';
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1430 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1431 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1432 function Sys$_Debug$fail(message) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1433 /// <summary locid="M:J#Sys.Debug.fail" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1434 /// <param name="message" type="String" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1435 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1436 {name: "message", type: String, mayBeNull: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1437 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1438 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1439 this._appendConsole(message);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1440 if (Sys.Browser.hasDebuggerStatement) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1441 eval('debugger');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1442 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1443 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1444 function Sys$_Debug$trace(text) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1445 /// <summary locid="M:J#Sys.Debug.trace" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1446 /// <param name="text"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1447 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1448 {name: "text"}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1449 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1450 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1451 this._appendConsole(text);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1452 this._appendTrace(text);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1453 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1454 function Sys$_Debug$traceDump(object, name) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1455 /// <summary locid="M:J#Sys.Debug.traceDump" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1456 /// <param name="object" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1457 /// <param name="name" type="String" mayBeNull="true" optional="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1458 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1459 {name: "object", mayBeNull: true},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1460 {name: "name", type: String, mayBeNull: true, optional: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1461 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1462 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1463 var text = this._traceDump(object, name, true);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1464 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1465 function Sys$_Debug$_traceDump(object, name, recursive, indentationPadding, loopArray) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1466 name = name? name : 'traceDump';
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1467 indentationPadding = indentationPadding? indentationPadding : '';
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1468 if (object === null) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1469 this.trace(indentationPadding + name + ': null');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1470 return;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1471 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1472 switch(typeof(object)) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1473 case 'undefined':
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1474 this.trace(indentationPadding + name + ': Undefined');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1475 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1476 case 'number': case 'string': case 'boolean':
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1477 this.trace(indentationPadding + name + ': ' + object);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1478 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1479 default:
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1480 if (Date.isInstanceOfType(object) || RegExp.isInstanceOfType(object)) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1481 this.trace(indentationPadding + name + ': ' + object.toString());
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1482 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1483 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1484 if (!loopArray) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1485 loopArray = [];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1486 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1487 else if (Array.contains(loopArray, object)) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1488 this.trace(indentationPadding + name + ': ...');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1489 return;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1490 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1491 Array.add(loopArray, object);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1492 if ((object == window) || (object === document) ||
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1493 (window.HTMLElement && (object instanceof HTMLElement)) ||
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1494 (typeof(object.nodeName) === 'string')) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1495 var tag = object.tagName? object.tagName : 'DomElement';
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1496 if (object.id) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1497 tag += ' - ' + object.id;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1498 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1499 this.trace(indentationPadding + name + ' {' + tag + '}');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1500 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1501 else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1502 var typeName = Object.getTypeName(object);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1503 this.trace(indentationPadding + name + (typeof(typeName) === 'string' ? ' {' + typeName + '}' : ''));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1504 if ((indentationPadding === '') || recursive) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1505 indentationPadding += " ";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1506 var i, length, properties, p, v;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1507 if (Array.isInstanceOfType(object)) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1508 length = object.length;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1509 for (i = 0; i < length; i++) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1510 this._traceDump(object[i], '[' + i + ']', recursive, indentationPadding, loopArray);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1511 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1512 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1513 else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1514 for (p in object) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1515 v = object[p];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1516 if (!Function.isInstanceOfType(v)) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1517 this._traceDump(v, p, recursive, indentationPadding, loopArray);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1518 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1519 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1520 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1521 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1522 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1523 Array.remove(loopArray, object);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1524 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1525 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1526 Sys._Debug.prototype = {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1527 _appendConsole: Sys$_Debug$_appendConsole,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1528 _appendTrace: Sys$_Debug$_appendTrace,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1529 assert: Sys$_Debug$assert,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1530 clearTrace: Sys$_Debug$clearTrace,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1531 fail: Sys$_Debug$fail,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1532 trace: Sys$_Debug$trace,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1533 traceDump: Sys$_Debug$traceDump,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1534 _traceDump: Sys$_Debug$_traceDump
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1535 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1536 Sys._Debug.registerClass('Sys._Debug');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1537 Sys.Debug = new Sys._Debug();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1538 Sys.Debug.isDebug = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1539
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1540 function Sys$Enum$parse(value, ignoreCase) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1541 /// <summary locid="M:J#Sys.Enum.parse" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1542 /// <param name="value" type="String"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1543 /// <param name="ignoreCase" type="Boolean" optional="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1544 /// <returns></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1545 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1546 {name: "value", type: String},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1547 {name: "ignoreCase", type: Boolean, optional: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1548 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1549 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1550 var values, parsed, val;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1551 if (ignoreCase) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1552 values = this.__lowerCaseValues;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1553 if (!values) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1554 this.__lowerCaseValues = values = {};
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1555 var prototype = this.prototype;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1556 for (var name in prototype) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1557 values[name.toLowerCase()] = prototype[name];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1558 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1559 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1560 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1561 else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1562 values = this.prototype;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1563 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1564 if (!this.__flags) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1565 val = (ignoreCase ? value.toLowerCase() : value);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1566 parsed = values[val.trim()];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1567 if (typeof(parsed) !== 'number') throw Error.argument('value', String.format(Sys.Res.enumInvalidValue, value, this.__typeName));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1568 return parsed;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1569 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1570 else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1571 var parts = (ignoreCase ? value.toLowerCase() : value).split(',');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1572 var v = 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1573 for (var i = parts.length - 1; i >= 0; i--) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1574 var part = parts[i].trim();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1575 parsed = values[part];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1576 if (typeof(parsed) !== 'number') throw Error.argument('value', String.format(Sys.Res.enumInvalidValue, value.split(',')[i].trim(), this.__typeName));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1577 v |= parsed;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1578 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1579 return v;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1580 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1581 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1582 function Sys$Enum$toString(value) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1583 /// <summary locid="M:J#Sys.Enum.toString" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1584 /// <param name="value" optional="true" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1585 /// <returns type="String"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1586 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1587 {name: "value", mayBeNull: true, optional: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1588 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1589 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1590 if ((typeof(value) === 'undefined') || (value === null)) return this.__string;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1591 if ((typeof(value) != 'number') || ((value % 1) !== 0)) throw Error.argumentType('value', Object.getType(value), this);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1592 var values = this.prototype;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1593 var i;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1594 if (!this.__flags || (value === 0)) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1595 for (i in values) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1596 if (values[i] === value) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1597 return i;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1598 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1599 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1600 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1601 else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1602 var sorted = this.__sortedValues;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1603 if (!sorted) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1604 sorted = [];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1605 for (i in values) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1606 sorted[sorted.length] = {key: i, value: values[i]};
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1607 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1608 sorted.sort(function(a, b) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1609 return a.value - b.value;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1610 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1611 this.__sortedValues = sorted;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1612 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1613 var parts = [];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1614 var v = value;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1615 for (i = sorted.length - 1; i >= 0; i--) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1616 var kvp = sorted[i];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1617 var vali = kvp.value;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1618 if (vali === 0) continue;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1619 if ((vali & value) === vali) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1620 parts[parts.length] = kvp.key;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1621 v -= vali;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1622 if (v === 0) break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1623 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1624 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1625 if (parts.length && v === 0) return parts.reverse().join(', ');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1626 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1627 throw Error.argumentOutOfRange('value', value, String.format(Sys.Res.enumInvalidValue, value, this.__typeName));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1628 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1629 Type.prototype.registerEnum = function Type$registerEnum(name, flags) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1630 /// <summary locid="M:J#Sys.UI.LineType.#ctor" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1631 /// <param name="name" type="String"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1632 /// <param name="flags" type="Boolean" optional="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1633 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1634 {name: "name", type: String},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1635 {name: "flags", type: Boolean, optional: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1636 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1637 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1638 if (!Type.__fullyQualifiedIdentifierRegExp.test(name)) throw Error.argument('name', Sys.Res.notATypeName);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1639 var parsedName;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1640 try {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1641 parsedName = eval(name);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1642 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1643 catch(e) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1644 throw Error.argument('name', Sys.Res.argumentTypeName);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1645 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1646 if (parsedName !== this) throw Error.argument('name', Sys.Res.badTypeName);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1647 if (Sys.__registeredTypes[name]) throw Error.invalidOperation(String.format(Sys.Res.typeRegisteredTwice, name));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1648 for (var j in this.prototype) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1649 var val = this.prototype[j];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1650 if (!Type.__identifierRegExp.test(j)) throw Error.invalidOperation(String.format(Sys.Res.enumInvalidValueName, j));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1651 if (typeof(val) !== 'number' || (val % 1) !== 0) throw Error.invalidOperation(Sys.Res.enumValueNotInteger);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1652 if (typeof(this[j]) !== 'undefined') throw Error.invalidOperation(String.format(Sys.Res.enumReservedName, j));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1653 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1654 Sys.__upperCaseTypes[name.toUpperCase()] = this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1655 for (var i in this.prototype) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1656 this[i] = this.prototype[i];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1657 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1658 this.__typeName = name;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1659 this.parse = Sys$Enum$parse;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1660 this.__string = this.toString();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1661 this.toString = Sys$Enum$toString;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1662 this.__flags = flags;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1663 this.__enum = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1664 Sys.__registeredTypes[name] = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1665 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1666 Type.isEnum = function Type$isEnum(type) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1667 /// <summary locid="M:J#Type.isEnum" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1668 /// <param name="type" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1669 /// <returns type="Boolean"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1670 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1671 {name: "type", mayBeNull: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1672 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1673 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1674 if ((typeof(type) === 'undefined') || (type === null)) return false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1675 return !!type.__enum;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1676 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1677 Type.isFlags = function Type$isFlags(type) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1678 /// <summary locid="M:J#Type.isFlags" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1679 /// <param name="type" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1680 /// <returns type="Boolean"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1681 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1682 {name: "type", mayBeNull: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1683 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1684 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1685 if ((typeof(type) === 'undefined') || (type === null)) return false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1686 return !!type.__flags;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1687 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1688 Sys.CollectionChange = function Sys$CollectionChange(action, newItems, newStartingIndex, oldItems, oldStartingIndex) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1689 /// <summary locid="M:J#Sys.CollectionChange.#ctor" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1690 /// <param name="action" type="Sys.NotifyCollectionChangedAction"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1691 /// <param name="newItems" optional="true" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1692 /// <param name="newStartingIndex" type="Number" integer="true" optional="true" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1693 /// <param name="oldItems" optional="true" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1694 /// <param name="oldStartingIndex" type="Number" integer="true" optional="true" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1695 /// <field name="action" type="Sys.NotifyCollectionChangedAction" locid="F:J#Sys.CollectionChange.action"></field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1696 /// <field name="newItems" type="Array" mayBeNull="true" elementMayBeNull="true" locid="F:J#Sys.CollectionChange.newItems"></field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1697 /// <field name="newStartingIndex" type="Number" integer="true" locid="F:J#Sys.CollectionChange.newStartingIndex"></field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1698 /// <field name="oldItems" type="Array" mayBeNull="true" elementMayBeNull="true" locid="F:J#Sys.CollectionChange.oldItems"></field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1699 /// <field name="oldStartingIndex" type="Number" integer="true" locid="F:J#Sys.CollectionChange.oldStartingIndex"></field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1700 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1701 {name: "action", type: Sys.NotifyCollectionChangedAction},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1702 {name: "newItems", mayBeNull: true, optional: true},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1703 {name: "newStartingIndex", type: Number, mayBeNull: true, integer: true, optional: true},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1704 {name: "oldItems", mayBeNull: true, optional: true},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1705 {name: "oldStartingIndex", type: Number, mayBeNull: true, integer: true, optional: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1706 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1707 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1708 this.action = action;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1709 if (newItems) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1710 if (!(newItems instanceof Array)) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1711 newItems = [newItems];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1712 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1713 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1714 this.newItems = newItems || null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1715 if (typeof newStartingIndex !== "number") {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1716 newStartingIndex = -1;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1717 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1718 this.newStartingIndex = newStartingIndex;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1719 if (oldItems) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1720 if (!(oldItems instanceof Array)) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1721 oldItems = [oldItems];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1722 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1723 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1724 this.oldItems = oldItems || null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1725 if (typeof oldStartingIndex !== "number") {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1726 oldStartingIndex = -1;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1727 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1728 this.oldStartingIndex = oldStartingIndex;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1729 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1730 Sys.CollectionChange.registerClass("Sys.CollectionChange");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1731 Sys.NotifyCollectionChangedAction = function Sys$NotifyCollectionChangedAction() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1732 /// <summary locid="M:J#Sys.NotifyCollectionChangedAction.#ctor" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1733 /// <field name="add" type="Number" integer="true" static="true" locid="F:J#Sys.NotifyCollectionChangedAction.add"></field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1734 /// <field name="remove" type="Number" integer="true" static="true" locid="F:J#Sys.NotifyCollectionChangedAction.remove"></field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1735 /// <field name="reset" type="Number" integer="true" static="true" locid="F:J#Sys.NotifyCollectionChangedAction.reset"></field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1736 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1737 throw Error.notImplemented();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1738 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1739 Sys.NotifyCollectionChangedAction.prototype = {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1740 add: 0,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1741 remove: 1,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1742 reset: 2
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1743 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1744 Sys.NotifyCollectionChangedAction.registerEnum('Sys.NotifyCollectionChangedAction');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1745 Sys.NotifyCollectionChangedEventArgs = function Sys$NotifyCollectionChangedEventArgs(changes) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1746 /// <summary locid="M:J#Sys.NotifyCollectionChangedEventArgs.#ctor" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1747 /// <param name="changes" type="Array" elementType="Sys.CollectionChange"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1748 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1749 {name: "changes", type: Array, elementType: Sys.CollectionChange}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1750 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1751 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1752 this._changes = changes;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1753 Sys.NotifyCollectionChangedEventArgs.initializeBase(this);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1754 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1755 function Sys$NotifyCollectionChangedEventArgs$get_changes() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1756 /// <value type="Array" elementType="Sys.CollectionChange" locid="P:J#Sys.NotifyCollectionChangedEventArgs.changes"></value>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1757 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1758 return this._changes || [];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1759 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1760 Sys.NotifyCollectionChangedEventArgs.prototype = {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1761 get_changes: Sys$NotifyCollectionChangedEventArgs$get_changes
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1762 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1763 Sys.NotifyCollectionChangedEventArgs.registerClass("Sys.NotifyCollectionChangedEventArgs", Sys.EventArgs);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1764 Sys.Observer = function Sys$Observer() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1765 throw Error.invalidOperation();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1766 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1767 Sys.Observer.registerClass("Sys.Observer");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1768 Sys.Observer.makeObservable = function Sys$Observer$makeObservable(target) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1769 /// <summary locid="M:J#Sys.Observer.makeObservable" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1770 /// <param name="target" mayBeNull="false"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1771 /// <returns></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1772 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1773 {name: "target"}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1774 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1775 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1776 var isArray = target instanceof Array,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1777 o = Sys.Observer;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1778 Sys.Observer._ensureObservable(target);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1779 if (target.setValue === o._observeMethods.setValue) return target;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1780 o._addMethods(target, o._observeMethods);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1781 if (isArray) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1782 o._addMethods(target, o._arrayMethods);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1783 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1784 return target;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1785 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1786 Sys.Observer._ensureObservable = function Sys$Observer$_ensureObservable(target) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1787 var type = typeof target;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1788 if ((type === "string") || (type === "number") || (type === "boolean") || (type === "date")) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1789 throw Error.invalidOperation(String.format(Sys.Res.notObservable, type));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1790 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1791 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1792 Sys.Observer._addMethods = function Sys$Observer$_addMethods(target, methods) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1793 for (var m in methods) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1794 if (target[m] && (target[m] !== methods[m])) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1795 throw Error.invalidOperation(String.format(Sys.Res.observableConflict, m));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1796 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1797 target[m] = methods[m];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1798 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1799 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1800 Sys.Observer._addEventHandler = function Sys$Observer$_addEventHandler(target, eventName, handler) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1801 Sys.Observer._getContext(target, true).events._addHandler(eventName, handler);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1802 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1803 Sys.Observer.addEventHandler = function Sys$Observer$addEventHandler(target, eventName, handler) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1804 /// <summary locid="M:J#Sys.Observer.addEventHandler" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1805 /// <param name="target"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1806 /// <param name="eventName" type="String"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1807 /// <param name="handler" type="Function"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1808 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1809 {name: "target"},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1810 {name: "eventName", type: String},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1811 {name: "handler", type: Function}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1812 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1813 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1814 Sys.Observer._ensureObservable(target);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1815 Sys.Observer._addEventHandler(target, eventName, handler);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1816 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1817 Sys.Observer._removeEventHandler = function Sys$Observer$_removeEventHandler(target, eventName, handler) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1818 Sys.Observer._getContext(target, true).events._removeHandler(eventName, handler);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1819 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1820 Sys.Observer.removeEventHandler = function Sys$Observer$removeEventHandler(target, eventName, handler) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1821 /// <summary locid="M:J#Sys.Observer.removeEventHandler" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1822 /// <param name="target"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1823 /// <param name="eventName" type="String"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1824 /// <param name="handler" type="Function"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1825 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1826 {name: "target"},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1827 {name: "eventName", type: String},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1828 {name: "handler", type: Function}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1829 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1830 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1831 Sys.Observer._ensureObservable(target);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1832 Sys.Observer._removeEventHandler(target, eventName, handler);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1833 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1834 Sys.Observer.raiseEvent = function Sys$Observer$raiseEvent(target, eventName, eventArgs) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1835 /// <summary locid="M:J#Sys.Observer.raiseEvent" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1836 /// <param name="target"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1837 /// <param name="eventName" type="String"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1838 /// <param name="eventArgs" type="Sys.EventArgs"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1839 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1840 {name: "target"},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1841 {name: "eventName", type: String},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1842 {name: "eventArgs", type: Sys.EventArgs}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1843 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1844 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1845 Sys.Observer._ensureObservable(target);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1846 var ctx = Sys.Observer._getContext(target);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1847 if (!ctx) return;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1848 var handler = ctx.events.getHandler(eventName);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1849 if (handler) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1850 handler(target, eventArgs);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1851 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1852 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1853 Sys.Observer.addPropertyChanged = function Sys$Observer$addPropertyChanged(target, handler) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1854 /// <summary locid="M:J#Sys.Observer.addPropertyChanged" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1855 /// <param name="target" mayBeNull="false"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1856 /// <param name="handler" type="Function"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1857 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1858 {name: "target"},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1859 {name: "handler", type: Function}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1860 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1861 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1862 Sys.Observer._ensureObservable(target);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1863 Sys.Observer._addEventHandler(target, "propertyChanged", handler);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1864 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1865 Sys.Observer.removePropertyChanged = function Sys$Observer$removePropertyChanged(target, handler) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1866 /// <summary locid="M:J#Sys.Observer.removePropertyChanged" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1867 /// <param name="target" mayBeNull="false"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1868 /// <param name="handler" type="Function"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1869 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1870 {name: "target"},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1871 {name: "handler", type: Function}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1872 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1873 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1874 Sys.Observer._ensureObservable(target);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1875 Sys.Observer._removeEventHandler(target, "propertyChanged", handler);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1876 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1877 Sys.Observer.beginUpdate = function Sys$Observer$beginUpdate(target) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1878 /// <summary locid="M:J#Sys.Observer.beginUpdate" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1879 /// <param name="target" mayBeNull="false"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1880 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1881 {name: "target"}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1882 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1883 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1884 Sys.Observer._ensureObservable(target);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1885 Sys.Observer._getContext(target, true).updating = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1886 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1887 Sys.Observer.endUpdate = function Sys$Observer$endUpdate(target) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1888 /// <summary locid="M:J#Sys.Observer.endUpdate" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1889 /// <param name="target" mayBeNull="false"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1890 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1891 {name: "target"}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1892 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1893 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1894 Sys.Observer._ensureObservable(target);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1895 var ctx = Sys.Observer._getContext(target);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1896 if (!ctx || !ctx.updating) return;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1897 ctx.updating = false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1898 var dirty = ctx.dirty;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1899 ctx.dirty = false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1900 if (dirty) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1901 if (target instanceof Array) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1902 var changes = ctx.changes;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1903 ctx.changes = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1904 Sys.Observer.raiseCollectionChanged(target, changes);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1905 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1906 Sys.Observer.raisePropertyChanged(target, "");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1907 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1908 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1909 Sys.Observer.isUpdating = function Sys$Observer$isUpdating(target) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1910 /// <summary locid="M:J#Sys.Observer.isUpdating" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1911 /// <param name="target" mayBeNull="false"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1912 /// <returns type="Boolean"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1913 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1914 {name: "target"}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1915 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1916 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1917 Sys.Observer._ensureObservable(target);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1918 var ctx = Sys.Observer._getContext(target);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1919 return ctx ? ctx.updating : false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1920 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1921 Sys.Observer._setValue = function Sys$Observer$_setValue(target, propertyName, value) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1922 var getter, setter, mainTarget = target, path = propertyName.split('.');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1923 for (var i = 0, l = (path.length - 1); i < l ; i++) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1924 var name = path[i];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1925 getter = target["get_" + name];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1926 if (typeof (getter) === "function") {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1927 target = getter.call(target);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1928 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1929 else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1930 target = target[name];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1931 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1932 var type = typeof (target);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1933 if ((target === null) || (type === "undefined")) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1934 throw Error.invalidOperation(String.format(Sys.Res.nullReferenceInPath, propertyName));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1935 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1936 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1937 var currentValue, lastPath = path[l];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1938 getter = target["get_" + lastPath];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1939 setter = target["set_" + lastPath];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1940 if (typeof(getter) === 'function') {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1941 currentValue = getter.call(target);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1942 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1943 else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1944 currentValue = target[lastPath];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1945 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1946 if (typeof(setter) === 'function') {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1947 setter.call(target, value);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1948 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1949 else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1950 target[lastPath] = value;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1951 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1952 if (currentValue !== value) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1953 var ctx = Sys.Observer._getContext(mainTarget);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1954 if (ctx && ctx.updating) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1955 ctx.dirty = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1956 return;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1957 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1958 Sys.Observer.raisePropertyChanged(mainTarget, path[0]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1959 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1960 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1961 Sys.Observer.setValue = function Sys$Observer$setValue(target, propertyName, value) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1962 /// <summary locid="M:J#Sys.Observer.setValue" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1963 /// <param name="target" mayBeNull="false"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1964 /// <param name="propertyName" type="String"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1965 /// <param name="value" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1966 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1967 {name: "target"},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1968 {name: "propertyName", type: String},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1969 {name: "value", mayBeNull: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1970 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1971 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1972 Sys.Observer._ensureObservable(target);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1973 Sys.Observer._setValue(target, propertyName, value);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1974 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1975 Sys.Observer.raisePropertyChanged = function Sys$Observer$raisePropertyChanged(target, propertyName) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1976 /// <summary locid="M:J#Sys.Observer.raisePropertyChanged" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1977 /// <param name="target" mayBeNull="false"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1978 /// <param name="propertyName" type="String"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1979 Sys.Observer.raiseEvent(target, "propertyChanged", new Sys.PropertyChangedEventArgs(propertyName));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1980 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1981 Sys.Observer.addCollectionChanged = function Sys$Observer$addCollectionChanged(target, handler) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1982 /// <summary locid="M:J#Sys.Observer.addCollectionChanged" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1983 /// <param name="target" type="Array" elementMayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1984 /// <param name="handler" type="Function"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1985 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1986 {name: "target", type: Array, elementMayBeNull: true},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1987 {name: "handler", type: Function}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1988 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1989 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1990 Sys.Observer._addEventHandler(target, "collectionChanged", handler);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1991 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1992 Sys.Observer.removeCollectionChanged = function Sys$Observer$removeCollectionChanged(target, handler) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1993 /// <summary locid="M:J#Sys.Observer.removeCollectionChanged" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1994 /// <param name="target" type="Array" elementMayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1995 /// <param name="handler" type="Function"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1996 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1997 {name: "target", type: Array, elementMayBeNull: true},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1998 {name: "handler", type: Function}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1999 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2000 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2001 Sys.Observer._removeEventHandler(target, "collectionChanged", handler);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2002 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2003 Sys.Observer._collectionChange = function Sys$Observer$_collectionChange(target, change) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2004 var ctx = Sys.Observer._getContext(target);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2005 if (ctx && ctx.updating) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2006 ctx.dirty = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2007 var changes = ctx.changes;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2008 if (!changes) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2009 ctx.changes = changes = [change];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2010 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2011 else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2012 changes.push(change);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2013 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2014 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2015 else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2016 Sys.Observer.raiseCollectionChanged(target, [change]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2017 Sys.Observer.raisePropertyChanged(target, 'length');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2018 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2019 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2020 Sys.Observer.add = function Sys$Observer$add(target, item) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2021 /// <summary locid="M:J#Sys.Observer.add" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2022 /// <param name="target" type="Array" elementMayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2023 /// <param name="item" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2024 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2025 {name: "target", type: Array, elementMayBeNull: true},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2026 {name: "item", mayBeNull: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2027 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2028 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2029 var change = new Sys.CollectionChange(Sys.NotifyCollectionChangedAction.add, [item], target.length);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2030 Array.add(target, item);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2031 Sys.Observer._collectionChange(target, change);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2032 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2033 Sys.Observer.addRange = function Sys$Observer$addRange(target, items) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2034 /// <summary locid="M:J#Sys.Observer.addRange" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2035 /// <param name="target" type="Array" elementMayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2036 /// <param name="items" type="Array" elementMayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2037 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2038 {name: "target", type: Array, elementMayBeNull: true},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2039 {name: "items", type: Array, elementMayBeNull: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2040 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2041 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2042 var change = new Sys.CollectionChange(Sys.NotifyCollectionChangedAction.add, items, target.length);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2043 Array.addRange(target, items);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2044 Sys.Observer._collectionChange(target, change);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2045 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2046 Sys.Observer.clear = function Sys$Observer$clear(target) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2047 /// <summary locid="M:J#Sys.Observer.clear" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2048 /// <param name="target" type="Array" elementMayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2049 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2050 {name: "target", type: Array, elementMayBeNull: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2051 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2052 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2053 var oldItems = Array.clone(target);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2054 Array.clear(target);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2055 Sys.Observer._collectionChange(target, new Sys.CollectionChange(Sys.NotifyCollectionChangedAction.reset, null, -1, oldItems, 0));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2056 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2057 Sys.Observer.insert = function Sys$Observer$insert(target, index, item) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2058 /// <summary locid="M:J#Sys.Observer.insert" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2059 /// <param name="target" type="Array" elementMayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2060 /// <param name="index" type="Number" integer="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2061 /// <param name="item" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2062 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2063 {name: "target", type: Array, elementMayBeNull: true},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2064 {name: "index", type: Number, integer: true},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2065 {name: "item", mayBeNull: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2066 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2067 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2068 Array.insert(target, index, item);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2069 Sys.Observer._collectionChange(target, new Sys.CollectionChange(Sys.NotifyCollectionChangedAction.add, [item], index));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2070 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2071 Sys.Observer.remove = function Sys$Observer$remove(target, item) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2072 /// <summary locid="M:J#Sys.Observer.remove" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2073 /// <param name="target" type="Array" elementMayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2074 /// <param name="item" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2075 /// <returns type="Boolean"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2076 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2077 {name: "target", type: Array, elementMayBeNull: true},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2078 {name: "item", mayBeNull: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2079 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2080 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2081 var index = Array.indexOf(target, item);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2082 if (index !== -1) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2083 Array.remove(target, item);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2084 Sys.Observer._collectionChange(target, new Sys.CollectionChange(Sys.NotifyCollectionChangedAction.remove, null, -1, [item], index));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2085 return true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2086 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2087 return false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2088 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2089 Sys.Observer.removeAt = function Sys$Observer$removeAt(target, index) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2090 /// <summary locid="M:J#Sys.Observer.removeAt" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2091 /// <param name="target" type="Array" elementMayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2092 /// <param name="index" type="Number" integer="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2093 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2094 {name: "target", type: Array, elementMayBeNull: true},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2095 {name: "index", type: Number, integer: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2096 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2097 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2098 if ((index > -1) && (index < target.length)) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2099 var item = target[index];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2100 Array.removeAt(target, index);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2101 Sys.Observer._collectionChange(target, new Sys.CollectionChange(Sys.NotifyCollectionChangedAction.remove, null, -1, [item], index));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2102 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2103 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2104 Sys.Observer.raiseCollectionChanged = function Sys$Observer$raiseCollectionChanged(target, changes) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2105 /// <summary locid="M:J#Sys.Observer.raiseCollectionChanged" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2106 /// <param name="target"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2107 /// <param name="changes" type="Array" elementType="Sys.CollectionChange"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2108 Sys.Observer.raiseEvent(target, "collectionChanged", new Sys.NotifyCollectionChangedEventArgs(changes));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2109 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2110 Sys.Observer._observeMethods = {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2111 add_propertyChanged: function(handler) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2112 Sys.Observer._addEventHandler(this, "propertyChanged", handler);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2113 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2114 remove_propertyChanged: function(handler) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2115 Sys.Observer._removeEventHandler(this, "propertyChanged", handler);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2116 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2117 addEventHandler: function(eventName, handler) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2118 /// <summary locid="M:J#Sys.Observer.raiseCollectionChanged" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2119 /// <param name="eventName" type="String"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2120 /// <param name="handler" type="Function"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2121 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2122 {name: "eventName", type: String},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2123 {name: "handler", type: Function}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2124 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2125 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2126 Sys.Observer._addEventHandler(this, eventName, handler);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2127 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2128 removeEventHandler: function(eventName, handler) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2129 /// <summary locid="M:J#Sys.Observer.raiseCollectionChanged" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2130 /// <param name="eventName" type="String"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2131 /// <param name="handler" type="Function"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2132 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2133 {name: "eventName", type: String},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2134 {name: "handler", type: Function}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2135 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2136 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2137 Sys.Observer._removeEventHandler(this, eventName, handler);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2138 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2139 get_isUpdating: function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2140 /// <summary locid="M:J#Sys.Observer.raiseCollectionChanged" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2141 /// <returns type="Boolean"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2142 return Sys.Observer.isUpdating(this);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2143 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2144 beginUpdate: function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2145 /// <summary locid="M:J#Sys.Observer.raiseCollectionChanged" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2146 Sys.Observer.beginUpdate(this);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2147 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2148 endUpdate: function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2149 /// <summary locid="M:J#Sys.Observer.raiseCollectionChanged" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2150 Sys.Observer.endUpdate(this);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2151 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2152 setValue: function(name, value) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2153 /// <summary locid="M:J#Sys.Observer.raiseCollectionChanged" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2154 /// <param name="name" type="String"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2155 /// <param name="value" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2156 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2157 {name: "name", type: String},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2158 {name: "value", mayBeNull: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2159 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2160 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2161 Sys.Observer._setValue(this, name, value);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2162 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2163 raiseEvent: function(eventName, eventArgs) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2164 /// <summary locid="M:J#Sys.Observer.raiseCollectionChanged" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2165 /// <param name="eventName" type="String"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2166 /// <param name="eventArgs" type="Sys.EventArgs"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2167 Sys.Observer.raiseEvent(this, eventName, eventArgs);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2168 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2169 raisePropertyChanged: function(name) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2170 /// <summary locid="M:J#Sys.Observer.raiseCollectionChanged" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2171 /// <param name="name" type="String"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2172 Sys.Observer.raiseEvent(this, "propertyChanged", new Sys.PropertyChangedEventArgs(name));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2173 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2174 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2175 Sys.Observer._arrayMethods = {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2176 add_collectionChanged: function(handler) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2177 Sys.Observer._addEventHandler(this, "collectionChanged", handler);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2178 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2179 remove_collectionChanged: function(handler) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2180 Sys.Observer._removeEventHandler(this, "collectionChanged", handler);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2181 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2182 add: function(item) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2183 /// <summary locid="M:J#Sys.Observer.raiseCollectionChanged" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2184 /// <param name="item" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2185 Sys.Observer.add(this, item);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2186 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2187 addRange: function(items) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2188 /// <summary locid="M:J#Sys.Observer.raiseCollectionChanged" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2189 /// <param name="items" type="Array" elementMayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2190 Sys.Observer.addRange(this, items);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2191 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2192 clear: function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2193 /// <summary locid="M:J#Sys.Observer.raiseCollectionChanged" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2194 Sys.Observer.clear(this);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2195 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2196 insert: function(index, item) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2197 /// <summary locid="M:J#Sys.Observer.raiseCollectionChanged" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2198 /// <param name="index" type="Number" integer="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2199 /// <param name="item" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2200 Sys.Observer.insert(this, index, item);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2201 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2202 remove: function(item) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2203 /// <summary locid="M:J#Sys.Observer.raiseCollectionChanged" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2204 /// <param name="item" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2205 /// <returns type="Boolean"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2206 return Sys.Observer.remove(this, item);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2207 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2208 removeAt: function(index) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2209 /// <summary locid="M:J#Sys.Observer.raiseCollectionChanged" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2210 /// <param name="index" type="Number" integer="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2211 Sys.Observer.removeAt(this, index);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2212 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2213 raiseCollectionChanged: function(changes) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2214 /// <summary locid="M:J#Sys.Observer.raiseCollectionChanged" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2215 /// <param name="changes" type="Array" elementType="Sys.CollectionChange"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2216 Sys.Observer.raiseEvent(this, "collectionChanged", new Sys.NotifyCollectionChangedEventArgs(changes));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2217 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2218 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2219 Sys.Observer._getContext = function Sys$Observer$_getContext(obj, create) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2220 var ctx = obj._observerContext;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2221 if (ctx) return ctx();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2222 if (create) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2223 return (obj._observerContext = Sys.Observer._createContext())();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2224 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2225 return null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2226 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2227 Sys.Observer._createContext = function Sys$Observer$_createContext() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2228 var ctx = {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2229 events: new Sys.EventHandlerList()
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2230 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2231 return function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2232 return ctx;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2233 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2234 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2235 Date._appendPreOrPostMatch = function Date$_appendPreOrPostMatch(preMatch, strBuilder) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2236 var quoteCount = 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2237 var escaped = false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2238 for (var i = 0, il = preMatch.length; i < il; i++) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2239 var c = preMatch.charAt(i);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2240 switch (c) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2241 case '\'':
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2242 if (escaped) strBuilder.append("'");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2243 else quoteCount++;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2244 escaped = false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2245 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2246 case '\\':
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2247 if (escaped) strBuilder.append("\\");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2248 escaped = !escaped;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2249 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2250 default:
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2251 strBuilder.append(c);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2252 escaped = false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2253 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2254 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2255 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2256 return quoteCount;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2257 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2258 Date._expandFormat = function Date$_expandFormat(dtf, format) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2259 if (!format) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2260 format = "F";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2261 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2262 var len = format.length;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2263 if (len === 1) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2264 switch (format) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2265 case "d":
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2266 return dtf.ShortDatePattern;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2267 case "D":
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2268 return dtf.LongDatePattern;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2269 case "t":
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2270 return dtf.ShortTimePattern;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2271 case "T":
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2272 return dtf.LongTimePattern;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2273 case "f":
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2274 return dtf.LongDatePattern + " " + dtf.ShortTimePattern;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2275 case "F":
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2276 return dtf.FullDateTimePattern;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2277 case "M": case "m":
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2278 return dtf.MonthDayPattern;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2279 case "s":
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2280 return dtf.SortableDateTimePattern;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2281 case "Y": case "y":
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2282 return dtf.YearMonthPattern;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2283 default:
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2284 throw Error.format(Sys.Res.formatInvalidString);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2285 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2286 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2287 else if ((len === 2) && (format.charAt(0) === "%")) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2288 format = format.charAt(1);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2289 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2290 return format;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2291 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2292 Date._expandYear = function Date$_expandYear(dtf, year) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2293 var now = new Date(),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2294 era = Date._getEra(now);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2295 if (year < 100) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2296 var curr = Date._getEraYear(now, dtf, era);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2297 year += curr - (curr % 100);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2298 if (year > dtf.Calendar.TwoDigitYearMax) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2299 year -= 100;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2300 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2301 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2302 return year;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2303 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2304 Date._getEra = function Date$_getEra(date, eras) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2305 if (!eras) return 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2306 var start, ticks = date.getTime();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2307 for (var i = 0, l = eras.length; i < l; i += 4) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2308 start = eras[i+2];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2309 if ((start === null) || (ticks >= start)) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2310 return i;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2311 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2312 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2313 return 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2314 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2315 Date._getEraYear = function Date$_getEraYear(date, dtf, era, sortable) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2316 var year = date.getFullYear();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2317 if (!sortable && dtf.eras) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2318 year -= dtf.eras[era + 3];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2319 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2320 return year;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2321 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2322 Date._getParseRegExp = function Date$_getParseRegExp(dtf, format) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2323 if (!dtf._parseRegExp) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2324 dtf._parseRegExp = {};
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2325 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2326 else if (dtf._parseRegExp[format]) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2327 return dtf._parseRegExp[format];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2328 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2329 var expFormat = Date._expandFormat(dtf, format);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2330 expFormat = expFormat.replace(/([\^\$\.\*\+\?\|\[\]\(\)\{\}])/g, "\\\\$1");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2331 var regexp = new Sys.StringBuilder("^");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2332 var groups = [];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2333 var index = 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2334 var quoteCount = 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2335 var tokenRegExp = Date._getTokenRegExp();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2336 var match;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2337 while ((match = tokenRegExp.exec(expFormat)) !== null) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2338 var preMatch = expFormat.slice(index, match.index);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2339 index = tokenRegExp.lastIndex;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2340 quoteCount += Date._appendPreOrPostMatch(preMatch, regexp);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2341 if ((quoteCount%2) === 1) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2342 regexp.append(match[0]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2343 continue;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2344 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2345 switch (match[0]) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2346 case 'dddd': case 'ddd':
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2347 case 'MMMM': case 'MMM':
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2348 case 'gg': case 'g':
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2349 regexp.append("(\\D+)");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2350 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2351 case 'tt': case 't':
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2352 regexp.append("(\\D*)");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2353 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2354 case 'yyyy':
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2355 regexp.append("(\\d{4})");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2356 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2357 case 'fff':
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2358 regexp.append("(\\d{3})");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2359 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2360 case 'ff':
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2361 regexp.append("(\\d{2})");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2362 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2363 case 'f':
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2364 regexp.append("(\\d)");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2365 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2366 case 'dd': case 'd':
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2367 case 'MM': case 'M':
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2368 case 'yy': case 'y':
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2369 case 'HH': case 'H':
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2370 case 'hh': case 'h':
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2371 case 'mm': case 'm':
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2372 case 'ss': case 's':
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2373 regexp.append("(\\d\\d?)");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2374 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2375 case 'zzz':
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2376 regexp.append("([+-]?\\d\\d?:\\d{2})");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2377 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2378 case 'zz': case 'z':
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2379 regexp.append("([+-]?\\d\\d?)");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2380 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2381 case '/':
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2382 regexp.append("(\\" + dtf.DateSeparator + ")");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2383 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2384 default:
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2385 Sys.Debug.fail("Invalid date format pattern");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2386 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2387 Array.add(groups, match[0]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2388 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2389 Date._appendPreOrPostMatch(expFormat.slice(index), regexp);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2390 regexp.append("$");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2391 var regexpStr = regexp.toString().replace(/\s+/g, "\\s+");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2392 var parseRegExp = {'regExp': regexpStr, 'groups': groups};
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2393 dtf._parseRegExp[format] = parseRegExp;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2394 return parseRegExp;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2395 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2396 Date._getTokenRegExp = function Date$_getTokenRegExp() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2397 return /\/|dddd|ddd|dd|d|MMMM|MMM|MM|M|yyyy|yy|y|hh|h|HH|H|mm|m|ss|s|tt|t|fff|ff|f|zzz|zz|z|gg|g/g;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2398 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2399 Date.parseLocale = function Date$parseLocale(value, formats) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2400 /// <summary locid="M:J#Date.parseLocale" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2401 /// <param name="value" type="String"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2402 /// <param name="formats" parameterArray="true" optional="true" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2403 /// <returns type="Date"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2404 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2405 {name: "value", type: String},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2406 {name: "formats", mayBeNull: true, optional: true, parameterArray: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2407 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2408 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2409 return Date._parse(value, Sys.CultureInfo.CurrentCulture, arguments);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2410 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2411 Date.parseInvariant = function Date$parseInvariant(value, formats) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2412 /// <summary locid="M:J#Date.parseInvariant" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2413 /// <param name="value" type="String"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2414 /// <param name="formats" parameterArray="true" optional="true" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2415 /// <returns type="Date"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2416 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2417 {name: "value", type: String},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2418 {name: "formats", mayBeNull: true, optional: true, parameterArray: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2419 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2420 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2421 return Date._parse(value, Sys.CultureInfo.InvariantCulture, arguments);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2422 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2423 Date._parse = function Date$_parse(value, cultureInfo, args) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2424 var i, l, date, format, formats, custom = false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2425 for (i = 1, l = args.length; i < l; i++) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2426 format = args[i];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2427 if (format) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2428 custom = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2429 date = Date._parseExact(value, format, cultureInfo);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2430 if (date) return date;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2431 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2432 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2433 if (! custom) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2434 formats = cultureInfo._getDateTimeFormats();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2435 for (i = 0, l = formats.length; i < l; i++) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2436 date = Date._parseExact(value, formats[i], cultureInfo);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2437 if (date) return date;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2438 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2439 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2440 return null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2441 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2442 Date._parseExact = function Date$_parseExact(value, format, cultureInfo) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2443 value = value.trim();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2444 var dtf = cultureInfo.dateTimeFormat,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2445 parseInfo = Date._getParseRegExp(dtf, format),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2446 match = new RegExp(parseInfo.regExp).exec(value);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2447 if (match === null) return null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2448
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2449 var groups = parseInfo.groups,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2450 era = null, year = null, month = null, date = null, weekDay = null,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2451 hour = 0, hourOffset, min = 0, sec = 0, msec = 0, tzMinOffset = null,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2452 pmHour = false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2453 for (var j = 0, jl = groups.length; j < jl; j++) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2454 var matchGroup = match[j+1];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2455 if (matchGroup) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2456 switch (groups[j]) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2457 case 'dd': case 'd':
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2458 date = parseInt(matchGroup, 10);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2459 if ((date < 1) || (date > 31)) return null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2460 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2461 case 'MMMM':
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2462 month = cultureInfo._getMonthIndex(matchGroup);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2463 if ((month < 0) || (month > 11)) return null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2464 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2465 case 'MMM':
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2466 month = cultureInfo._getAbbrMonthIndex(matchGroup);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2467 if ((month < 0) || (month > 11)) return null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2468 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2469 case 'M': case 'MM':
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2470 month = parseInt(matchGroup, 10) - 1;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2471 if ((month < 0) || (month > 11)) return null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2472 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2473 case 'y': case 'yy':
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2474 year = Date._expandYear(dtf,parseInt(matchGroup, 10));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2475 if ((year < 0) || (year > 9999)) return null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2476 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2477 case 'yyyy':
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2478 year = parseInt(matchGroup, 10);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2479 if ((year < 0) || (year > 9999)) return null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2480 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2481 case 'h': case 'hh':
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2482 hour = parseInt(matchGroup, 10);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2483 if (hour === 12) hour = 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2484 if ((hour < 0) || (hour > 11)) return null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2485 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2486 case 'H': case 'HH':
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2487 hour = parseInt(matchGroup, 10);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2488 if ((hour < 0) || (hour > 23)) return null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2489 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2490 case 'm': case 'mm':
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2491 min = parseInt(matchGroup, 10);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2492 if ((min < 0) || (min > 59)) return null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2493 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2494 case 's': case 'ss':
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2495 sec = parseInt(matchGroup, 10);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2496 if ((sec < 0) || (sec > 59)) return null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2497 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2498 case 'tt': case 't':
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2499 var upperToken = matchGroup.toUpperCase();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2500 pmHour = (upperToken === dtf.PMDesignator.toUpperCase());
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2501 if (!pmHour && (upperToken !== dtf.AMDesignator.toUpperCase())) return null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2502 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2503 case 'f':
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2504 msec = parseInt(matchGroup, 10) * 100;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2505 if ((msec < 0) || (msec > 999)) return null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2506 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2507 case 'ff':
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2508 msec = parseInt(matchGroup, 10) * 10;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2509 if ((msec < 0) || (msec > 999)) return null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2510 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2511 case 'fff':
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2512 msec = parseInt(matchGroup, 10);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2513 if ((msec < 0) || (msec > 999)) return null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2514 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2515 case 'dddd':
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2516 weekDay = cultureInfo._getDayIndex(matchGroup);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2517 if ((weekDay < 0) || (weekDay > 6)) return null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2518 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2519 case 'ddd':
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2520 weekDay = cultureInfo._getAbbrDayIndex(matchGroup);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2521 if ((weekDay < 0) || (weekDay > 6)) return null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2522 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2523 case 'zzz':
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2524 var offsets = matchGroup.split(/:/);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2525 if (offsets.length !== 2) return null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2526 hourOffset = parseInt(offsets[0], 10);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2527 if ((hourOffset < -12) || (hourOffset > 13)) return null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2528 var minOffset = parseInt(offsets[1], 10);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2529 if ((minOffset < 0) || (minOffset > 59)) return null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2530 tzMinOffset = (hourOffset * 60) + (matchGroup.startsWith('-')? -minOffset : minOffset);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2531 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2532 case 'z': case 'zz':
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2533 hourOffset = parseInt(matchGroup, 10);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2534 if ((hourOffset < -12) || (hourOffset > 13)) return null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2535 tzMinOffset = hourOffset * 60;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2536 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2537 case 'g': case 'gg':
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2538 var eraName = matchGroup;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2539 if (!eraName || !dtf.eras) return null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2540 eraName = eraName.toLowerCase().trim();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2541 for (var i = 0, l = dtf.eras.length; i < l; i += 4) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2542 if (eraName === dtf.eras[i + 1].toLowerCase()) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2543 era = i;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2544 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2545 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2546 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2547 if (era === null) return null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2548 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2549 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2550 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2551 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2552 var result = new Date(), defaults, convert = dtf.Calendar.convert;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2553 if (convert) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2554 defaults = convert.fromGregorian(result);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2555 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2556 if (!convert) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2557 defaults = [result.getFullYear(), result.getMonth(), result.getDate()];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2558 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2559 if (year === null) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2560 year = defaults[0];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2561 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2562 else if (dtf.eras) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2563 year += dtf.eras[(era || 0) + 3];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2564 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2565 if (month === null) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2566 month = defaults[1];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2567 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2568 if (date === null) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2569 date = defaults[2];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2570 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2571 if (convert) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2572 result = convert.toGregorian(year, month, date);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2573 if (result === null) return null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2574 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2575 else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2576 result.setFullYear(year, month, date);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2577 if (result.getDate() !== date) return null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2578 if ((weekDay !== null) && (result.getDay() !== weekDay)) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2579 return null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2580 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2581 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2582 if (pmHour && (hour < 12)) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2583 hour += 12;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2584 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2585 result.setHours(hour, min, sec, msec);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2586 if (tzMinOffset !== null) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2587 var adjustedMin = result.getMinutes() - (tzMinOffset + result.getTimezoneOffset());
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2588 result.setHours(result.getHours() + parseInt(adjustedMin/60, 10), adjustedMin%60);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2589 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2590 return result;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2591 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2592 Date.prototype.format = function Date$format(format) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2593 /// <summary locid="M:J#Date.format" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2594 /// <param name="format" type="String"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2595 /// <returns type="String"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2596 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2597 {name: "format", type: String}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2598 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2599 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2600 return this._toFormattedString(format, Sys.CultureInfo.InvariantCulture);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2601 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2602 Date.prototype.localeFormat = function Date$localeFormat(format) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2603 /// <summary locid="M:J#Date.localeFormat" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2604 /// <param name="format" type="String"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2605 /// <returns type="String"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2606 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2607 {name: "format", type: String}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2608 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2609 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2610 return this._toFormattedString(format, Sys.CultureInfo.CurrentCulture);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2611 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2612 Date.prototype._toFormattedString = function Date$_toFormattedString(format, cultureInfo) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2613 var dtf = cultureInfo.dateTimeFormat,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2614 convert = dtf.Calendar.convert;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2615 if (!format || !format.length || (format === 'i')) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2616 if (cultureInfo && cultureInfo.name.length) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2617 if (convert) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2618 return this._toFormattedString(dtf.FullDateTimePattern, cultureInfo);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2619 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2620 else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2621 var eraDate = new Date(this.getTime());
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2622 var era = Date._getEra(this, dtf.eras);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2623 eraDate.setFullYear(Date._getEraYear(this, dtf, era));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2624 return eraDate.toLocaleString();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2625 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2626 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2627 else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2628 return this.toString();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2629 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2630 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2631 var eras = dtf.eras,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2632 sortable = (format === "s");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2633 format = Date._expandFormat(dtf, format);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2634 var ret = new Sys.StringBuilder();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2635 var hour;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2636 function addLeadingZero(num) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2637 if (num < 10) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2638 return '0' + num;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2639 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2640 return num.toString();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2641 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2642 function addLeadingZeros(num) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2643 if (num < 10) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2644 return '00' + num;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2645 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2646 if (num < 100) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2647 return '0' + num;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2648 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2649 return num.toString();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2650 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2651 function padYear(year) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2652 if (year < 10) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2653 return '000' + year;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2654 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2655 else if (year < 100) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2656 return '00' + year;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2657 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2658 else if (year < 1000) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2659 return '0' + year;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2660 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2661 return year.toString();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2662 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2663
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2664 var foundDay, checkedDay, dayPartRegExp = /([^d]|^)(d|dd)([^d]|$)/g;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2665 function hasDay() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2666 if (foundDay || checkedDay) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2667 return foundDay;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2668 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2669 foundDay = dayPartRegExp.test(format);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2670 checkedDay = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2671 return foundDay;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2672 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2673
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2674 var quoteCount = 0,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2675 tokenRegExp = Date._getTokenRegExp(),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2676 converted;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2677 if (!sortable && convert) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2678 converted = convert.fromGregorian(this);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2679 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2680 for (;;) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2681 var index = tokenRegExp.lastIndex;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2682 var ar = tokenRegExp.exec(format);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2683 var preMatch = format.slice(index, ar ? ar.index : format.length);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2684 quoteCount += Date._appendPreOrPostMatch(preMatch, ret);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2685 if (!ar) break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2686 if ((quoteCount%2) === 1) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2687 ret.append(ar[0]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2688 continue;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2689 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2690
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2691 function getPart(date, part) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2692 if (converted) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2693 return converted[part];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2694 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2695 switch (part) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2696 case 0: return date.getFullYear();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2697 case 1: return date.getMonth();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2698 case 2: return date.getDate();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2699 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2700 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2701 switch (ar[0]) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2702 case "dddd":
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2703 ret.append(dtf.DayNames[this.getDay()]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2704 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2705 case "ddd":
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2706 ret.append(dtf.AbbreviatedDayNames[this.getDay()]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2707 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2708 case "dd":
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2709 foundDay = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2710 ret.append(addLeadingZero(getPart(this, 2)));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2711 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2712 case "d":
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2713 foundDay = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2714 ret.append(getPart(this, 2));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2715 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2716 case "MMMM":
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2717 ret.append((dtf.MonthGenitiveNames && hasDay())
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2718 ? dtf.MonthGenitiveNames[getPart(this, 1)]
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2719 : dtf.MonthNames[getPart(this, 1)]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2720 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2721 case "MMM":
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2722 ret.append((dtf.AbbreviatedMonthGenitiveNames && hasDay())
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2723 ? dtf.AbbreviatedMonthGenitiveNames[getPart(this, 1)]
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2724 : dtf.AbbreviatedMonthNames[getPart(this, 1)]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2725 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2726 case "MM":
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2727 ret.append(addLeadingZero(getPart(this, 1) + 1));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2728 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2729 case "M":
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2730 ret.append(getPart(this, 1) + 1);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2731 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2732 case "yyyy":
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2733 ret.append(padYear(converted ? converted[0] : Date._getEraYear(this, dtf, Date._getEra(this, eras), sortable)));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2734 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2735 case "yy":
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2736 ret.append(addLeadingZero((converted ? converted[0] : Date._getEraYear(this, dtf, Date._getEra(this, eras), sortable)) % 100));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2737 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2738 case "y":
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2739 ret.append((converted ? converted[0] : Date._getEraYear(this, dtf, Date._getEra(this, eras), sortable)) % 100);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2740 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2741 case "hh":
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2742 hour = this.getHours() % 12;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2743 if (hour === 0) hour = 12;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2744 ret.append(addLeadingZero(hour));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2745 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2746 case "h":
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2747 hour = this.getHours() % 12;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2748 if (hour === 0) hour = 12;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2749 ret.append(hour);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2750 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2751 case "HH":
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2752 ret.append(addLeadingZero(this.getHours()));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2753 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2754 case "H":
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2755 ret.append(this.getHours());
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2756 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2757 case "mm":
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2758 ret.append(addLeadingZero(this.getMinutes()));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2759 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2760 case "m":
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2761 ret.append(this.getMinutes());
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2762 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2763 case "ss":
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2764 ret.append(addLeadingZero(this.getSeconds()));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2765 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2766 case "s":
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2767 ret.append(this.getSeconds());
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2768 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2769 case "tt":
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2770 ret.append((this.getHours() < 12) ? dtf.AMDesignator : dtf.PMDesignator);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2771 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2772 case "t":
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2773 ret.append(((this.getHours() < 12) ? dtf.AMDesignator : dtf.PMDesignator).charAt(0));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2774 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2775 case "f":
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2776 ret.append(addLeadingZeros(this.getMilliseconds()).charAt(0));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2777 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2778 case "ff":
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2779 ret.append(addLeadingZeros(this.getMilliseconds()).substr(0, 2));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2780 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2781 case "fff":
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2782 ret.append(addLeadingZeros(this.getMilliseconds()));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2783 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2784 case "z":
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2785 hour = this.getTimezoneOffset() / 60;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2786 ret.append(((hour <= 0) ? '+' : '-') + Math.floor(Math.abs(hour)));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2787 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2788 case "zz":
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2789 hour = this.getTimezoneOffset() / 60;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2790 ret.append(((hour <= 0) ? '+' : '-') + addLeadingZero(Math.floor(Math.abs(hour))));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2791 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2792 case "zzz":
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2793 hour = this.getTimezoneOffset() / 60;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2794 ret.append(((hour <= 0) ? '+' : '-') + addLeadingZero(Math.floor(Math.abs(hour))) +
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2795 ":" + addLeadingZero(Math.abs(this.getTimezoneOffset() % 60)));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2796 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2797 case "g":
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2798 case "gg":
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2799 if (dtf.eras) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2800 ret.append(dtf.eras[Date._getEra(this, eras) + 1]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2801 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2802 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2803 case "/":
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2804 ret.append(dtf.DateSeparator);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2805 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2806 default:
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2807 Sys.Debug.fail("Invalid date format pattern");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2808 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2809 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2810 return ret.toString();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2811 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2812 String.localeFormat = function String$localeFormat(format, args) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2813 /// <summary locid="M:J#String.localeFormat" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2814 /// <param name="format" type="String"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2815 /// <param name="args" parameterArray="true" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2816 /// <returns type="String"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2817 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2818 {name: "format", type: String},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2819 {name: "args", mayBeNull: true, parameterArray: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2820 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2821 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2822 return String._toFormattedString(true, arguments);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2823 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2824 Number.parseLocale = function Number$parseLocale(value) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2825 /// <summary locid="M:J#Number.parseLocale" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2826 /// <param name="value" type="String"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2827 /// <returns type="Number"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2828 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2829 {name: "value", type: String}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2830 ], false);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2831 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2832 return Number._parse(value, Sys.CultureInfo.CurrentCulture);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2833 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2834 Number.parseInvariant = function Number$parseInvariant(value) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2835 /// <summary locid="M:J#Number.parseInvariant" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2836 /// <param name="value" type="String"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2837 /// <returns type="Number"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2838 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2839 {name: "value", type: String}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2840 ], false);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2841 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2842 return Number._parse(value, Sys.CultureInfo.InvariantCulture);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2843 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2844 Number._parse = function Number$_parse(value, cultureInfo) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2845 value = value.trim();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2846
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2847 if (value.match(/^[+-]?infinity$/i)) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2848 return parseFloat(value);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2849 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2850 if (value.match(/^0x[a-f0-9]+$/i)) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2851 return parseInt(value);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2852 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2853 var numFormat = cultureInfo.numberFormat;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2854 var signInfo = Number._parseNumberNegativePattern(value, numFormat, numFormat.NumberNegativePattern);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2855 var sign = signInfo[0];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2856 var num = signInfo[1];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2857
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2858 if ((sign === '') && (numFormat.NumberNegativePattern !== 1)) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2859 signInfo = Number._parseNumberNegativePattern(value, numFormat, 1);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2860 sign = signInfo[0];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2861 num = signInfo[1];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2862 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2863 if (sign === '') sign = '+';
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2864
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2865 var exponent;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2866 var intAndFraction;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2867 var exponentPos = num.indexOf('e');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2868 if (exponentPos < 0) exponentPos = num.indexOf('E');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2869 if (exponentPos < 0) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2870 intAndFraction = num;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2871 exponent = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2872 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2873 else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2874 intAndFraction = num.substr(0, exponentPos);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2875 exponent = num.substr(exponentPos + 1);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2876 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2877
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2878 var integer;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2879 var fraction;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2880 var decimalPos = intAndFraction.indexOf(numFormat.NumberDecimalSeparator);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2881 if (decimalPos < 0) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2882 integer = intAndFraction;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2883 fraction = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2884 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2885 else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2886 integer = intAndFraction.substr(0, decimalPos);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2887 fraction = intAndFraction.substr(decimalPos + numFormat.NumberDecimalSeparator.length);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2888 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2889
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2890 integer = integer.split(numFormat.NumberGroupSeparator).join('');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2891 var altNumGroupSeparator = numFormat.NumberGroupSeparator.replace(/\u00A0/g, " ");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2892 if (numFormat.NumberGroupSeparator !== altNumGroupSeparator) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2893 integer = integer.split(altNumGroupSeparator).join('');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2894 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2895
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2896 var p = sign + integer;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2897 if (fraction !== null) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2898 p += '.' + fraction;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2899 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2900 if (exponent !== null) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2901 var expSignInfo = Number._parseNumberNegativePattern(exponent, numFormat, 1);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2902 if (expSignInfo[0] === '') {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2903 expSignInfo[0] = '+';
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2904 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2905 p += 'e' + expSignInfo[0] + expSignInfo[1];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2906 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2907 if (p.match(/^[+-]?\d*\.?\d*(e[+-]?\d+)?$/)) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2908 return parseFloat(p);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2909 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2910 return Number.NaN;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2911 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2912 Number._parseNumberNegativePattern = function Number$_parseNumberNegativePattern(value, numFormat, numberNegativePattern) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2913 var neg = numFormat.NegativeSign;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2914 var pos = numFormat.PositiveSign;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2915 switch (numberNegativePattern) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2916 case 4:
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2917 neg = ' ' + neg;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2918 pos = ' ' + pos;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2919 case 3:
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2920 if (value.endsWith(neg)) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2921 return ['-', value.substr(0, value.length - neg.length)];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2922 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2923 else if (value.endsWith(pos)) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2924 return ['+', value.substr(0, value.length - pos.length)];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2925 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2926 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2927 case 2:
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2928 neg += ' ';
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2929 pos += ' ';
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2930 case 1:
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2931 if (value.startsWith(neg)) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2932 return ['-', value.substr(neg.length)];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2933 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2934 else if (value.startsWith(pos)) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2935 return ['+', value.substr(pos.length)];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2936 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2937 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2938 case 0:
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2939 if (value.startsWith('(') && value.endsWith(')')) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2940 return ['-', value.substr(1, value.length - 2)];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2941 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2942 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2943 default:
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2944 Sys.Debug.fail("");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2945 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2946 return ['', value];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2947 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2948 Number.prototype.format = function Number$format(format) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2949 /// <summary locid="M:J#Number.format" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2950 /// <param name="format" type="String"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2951 /// <returns type="String"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2952 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2953 {name: "format", type: String}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2954 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2955 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2956 return this._toFormattedString(format, Sys.CultureInfo.InvariantCulture);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2957 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2958 Number.prototype.localeFormat = function Number$localeFormat(format) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2959 /// <summary locid="M:J#Number.localeFormat" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2960 /// <param name="format" type="String"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2961 /// <returns type="String"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2962 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2963 {name: "format", type: String}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2964 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2965 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2966 return this._toFormattedString(format, Sys.CultureInfo.CurrentCulture);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2967 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2968 Number.prototype._toFormattedString = function Number$_toFormattedString(format, cultureInfo) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2969 if (!format || (format.length === 0) || (format === 'i')) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2970 if (cultureInfo && (cultureInfo.name.length > 0)) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2971 return this.toLocaleString();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2972 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2973 else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2974 return this.toString();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2975 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2976 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2977
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2978 var _percentPositivePattern = ["n %", "n%", "%n" ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2979 var _percentNegativePattern = ["-n %", "-n%", "-%n"];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2980 var _numberNegativePattern = ["(n)","-n","- n","n-","n -"];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2981 var _currencyPositivePattern = ["$n","n$","$ n","n $"];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2982 var _currencyNegativePattern = ["($n)","-$n","$-n","$n-","(n$)","-n$","n-$","n$-","-n $","-$ n","n $-","$ n-","$ -n","n- $","($ n)","(n $)"];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2983 function zeroPad(str, count, left) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2984 for (var l=str.length; l < count; l++) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2985 str = (left ? ('0' + str) : (str + '0'));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2986 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2987 return str;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2988 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2989
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2990 function expandNumber(number, precision, groupSizes, sep, decimalChar) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2991 Sys.Debug.assert(groupSizes.length > 0, "groupSizes must be an array of at least 1");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2992 var curSize = groupSizes[0];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2993 var curGroupIndex = 1;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2994 var factor = Math.pow(10, precision);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2995 var rounded = (Math.round(number * factor) / factor);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2996 if (!isFinite(rounded)) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2997 rounded = number;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2998 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2999 number = rounded;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3000
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3001 var numberString = number.toString();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3002 var right = "";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3003 var exponent;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3004
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3005
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3006 var split = numberString.split(/e/i);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3007 numberString = split[0];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3008 exponent = (split.length > 1 ? parseInt(split[1]) : 0);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3009 split = numberString.split('.');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3010 numberString = split[0];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3011 right = split.length > 1 ? split[1] : "";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3012
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3013 var l;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3014 if (exponent > 0) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3015 right = zeroPad(right, exponent, false);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3016 numberString += right.slice(0, exponent);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3017 right = right.substr(exponent);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3018 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3019 else if (exponent < 0) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3020 exponent = -exponent;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3021 numberString = zeroPad(numberString, exponent+1, true);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3022 right = numberString.slice(-exponent, numberString.length) + right;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3023 numberString = numberString.slice(0, -exponent);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3024 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3025 if (precision > 0) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3026 if (right.length > precision) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3027 right = right.slice(0, precision);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3028 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3029 else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3030 right = zeroPad(right, precision, false);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3031 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3032 right = decimalChar + right;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3033 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3034 else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3035 right = "";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3036 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3037 var stringIndex = numberString.length-1;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3038 var ret = "";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3039 while (stringIndex >= 0) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3040 if (curSize === 0 || curSize > stringIndex) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3041 if (ret.length > 0)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3042 return numberString.slice(0, stringIndex + 1) + sep + ret + right;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3043 else
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3044 return numberString.slice(0, stringIndex + 1) + right;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3045 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3046 if (ret.length > 0)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3047 ret = numberString.slice(stringIndex - curSize + 1, stringIndex+1) + sep + ret;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3048 else
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3049 ret = numberString.slice(stringIndex - curSize + 1, stringIndex+1);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3050 stringIndex -= curSize;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3051 if (curGroupIndex < groupSizes.length) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3052 curSize = groupSizes[curGroupIndex];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3053 curGroupIndex++;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3054 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3055 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3056 return numberString.slice(0, stringIndex + 1) + sep + ret + right;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3057 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3058 var nf = cultureInfo.numberFormat;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3059 var number = Math.abs(this);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3060 if (!format)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3061 format = "D";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3062 var precision = -1;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3063 if (format.length > 1) precision = parseInt(format.slice(1), 10);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3064 var pattern;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3065 switch (format.charAt(0)) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3066 case "d":
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3067 case "D":
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3068 pattern = 'n';
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3069 if (precision !== -1) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3070 number = zeroPad(""+number, precision, true);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3071 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3072 if (this < 0) number = -number;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3073 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3074 case "c":
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3075 case "C":
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3076 if (this < 0) pattern = _currencyNegativePattern[nf.CurrencyNegativePattern];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3077 else pattern = _currencyPositivePattern[nf.CurrencyPositivePattern];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3078 if (precision === -1) precision = nf.CurrencyDecimalDigits;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3079 number = expandNumber(Math.abs(this), precision, nf.CurrencyGroupSizes, nf.CurrencyGroupSeparator, nf.CurrencyDecimalSeparator);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3080 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3081 case "n":
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3082 case "N":
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3083 if (this < 0) pattern = _numberNegativePattern[nf.NumberNegativePattern];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3084 else pattern = 'n';
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3085 if (precision === -1) precision = nf.NumberDecimalDigits;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3086 number = expandNumber(Math.abs(this), precision, nf.NumberGroupSizes, nf.NumberGroupSeparator, nf.NumberDecimalSeparator);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3087 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3088 case "p":
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3089 case "P":
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3090 if (this < 0) pattern = _percentNegativePattern[nf.PercentNegativePattern];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3091 else pattern = _percentPositivePattern[nf.PercentPositivePattern];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3092 if (precision === -1) precision = nf.PercentDecimalDigits;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3093 number = expandNumber(Math.abs(this) * 100, precision, nf.PercentGroupSizes, nf.PercentGroupSeparator, nf.PercentDecimalSeparator);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3094 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3095 default:
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3096 throw Error.format(Sys.Res.formatBadFormatSpecifier);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3097 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3098 var regex = /n|\$|-|%/g;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3099 var ret = "";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3100 for (;;) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3101 var index = regex.lastIndex;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3102 var ar = regex.exec(pattern);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3103 ret += pattern.slice(index, ar ? ar.index : pattern.length);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3104 if (!ar)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3105 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3106 switch (ar[0]) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3107 case "n":
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3108 ret += number;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3109 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3110 case "$":
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3111 ret += nf.CurrencySymbol;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3112 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3113 case "-":
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3114 if (/[1-9]/.test(number)) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3115 ret += nf.NegativeSign;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3116 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3117 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3118 case "%":
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3119 ret += nf.PercentSymbol;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3120 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3121 default:
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3122 Sys.Debug.fail("Invalid number format pattern");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3123 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3124 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3125 return ret;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3126 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3127
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3128 Sys.CultureInfo = function Sys$CultureInfo(name, numberFormat, dateTimeFormat) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3129 /// <summary locid="M:J#Sys.CultureInfo.#ctor" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3130 /// <param name="name" type="String"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3131 /// <param name="numberFormat" type="Object"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3132 /// <param name="dateTimeFormat" type="Object"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3133 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3134 {name: "name", type: String},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3135 {name: "numberFormat", type: Object},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3136 {name: "dateTimeFormat", type: Object}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3137 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3138 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3139 this.name = name;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3140 this.numberFormat = numberFormat;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3141 this.dateTimeFormat = dateTimeFormat;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3142 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3143 function Sys$CultureInfo$_getDateTimeFormats() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3144 if (! this._dateTimeFormats) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3145 var dtf = this.dateTimeFormat;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3146 this._dateTimeFormats =
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3147 [ dtf.MonthDayPattern,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3148 dtf.YearMonthPattern,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3149 dtf.ShortDatePattern,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3150 dtf.ShortTimePattern,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3151 dtf.LongDatePattern,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3152 dtf.LongTimePattern,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3153 dtf.FullDateTimePattern,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3154 dtf.RFC1123Pattern,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3155 dtf.SortableDateTimePattern,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3156 dtf.UniversalSortableDateTimePattern ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3157 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3158 return this._dateTimeFormats;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3159 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3160 function Sys$CultureInfo$_getIndex(value, a1, a2) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3161 var upper = this._toUpper(value),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3162 i = Array.indexOf(a1, upper);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3163 if (i === -1) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3164 i = Array.indexOf(a2, upper);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3165 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3166 return i;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3167 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3168 function Sys$CultureInfo$_getMonthIndex(value) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3169 if (!this._upperMonths) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3170 this._upperMonths = this._toUpperArray(this.dateTimeFormat.MonthNames);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3171 this._upperMonthsGenitive = this._toUpperArray(this.dateTimeFormat.MonthGenitiveNames);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3172 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3173 return this._getIndex(value, this._upperMonths, this._upperMonthsGenitive);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3174 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3175 function Sys$CultureInfo$_getAbbrMonthIndex(value) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3176 if (!this._upperAbbrMonths) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3177 this._upperAbbrMonths = this._toUpperArray(this.dateTimeFormat.AbbreviatedMonthNames);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3178 this._upperAbbrMonthsGenitive = this._toUpperArray(this.dateTimeFormat.AbbreviatedMonthGenitiveNames);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3179 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3180 return this._getIndex(value, this._upperAbbrMonths, this._upperAbbrMonthsGenitive);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3181 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3182 function Sys$CultureInfo$_getDayIndex(value) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3183 if (!this._upperDays) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3184 this._upperDays = this._toUpperArray(this.dateTimeFormat.DayNames);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3185 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3186 return Array.indexOf(this._upperDays, this._toUpper(value));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3187 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3188 function Sys$CultureInfo$_getAbbrDayIndex(value) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3189 if (!this._upperAbbrDays) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3190 this._upperAbbrDays = this._toUpperArray(this.dateTimeFormat.AbbreviatedDayNames);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3191 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3192 return Array.indexOf(this._upperAbbrDays, this._toUpper(value));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3193 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3194 function Sys$CultureInfo$_toUpperArray(arr) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3195 var result = [];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3196 for (var i = 0, il = arr.length; i < il; i++) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3197 result[i] = this._toUpper(arr[i]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3198 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3199 return result;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3200 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3201 function Sys$CultureInfo$_toUpper(value) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3202 return value.split("\u00A0").join(' ').toUpperCase();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3203 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3204 Sys.CultureInfo.prototype = {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3205 _getDateTimeFormats: Sys$CultureInfo$_getDateTimeFormats,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3206 _getIndex: Sys$CultureInfo$_getIndex,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3207 _getMonthIndex: Sys$CultureInfo$_getMonthIndex,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3208 _getAbbrMonthIndex: Sys$CultureInfo$_getAbbrMonthIndex,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3209 _getDayIndex: Sys$CultureInfo$_getDayIndex,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3210 _getAbbrDayIndex: Sys$CultureInfo$_getAbbrDayIndex,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3211 _toUpperArray: Sys$CultureInfo$_toUpperArray,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3212 _toUpper: Sys$CultureInfo$_toUpper
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3213 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3214 Sys.CultureInfo.registerClass('Sys.CultureInfo');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3215 Sys.CultureInfo._parse = function Sys$CultureInfo$_parse(value) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3216 var dtf = value.dateTimeFormat;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3217 if (dtf && !dtf.eras) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3218 dtf.eras = value.eras;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3219 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3220 return new Sys.CultureInfo(value.name, value.numberFormat, dtf);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3221 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3222 Sys.CultureInfo.InvariantCulture = Sys.CultureInfo._parse({"name":"","numberFormat":{"CurrencyDecimalDigits":2,"CurrencyDecimalSeparator":".","IsReadOnly":true,"CurrencyGroupSizes":[3],"NumberGroupSizes":[3],"PercentGroupSizes":[3],"CurrencyGroupSeparator":",","CurrencySymbol":"\u00A4","NaNSymbol":"NaN","CurrencyNegativePattern":0,"NumberNegativePattern":1,"PercentPositivePattern":0,"PercentNegativePattern":0,"NegativeInfinitySymbol":"-Infinity","NegativeSign":"-","NumberDecimalDigits":2,"NumberDecimalSeparator":".","NumberGroupSeparator":",","CurrencyPositivePattern":0,"PositiveInfinitySymbol":"Infinity","PositiveSign":"+","PercentDecimalDigits":2,"PercentDecimalSeparator":".","PercentGroupSeparator":",","PercentSymbol":"%","PerMilleSymbol":"\u2030","NativeDigits":["0","1","2","3","4","5","6","7","8","9"],"DigitSubstitution":1},"dateTimeFormat":{"AMDesignator":"AM","Calendar":{"MinSupportedDateTime":"@-62135568000000@","MaxSupportedDateTime":"@253402300799999@","AlgorithmType":1,"CalendarType":1,"Eras":[1],"TwoDigitYearMax":2029,"IsReadOnly":true},"DateSeparator":"/","FirstDayOfWeek":0,"CalendarWeekRule":0,"FullDateTimePattern":"dddd, dd MMMM yyyy HH:mm:ss","LongDatePattern":"dddd, dd MMMM yyyy","LongTimePattern":"HH:mm:ss","MonthDayPattern":"MMMM dd","PMDesignator":"PM","RFC1123Pattern":"ddd, dd MMM yyyy HH\':\'mm\':\'ss \'GMT\'","ShortDatePattern":"MM/dd/yyyy","ShortTimePattern":"HH:mm","SortableDateTimePattern":"yyyy\'-\'MM\'-\'dd\'T\'HH\':\'mm\':\'ss","TimeSeparator":":","UniversalSortableDateTimePattern":"yyyy\'-\'MM\'-\'dd HH\':\'mm\':\'ss\'Z\'","YearMonthPattern":"yyyy MMMM","AbbreviatedDayNames":["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],"ShortestDayNames":["Su","Mo","Tu","We","Th","Fr","Sa"],"DayNames":["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],"AbbreviatedMonthNames":["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""],"MonthNames":["January","February","March","April","May","June","July","August","September","October","November","December",""],"IsReadOnly":true,"NativeCalendarName":"Gregorian Calendar","AbbreviatedMonthGenitiveNames":["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""],"MonthGenitiveNames":["January","February","March","April","May","June","July","August","September","October","November","December",""]},"eras":[1,"A.D.",null,0]});
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3223 if (typeof(__cultureInfo) === "object") {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3224 Sys.CultureInfo.CurrentCulture = Sys.CultureInfo._parse(__cultureInfo);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3225 delete __cultureInfo;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3226 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3227 else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3228 Sys.CultureInfo.CurrentCulture = Sys.CultureInfo._parse({"name":"en-US","numberFormat":{"CurrencyDecimalDigits":2,"CurrencyDecimalSeparator":".","IsReadOnly":false,"CurrencyGroupSizes":[3],"NumberGroupSizes":[3],"PercentGroupSizes":[3],"CurrencyGroupSeparator":",","CurrencySymbol":"$","NaNSymbol":"NaN","CurrencyNegativePattern":0,"NumberNegativePattern":1,"PercentPositivePattern":0,"PercentNegativePattern":0,"NegativeInfinitySymbol":"-Infinity","NegativeSign":"-","NumberDecimalDigits":2,"NumberDecimalSeparator":".","NumberGroupSeparator":",","CurrencyPositivePattern":0,"PositiveInfinitySymbol":"Infinity","PositiveSign":"+","PercentDecimalDigits":2,"PercentDecimalSeparator":".","PercentGroupSeparator":",","PercentSymbol":"%","PerMilleSymbol":"\u2030","NativeDigits":["0","1","2","3","4","5","6","7","8","9"],"DigitSubstitution":1},"dateTimeFormat":{"AMDesignator":"AM","Calendar":{"MinSupportedDateTime":"@-62135568000000@","MaxSupportedDateTime":"@253402300799999@","AlgorithmType":1,"CalendarType":1,"Eras":[1],"TwoDigitYearMax":2029,"IsReadOnly":false},"DateSeparator":"/","FirstDayOfWeek":0,"CalendarWeekRule":0,"FullDateTimePattern":"dddd, MMMM dd, yyyy h:mm:ss tt","LongDatePattern":"dddd, MMMM dd, yyyy","LongTimePattern":"h:mm:ss tt","MonthDayPattern":"MMMM dd","PMDesignator":"PM","RFC1123Pattern":"ddd, dd MMM yyyy HH\':\'mm\':\'ss \'GMT\'","ShortDatePattern":"M/d/yyyy","ShortTimePattern":"h:mm tt","SortableDateTimePattern":"yyyy\'-\'MM\'-\'dd\'T\'HH\':\'mm\':\'ss","TimeSeparator":":","UniversalSortableDateTimePattern":"yyyy\'-\'MM\'-\'dd HH\':\'mm\':\'ss\'Z\'","YearMonthPattern":"MMMM, yyyy","AbbreviatedDayNames":["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],"ShortestDayNames":["Su","Mo","Tu","We","Th","Fr","Sa"],"DayNames":["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],"AbbreviatedMonthNames":["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""],"MonthNames":["January","February","March","April","May","June","July","August","September","October","November","December",""],"IsReadOnly":false,"NativeCalendarName":"Gregorian Calendar","AbbreviatedMonthGenitiveNames":["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""],"MonthGenitiveNames":["January","February","March","April","May","June","July","August","September","October","November","December",""]},"eras":[1,"A.D.",null,0]});
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3229 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3230 Type.registerNamespace('Sys.Serialization');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3231 Sys.Serialization.JavaScriptSerializer = function Sys$Serialization$JavaScriptSerializer() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3232 /// <summary locid="M:J#Sys.Serialization.JavaScriptSerializer.#ctor" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3233 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3234 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3235 Sys.Serialization.JavaScriptSerializer.registerClass('Sys.Serialization.JavaScriptSerializer');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3236 Sys.Serialization.JavaScriptSerializer._charsToEscapeRegExs = [];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3237 Sys.Serialization.JavaScriptSerializer._charsToEscape = [];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3238 Sys.Serialization.JavaScriptSerializer._dateRegEx = new RegExp('(^|[^\\\\])\\"\\\\/Date\\((-?[0-9]+)(?:[a-zA-Z]|(?:\\+|-)[0-9]{4})?\\)\\\\/\\"', 'g');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3239 Sys.Serialization.JavaScriptSerializer._escapeChars = {};
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3240 Sys.Serialization.JavaScriptSerializer._escapeRegEx = new RegExp('["\\\\\\x00-\\x1F]', 'i');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3241 Sys.Serialization.JavaScriptSerializer._escapeRegExGlobal = new RegExp('["\\\\\\x00-\\x1F]', 'g');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3242 Sys.Serialization.JavaScriptSerializer._jsonRegEx = new RegExp('[^,:{}\\[\\]0-9.\\-+Eaeflnr-u \\n\\r\\t]', 'g');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3243 Sys.Serialization.JavaScriptSerializer._jsonStringRegEx = new RegExp('"(\\\\.|[^"\\\\])*"', 'g');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3244 Sys.Serialization.JavaScriptSerializer._serverTypeFieldName = '__type';
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3245 Sys.Serialization.JavaScriptSerializer._init = function Sys$Serialization$JavaScriptSerializer$_init() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3246 var replaceChars = ['\\u0000','\\u0001','\\u0002','\\u0003','\\u0004','\\u0005','\\u0006','\\u0007',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3247 '\\b','\\t','\\n','\\u000b','\\f','\\r','\\u000e','\\u000f','\\u0010','\\u0011',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3248 '\\u0012','\\u0013','\\u0014','\\u0015','\\u0016','\\u0017','\\u0018','\\u0019',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3249 '\\u001a','\\u001b','\\u001c','\\u001d','\\u001e','\\u001f'];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3250 Sys.Serialization.JavaScriptSerializer._charsToEscape[0] = '\\';
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3251 Sys.Serialization.JavaScriptSerializer._charsToEscapeRegExs['\\'] = new RegExp('\\\\', 'g');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3252 Sys.Serialization.JavaScriptSerializer._escapeChars['\\'] = '\\\\';
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3253 Sys.Serialization.JavaScriptSerializer._charsToEscape[1] = '"';
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3254 Sys.Serialization.JavaScriptSerializer._charsToEscapeRegExs['"'] = new RegExp('"', 'g');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3255 Sys.Serialization.JavaScriptSerializer._escapeChars['"'] = '\\"';
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3256 for (var i = 0; i < 32; i++) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3257 var c = String.fromCharCode(i);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3258 Sys.Serialization.JavaScriptSerializer._charsToEscape[i+2] = c;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3259 Sys.Serialization.JavaScriptSerializer._charsToEscapeRegExs[c] = new RegExp(c, 'g');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3260 Sys.Serialization.JavaScriptSerializer._escapeChars[c] = replaceChars[i];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3261 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3262 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3263 Sys.Serialization.JavaScriptSerializer._serializeBooleanWithBuilder = function Sys$Serialization$JavaScriptSerializer$_serializeBooleanWithBuilder(object, stringBuilder) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3264 stringBuilder.append(object.toString());
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3265 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3266 Sys.Serialization.JavaScriptSerializer._serializeNumberWithBuilder = function Sys$Serialization$JavaScriptSerializer$_serializeNumberWithBuilder(object, stringBuilder) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3267 if (isFinite(object)) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3268 stringBuilder.append(String(object));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3269 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3270 else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3271 throw Error.invalidOperation(Sys.Res.cannotSerializeNonFiniteNumbers);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3272 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3273 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3274 Sys.Serialization.JavaScriptSerializer._serializeStringWithBuilder = function Sys$Serialization$JavaScriptSerializer$_serializeStringWithBuilder(string, stringBuilder) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3275 stringBuilder.append('"');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3276 if (Sys.Serialization.JavaScriptSerializer._escapeRegEx.test(string)) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3277 if (Sys.Serialization.JavaScriptSerializer._charsToEscape.length === 0) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3278 Sys.Serialization.JavaScriptSerializer._init();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3279 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3280 if (string.length < 128) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3281 string = string.replace(Sys.Serialization.JavaScriptSerializer._escapeRegExGlobal,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3282 function(x) { return Sys.Serialization.JavaScriptSerializer._escapeChars[x]; });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3283 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3284 else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3285 for (var i = 0; i < 34; i++) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3286 var c = Sys.Serialization.JavaScriptSerializer._charsToEscape[i];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3287 if (string.indexOf(c) !== -1) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3288 if (Sys.Browser.agent === Sys.Browser.Opera || Sys.Browser.agent === Sys.Browser.FireFox) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3289 string = string.split(c).join(Sys.Serialization.JavaScriptSerializer._escapeChars[c]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3290 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3291 else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3292 string = string.replace(Sys.Serialization.JavaScriptSerializer._charsToEscapeRegExs[c],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3293 Sys.Serialization.JavaScriptSerializer._escapeChars[c]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3294 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3295 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3296 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3297 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3298 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3299 stringBuilder.append(string);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3300 stringBuilder.append('"');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3301 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3302 Sys.Serialization.JavaScriptSerializer._serializeWithBuilder = function Sys$Serialization$JavaScriptSerializer$_serializeWithBuilder(object, stringBuilder, sort, prevObjects) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3303 var i;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3304 switch (typeof object) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3305 case 'object':
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3306 if (object) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3307 if (prevObjects){
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3308 for( var j = 0; j < prevObjects.length; j++) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3309 if (prevObjects[j] === object) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3310 throw Error.invalidOperation(Sys.Res.cannotSerializeObjectWithCycle);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3311 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3312 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3313 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3314 else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3315 prevObjects = new Array();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3316 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3317 try {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3318 Array.add(prevObjects, object);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3319
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3320 if (Number.isInstanceOfType(object)){
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3321 Sys.Serialization.JavaScriptSerializer._serializeNumberWithBuilder(object, stringBuilder);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3322 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3323 else if (Boolean.isInstanceOfType(object)){
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3324 Sys.Serialization.JavaScriptSerializer._serializeBooleanWithBuilder(object, stringBuilder);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3325 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3326 else if (String.isInstanceOfType(object)){
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3327 Sys.Serialization.JavaScriptSerializer._serializeStringWithBuilder(object, stringBuilder);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3328 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3329
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3330 else if (Array.isInstanceOfType(object)) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3331 stringBuilder.append('[');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3332
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3333 for (i = 0; i < object.length; ++i) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3334 if (i > 0) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3335 stringBuilder.append(',');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3336 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3337 Sys.Serialization.JavaScriptSerializer._serializeWithBuilder(object[i], stringBuilder,false,prevObjects);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3338 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3339 stringBuilder.append(']');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3340 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3341 else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3342 if (Date.isInstanceOfType(object)) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3343 stringBuilder.append('"\\/Date(');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3344 stringBuilder.append(object.getTime());
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3345 stringBuilder.append(')\\/"');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3346 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3347 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3348 var properties = [];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3349 var propertyCount = 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3350 for (var name in object) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3351 if (name.startsWith('$')) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3352 continue;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3353 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3354 if (name === Sys.Serialization.JavaScriptSerializer._serverTypeFieldName && propertyCount !== 0){
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3355 properties[propertyCount++] = properties[0];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3356 properties[0] = name;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3357 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3358 else{
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3359 properties[propertyCount++] = name;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3360 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3361 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3362 if (sort) properties.sort();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3363 stringBuilder.append('{');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3364 var needComma = false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3365
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3366 for (i=0; i<propertyCount; i++) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3367 var value = object[properties[i]];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3368 if (typeof value !== 'undefined' && typeof value !== 'function') {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3369 if (needComma) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3370 stringBuilder.append(',');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3371 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3372 else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3373 needComma = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3374 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3375
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3376 Sys.Serialization.JavaScriptSerializer._serializeWithBuilder(properties[i], stringBuilder, sort, prevObjects);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3377 stringBuilder.append(':');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3378 Sys.Serialization.JavaScriptSerializer._serializeWithBuilder(value, stringBuilder, sort, prevObjects);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3379
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3380 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3381 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3382 stringBuilder.append('}');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3383 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3384 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3385 finally {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3386 Array.removeAt(prevObjects, prevObjects.length - 1);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3387 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3388 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3389 else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3390 stringBuilder.append('null');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3391 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3392 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3393 case 'number':
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3394 Sys.Serialization.JavaScriptSerializer._serializeNumberWithBuilder(object, stringBuilder);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3395 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3396 case 'string':
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3397 Sys.Serialization.JavaScriptSerializer._serializeStringWithBuilder(object, stringBuilder);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3398 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3399 case 'boolean':
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3400 Sys.Serialization.JavaScriptSerializer._serializeBooleanWithBuilder(object, stringBuilder);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3401 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3402 default:
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3403 stringBuilder.append('null');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3404 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3405 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3406 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3407 Sys.Serialization.JavaScriptSerializer.serialize = function Sys$Serialization$JavaScriptSerializer$serialize(object) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3408 /// <summary locid="M:J#Sys.Serialization.JavaScriptSerializer.serialize" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3409 /// <param name="object" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3410 /// <returns type="String"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3411 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3412 {name: "object", mayBeNull: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3413 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3414 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3415 var stringBuilder = new Sys.StringBuilder();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3416 Sys.Serialization.JavaScriptSerializer._serializeWithBuilder(object, stringBuilder, false);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3417 return stringBuilder.toString();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3418 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3419 Sys.Serialization.JavaScriptSerializer.deserialize = function Sys$Serialization$JavaScriptSerializer$deserialize(data, secure) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3420 /// <summary locid="M:J#Sys.Serialization.JavaScriptSerializer.deserialize" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3421 /// <param name="data" type="String"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3422 /// <param name="secure" type="Boolean" optional="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3423 /// <returns></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3424 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3425 {name: "data", type: String},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3426 {name: "secure", type: Boolean, optional: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3427 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3428 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3429
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3430 if (data.length === 0) throw Error.argument('data', Sys.Res.cannotDeserializeEmptyString);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3431 try {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3432 var exp = data.replace(Sys.Serialization.JavaScriptSerializer._dateRegEx, "$1new Date($2)");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3433
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3434 if (secure && Sys.Serialization.JavaScriptSerializer._jsonRegEx.test(
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3435 exp.replace(Sys.Serialization.JavaScriptSerializer._jsonStringRegEx, ''))) throw null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3436 return eval('(' + exp + ')');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3437 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3438 catch (e) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3439 throw Error.argument('data', Sys.Res.cannotDeserializeInvalidJson);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3440 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3441 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3442 Type.registerNamespace('Sys.UI');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3443
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3444 Sys.EventHandlerList = function Sys$EventHandlerList() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3445 /// <summary locid="M:J#Sys.EventHandlerList.#ctor" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3446 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3447 this._list = {};
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3448 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3449 function Sys$EventHandlerList$_addHandler(id, handler) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3450 Array.add(this._getEvent(id, true), handler);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3451 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3452 function Sys$EventHandlerList$addHandler(id, handler) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3453 /// <summary locid="M:J#Sys.EventHandlerList.addHandler" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3454 /// <param name="id" type="String"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3455 /// <param name="handler" type="Function"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3456 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3457 {name: "id", type: String},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3458 {name: "handler", type: Function}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3459 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3460 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3461 this._addHandler(id, handler);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3462 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3463 function Sys$EventHandlerList$_removeHandler(id, handler) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3464 var evt = this._getEvent(id);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3465 if (!evt) return;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3466 Array.remove(evt, handler);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3467 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3468 function Sys$EventHandlerList$removeHandler(id, handler) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3469 /// <summary locid="M:J#Sys.EventHandlerList.removeHandler" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3470 /// <param name="id" type="String"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3471 /// <param name="handler" type="Function"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3472 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3473 {name: "id", type: String},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3474 {name: "handler", type: Function}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3475 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3476 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3477 this._removeHandler(id, handler);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3478 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3479 function Sys$EventHandlerList$getHandler(id) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3480 /// <summary locid="M:J#Sys.EventHandlerList.getHandler" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3481 /// <param name="id" type="String"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3482 /// <returns type="Function"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3483 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3484 {name: "id", type: String}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3485 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3486 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3487 var evt = this._getEvent(id);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3488 if (!evt || (evt.length === 0)) return null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3489 evt = Array.clone(evt);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3490 return function(source, args) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3491 for (var i = 0, l = evt.length; i < l; i++) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3492 evt[i](source, args);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3493 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3494 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3495 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3496 function Sys$EventHandlerList$_getEvent(id, create) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3497 if (!this._list[id]) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3498 if (!create) return null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3499 this._list[id] = [];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3500 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3501 return this._list[id];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3502 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3503 Sys.EventHandlerList.prototype = {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3504 _addHandler: Sys$EventHandlerList$_addHandler,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3505 addHandler: Sys$EventHandlerList$addHandler,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3506 _removeHandler: Sys$EventHandlerList$_removeHandler,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3507 removeHandler: Sys$EventHandlerList$removeHandler,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3508 getHandler: Sys$EventHandlerList$getHandler,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3509 _getEvent: Sys$EventHandlerList$_getEvent
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3510 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3511 Sys.EventHandlerList.registerClass('Sys.EventHandlerList');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3512 Sys.CommandEventArgs = function Sys$CommandEventArgs(commandName, commandArgument, commandSource) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3513 /// <summary locid="M:J#Sys.CommandEventArgs.#ctor" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3514 /// <param name="commandName" type="String"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3515 /// <param name="commandArgument" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3516 /// <param name="commandSource" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3517 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3518 {name: "commandName", type: String},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3519 {name: "commandArgument", mayBeNull: true},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3520 {name: "commandSource", mayBeNull: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3521 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3522 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3523 Sys.CommandEventArgs.initializeBase(this);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3524 this._commandName = commandName;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3525 this._commandArgument = commandArgument;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3526 this._commandSource = commandSource;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3527 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3528 function Sys$CommandEventArgs$get_commandName() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3529 /// <value type="String" locid="P:J#Sys.CommandEventArgs.commandName"></value>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3530 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3531 return this._commandName;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3532 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3533 function Sys$CommandEventArgs$get_commandArgument() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3534 /// <value mayBeNull="true" locid="P:J#Sys.CommandEventArgs.commandArgument"></value>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3535 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3536 return this._commandArgument;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3537 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3538 function Sys$CommandEventArgs$get_commandSource() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3539 /// <value mayBeNull="true" locid="P:J#Sys.CommandEventArgs.commandSource"></value>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3540 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3541 return this._commandSource;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3542 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3543 Sys.CommandEventArgs.prototype = {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3544 _commandName: null,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3545 _commandArgument: null,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3546 _commandSource: null,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3547 get_commandName: Sys$CommandEventArgs$get_commandName,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3548 get_commandArgument: Sys$CommandEventArgs$get_commandArgument,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3549 get_commandSource: Sys$CommandEventArgs$get_commandSource
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3550 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3551 Sys.CommandEventArgs.registerClass("Sys.CommandEventArgs", Sys.CancelEventArgs);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3552
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3553 Sys.INotifyPropertyChange = function Sys$INotifyPropertyChange() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3554 /// <summary locid="M:J#Sys.INotifyPropertyChange.#ctor" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3555 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3556 throw Error.notImplemented();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3557 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3558 function Sys$INotifyPropertyChange$add_propertyChanged(handler) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3559 /// <summary locid="E:J#Sys.INotifyPropertyChange.propertyChanged" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3560 var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3561 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3562 throw Error.notImplemented();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3563 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3564 function Sys$INotifyPropertyChange$remove_propertyChanged(handler) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3565 var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3566 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3567 throw Error.notImplemented();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3568 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3569 Sys.INotifyPropertyChange.prototype = {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3570 add_propertyChanged: Sys$INotifyPropertyChange$add_propertyChanged,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3571 remove_propertyChanged: Sys$INotifyPropertyChange$remove_propertyChanged
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3572 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3573 Sys.INotifyPropertyChange.registerInterface('Sys.INotifyPropertyChange');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3574
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3575 Sys.PropertyChangedEventArgs = function Sys$PropertyChangedEventArgs(propertyName) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3576 /// <summary locid="M:J#Sys.PropertyChangedEventArgs.#ctor" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3577 /// <param name="propertyName" type="String"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3578 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3579 {name: "propertyName", type: String}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3580 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3581 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3582 Sys.PropertyChangedEventArgs.initializeBase(this);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3583 this._propertyName = propertyName;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3584 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3585
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3586 function Sys$PropertyChangedEventArgs$get_propertyName() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3587 /// <value type="String" locid="P:J#Sys.PropertyChangedEventArgs.propertyName"></value>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3588 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3589 return this._propertyName;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3590 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3591 Sys.PropertyChangedEventArgs.prototype = {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3592 get_propertyName: Sys$PropertyChangedEventArgs$get_propertyName
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3593 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3594 Sys.PropertyChangedEventArgs.registerClass('Sys.PropertyChangedEventArgs', Sys.EventArgs);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3595
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3596 Sys.INotifyDisposing = function Sys$INotifyDisposing() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3597 /// <summary locid="M:J#Sys.INotifyDisposing.#ctor" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3598 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3599 throw Error.notImplemented();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3600 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3601 function Sys$INotifyDisposing$add_disposing(handler) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3602 /// <summary locid="E:J#Sys.INotifyDisposing.disposing" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3603 var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3604 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3605 throw Error.notImplemented();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3606 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3607 function Sys$INotifyDisposing$remove_disposing(handler) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3608 var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3609 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3610 throw Error.notImplemented();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3611 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3612 Sys.INotifyDisposing.prototype = {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3613 add_disposing: Sys$INotifyDisposing$add_disposing,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3614 remove_disposing: Sys$INotifyDisposing$remove_disposing
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3615 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3616 Sys.INotifyDisposing.registerInterface("Sys.INotifyDisposing");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3617
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3618 Sys.Component = function Sys$Component() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3619 /// <summary locid="M:J#Sys.Component.#ctor" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3620 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3621 if (Sys.Application) Sys.Application.registerDisposableObject(this);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3622 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3623 function Sys$Component$get_events() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3624 /// <value type="Sys.EventHandlerList" locid="P:J#Sys.Component.events"></value>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3625 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3626 if (!this._events) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3627 this._events = new Sys.EventHandlerList();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3628 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3629 return this._events;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3630 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3631 function Sys$Component$get_id() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3632 /// <value type="String" locid="P:J#Sys.Component.id"></value>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3633 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3634 return this._id;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3635 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3636 function Sys$Component$set_id(value) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3637 var e = Function._validateParams(arguments, [{name: "value", type: String}]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3638 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3639 if (this._idSet) throw Error.invalidOperation(Sys.Res.componentCantSetIdTwice);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3640 this._idSet = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3641 var oldId = this.get_id();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3642 if (oldId && Sys.Application.findComponent(oldId)) throw Error.invalidOperation(Sys.Res.componentCantSetIdAfterAddedToApp);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3643 this._id = value;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3644 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3645 function Sys$Component$get_isInitialized() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3646 /// <value type="Boolean" locid="P:J#Sys.Component.isInitialized"></value>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3647 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3648 return this._initialized;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3649 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3650 function Sys$Component$get_isUpdating() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3651 /// <value type="Boolean" locid="P:J#Sys.Component.isUpdating"></value>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3652 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3653 return this._updating;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3654 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3655 function Sys$Component$add_disposing(handler) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3656 /// <summary locid="E:J#Sys.Component.disposing" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3657 var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3658 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3659 this.get_events().addHandler("disposing", handler);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3660 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3661 function Sys$Component$remove_disposing(handler) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3662 var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3663 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3664 this.get_events().removeHandler("disposing", handler);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3665 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3666 function Sys$Component$add_propertyChanged(handler) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3667 /// <summary locid="E:J#Sys.Component.propertyChanged" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3668 var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3669 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3670 this.get_events().addHandler("propertyChanged", handler);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3671 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3672 function Sys$Component$remove_propertyChanged(handler) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3673 var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3674 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3675 this.get_events().removeHandler("propertyChanged", handler);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3676 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3677 function Sys$Component$beginUpdate() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3678 this._updating = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3679 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3680 function Sys$Component$dispose() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3681 if (this._events) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3682 var handler = this._events.getHandler("disposing");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3683 if (handler) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3684 handler(this, Sys.EventArgs.Empty);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3685 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3686 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3687 delete this._events;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3688 Sys.Application.unregisterDisposableObject(this);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3689 Sys.Application.removeComponent(this);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3690 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3691 function Sys$Component$endUpdate() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3692 this._updating = false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3693 if (!this._initialized) this.initialize();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3694 this.updated();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3695 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3696 function Sys$Component$initialize() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3697 this._initialized = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3698 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3699 function Sys$Component$raisePropertyChanged(propertyName) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3700 /// <summary locid="M:J#Sys.Component.raisePropertyChanged" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3701 /// <param name="propertyName" type="String"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3702 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3703 {name: "propertyName", type: String}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3704 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3705 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3706 if (!this._events) return;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3707 var handler = this._events.getHandler("propertyChanged");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3708 if (handler) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3709 handler(this, new Sys.PropertyChangedEventArgs(propertyName));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3710 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3711 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3712 function Sys$Component$updated() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3713 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3714 Sys.Component.prototype = {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3715 _id: null,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3716 _idSet: false,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3717 _initialized: false,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3718 _updating: false,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3719 get_events: Sys$Component$get_events,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3720 get_id: Sys$Component$get_id,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3721 set_id: Sys$Component$set_id,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3722 get_isInitialized: Sys$Component$get_isInitialized,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3723 get_isUpdating: Sys$Component$get_isUpdating,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3724 add_disposing: Sys$Component$add_disposing,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3725 remove_disposing: Sys$Component$remove_disposing,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3726 add_propertyChanged: Sys$Component$add_propertyChanged,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3727 remove_propertyChanged: Sys$Component$remove_propertyChanged,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3728 beginUpdate: Sys$Component$beginUpdate,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3729 dispose: Sys$Component$dispose,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3730 endUpdate: Sys$Component$endUpdate,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3731 initialize: Sys$Component$initialize,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3732 raisePropertyChanged: Sys$Component$raisePropertyChanged,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3733 updated: Sys$Component$updated
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3734 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3735 Sys.Component.registerClass('Sys.Component', null, Sys.IDisposable, Sys.INotifyPropertyChange, Sys.INotifyDisposing);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3736 function Sys$Component$_setProperties(target, properties) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3737 /// <summary locid="M:J#Sys.Component._setProperties" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3738 /// <param name="target"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3739 /// <param name="properties"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3740 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3741 {name: "target"},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3742 {name: "properties"}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3743 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3744 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3745 var current;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3746 var targetType = Object.getType(target);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3747 var isObject = (targetType === Object) || (targetType === Sys.UI.DomElement);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3748 var isComponent = Sys.Component.isInstanceOfType(target) && !target.get_isUpdating();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3749 if (isComponent) target.beginUpdate();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3750 for (var name in properties) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3751 var val = properties[name];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3752 var getter = isObject ? null : target["get_" + name];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3753 if (isObject || typeof(getter) !== 'function') {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3754 var targetVal = target[name];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3755 if (!isObject && typeof(targetVal) === 'undefined') throw Error.invalidOperation(String.format(Sys.Res.propertyUndefined, name));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3756 if (!val || (typeof(val) !== 'object') || (isObject && !targetVal)) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3757 target[name] = val;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3758 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3759 else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3760 Sys$Component$_setProperties(targetVal, val);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3761 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3762 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3763 else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3764 var setter = target["set_" + name];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3765 if (typeof(setter) === 'function') {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3766 setter.apply(target, [val]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3767 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3768 else if (val instanceof Array) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3769 current = getter.apply(target);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3770 if (!(current instanceof Array)) throw new Error.invalidOperation(String.format(Sys.Res.propertyNotAnArray, name));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3771 for (var i = 0, j = current.length, l= val.length; i < l; i++, j++) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3772 current[j] = val[i];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3773 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3774 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3775 else if ((typeof(val) === 'object') && (Object.getType(val) === Object)) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3776 current = getter.apply(target);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3777 if ((typeof(current) === 'undefined') || (current === null)) throw new Error.invalidOperation(String.format(Sys.Res.propertyNullOrUndefined, name));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3778 Sys$Component$_setProperties(current, val);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3779 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3780 else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3781 throw new Error.invalidOperation(String.format(Sys.Res.propertyNotWritable, name));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3782 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3783 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3784 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3785 if (isComponent) target.endUpdate();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3786 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3787 function Sys$Component$_setReferences(component, references) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3788 for (var name in references) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3789 var setter = component["set_" + name];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3790 var reference = $find(references[name]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3791 if (typeof(setter) !== 'function') throw new Error.invalidOperation(String.format(Sys.Res.propertyNotWritable, name));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3792 if (!reference) throw Error.invalidOperation(String.format(Sys.Res.referenceNotFound, references[name]));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3793 setter.apply(component, [reference]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3794 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3795 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3796 var $create = Sys.Component.create = function Sys$Component$create(type, properties, events, references, element) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3797 /// <summary locid="M:J#Sys.Component.create" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3798 /// <param name="type" type="Type"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3799 /// <param name="properties" optional="true" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3800 /// <param name="events" optional="true" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3801 /// <param name="references" optional="true" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3802 /// <param name="element" domElement="true" optional="true" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3803 /// <returns type="Sys.UI.Component"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3804 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3805 {name: "type", type: Type},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3806 {name: "properties", mayBeNull: true, optional: true},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3807 {name: "events", mayBeNull: true, optional: true},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3808 {name: "references", mayBeNull: true, optional: true},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3809 {name: "element", mayBeNull: true, domElement: true, optional: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3810 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3811 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3812 if (!type.inheritsFrom(Sys.Component)) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3813 throw Error.argument('type', String.format(Sys.Res.createNotComponent, type.getName()));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3814 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3815 if (type.inheritsFrom(Sys.UI.Behavior) || type.inheritsFrom(Sys.UI.Control)) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3816 if (!element) throw Error.argument('element', Sys.Res.createNoDom);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3817 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3818 else if (element) throw Error.argument('element', Sys.Res.createComponentOnDom);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3819 var component = (element ? new type(element): new type());
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3820 var app = Sys.Application;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3821 var creatingComponents = app.get_isCreatingComponents();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3822 component.beginUpdate();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3823 if (properties) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3824 Sys$Component$_setProperties(component, properties);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3825 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3826 if (events) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3827 for (var name in events) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3828 if (!(component["add_" + name] instanceof Function)) throw new Error.invalidOperation(String.format(Sys.Res.undefinedEvent, name));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3829 if (!(events[name] instanceof Function)) throw new Error.invalidOperation(Sys.Res.eventHandlerNotFunction);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3830 component["add_" + name](events[name]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3831 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3832 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3833 if (component.get_id()) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3834 app.addComponent(component);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3835 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3836 if (creatingComponents) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3837 app._createdComponents[app._createdComponents.length] = component;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3838 if (references) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3839 app._addComponentToSecondPass(component, references);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3840 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3841 else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3842 component.endUpdate();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3843 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3844 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3845 else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3846 if (references) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3847 Sys$Component$_setReferences(component, references);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3848 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3849 component.endUpdate();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3850 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3851 return component;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3852 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3853
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3854 Sys.UI.MouseButton = function Sys$UI$MouseButton() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3855 /// <summary locid="M:J#Sys.UI.MouseButton.#ctor" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3856 /// <field name="leftButton" type="Number" integer="true" static="true" locid="F:J#Sys.UI.MouseButton.leftButton"></field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3857 /// <field name="middleButton" type="Number" integer="true" static="true" locid="F:J#Sys.UI.MouseButton.middleButton"></field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3858 /// <field name="rightButton" type="Number" integer="true" static="true" locid="F:J#Sys.UI.MouseButton.rightButton"></field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3859 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3860 throw Error.notImplemented();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3861 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3862 Sys.UI.MouseButton.prototype = {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3863 leftButton: 0,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3864 middleButton: 1,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3865 rightButton: 2
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3866 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3867 Sys.UI.MouseButton.registerEnum("Sys.UI.MouseButton");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3868
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3869 Sys.UI.Key = function Sys$UI$Key() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3870 /// <summary locid="M:J#Sys.UI.Key.#ctor" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3871 /// <field name="backspace" type="Number" integer="true" static="true" locid="F:J#Sys.UI.Key.backspace"></field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3872 /// <field name="tab" type="Number" integer="true" static="true" locid="F:J#Sys.UI.Key.tab"></field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3873 /// <field name="enter" type="Number" integer="true" static="true" locid="F:J#Sys.UI.Key.enter"></field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3874 /// <field name="esc" type="Number" integer="true" static="true" locid="F:J#Sys.UI.Key.esc"></field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3875 /// <field name="space" type="Number" integer="true" static="true" locid="F:J#Sys.UI.Key.space"></field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3876 /// <field name="pageUp" type="Number" integer="true" static="true" locid="F:J#Sys.UI.Key.pageUp"></field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3877 /// <field name="pageDown" type="Number" integer="true" static="true" locid="F:J#Sys.UI.Key.pageDown"></field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3878 /// <field name="end" type="Number" integer="true" static="true" locid="F:J#Sys.UI.Key.end"></field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3879 /// <field name="home" type="Number" integer="true" static="true" locid="F:J#Sys.UI.Key.home"></field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3880 /// <field name="left" type="Number" integer="true" static="true" locid="F:J#Sys.UI.Key.left"></field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3881 /// <field name="up" type="Number" integer="true" static="true" locid="F:J#Sys.UI.Key.up"></field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3882 /// <field name="right" type="Number" integer="true" static="true" locid="F:J#Sys.UI.Key.right"></field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3883 /// <field name="down" type="Number" integer="true" static="true" locid="F:J#Sys.UI.Key.down"></field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3884 /// <field name="del" type="Number" integer="true" static="true" locid="F:J#Sys.UI.Key.del"></field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3885 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3886 throw Error.notImplemented();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3887 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3888 Sys.UI.Key.prototype = {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3889 backspace: 8,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3890 tab: 9,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3891 enter: 13,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3892 esc: 27,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3893 space: 32,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3894 pageUp: 33,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3895 pageDown: 34,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3896 end: 35,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3897 home: 36,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3898 left: 37,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3899 up: 38,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3900 right: 39,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3901 down: 40,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3902 del: 127
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3903 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3904 Sys.UI.Key.registerEnum("Sys.UI.Key");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3905
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3906 Sys.UI.Point = function Sys$UI$Point(x, y) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3907 /// <summary locid="M:J#Sys.UI.Point.#ctor" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3908 /// <param name="x" type="Number" integer="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3909 /// <param name="y" type="Number" integer="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3910 /// <field name="x" type="Number" integer="true" locid="F:J#Sys.UI.Point.x"></field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3911 /// <field name="y" type="Number" integer="true" locid="F:J#Sys.UI.Point.y"></field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3912 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3913 {name: "x", type: Number, integer: true},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3914 {name: "y", type: Number, integer: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3915 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3916 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3917 this.x = x;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3918 this.y = y;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3919 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3920 Sys.UI.Point.registerClass('Sys.UI.Point');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3921
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3922 Sys.UI.Bounds = function Sys$UI$Bounds(x, y, width, height) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3923 /// <summary locid="M:J#Sys.UI.Bounds.#ctor" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3924 /// <param name="x" type="Number" integer="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3925 /// <param name="y" type="Number" integer="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3926 /// <param name="width" type="Number" integer="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3927 /// <param name="height" type="Number" integer="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3928 /// <field name="x" type="Number" integer="true" locid="F:J#Sys.UI.Bounds.x"></field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3929 /// <field name="y" type="Number" integer="true" locid="F:J#Sys.UI.Bounds.y"></field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3930 /// <field name="width" type="Number" integer="true" locid="F:J#Sys.UI.Bounds.width"></field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3931 /// <field name="height" type="Number" integer="true" locid="F:J#Sys.UI.Bounds.height"></field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3932 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3933 {name: "x", type: Number, integer: true},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3934 {name: "y", type: Number, integer: true},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3935 {name: "width", type: Number, integer: true},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3936 {name: "height", type: Number, integer: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3937 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3938 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3939 this.x = x;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3940 this.y = y;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3941 this.height = height;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3942 this.width = width;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3943 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3944 Sys.UI.Bounds.registerClass('Sys.UI.Bounds');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3945
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3946 Sys.UI.DomEvent = function Sys$UI$DomEvent(eventObject) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3947 /// <summary locid="M:J#Sys.UI.DomEvent.#ctor" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3948 /// <param name="eventObject"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3949 /// <field name="altKey" type="Boolean" locid="F:J#Sys.UI.DomEvent.altKey"></field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3950 /// <field name="button" type="Sys.UI.MouseButton" locid="F:J#Sys.UI.DomEvent.button"></field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3951 /// <field name="charCode" type="Number" integer="true" locid="F:J#Sys.UI.DomEvent.charCode"></field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3952 /// <field name="clientX" type="Number" integer="true" locid="F:J#Sys.UI.DomEvent.clientX"></field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3953 /// <field name="clientY" type="Number" integer="true" locid="F:J#Sys.UI.DomEvent.clientY"></field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3954 /// <field name="ctrlKey" type="Boolean" locid="F:J#Sys.UI.DomEvent.ctrlKey"></field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3955 /// <field name="keyCode" type="Number" integer="true" locid="F:J#Sys.UI.DomEvent.keyCode"></field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3956 /// <field name="offsetX" type="Number" integer="true" locid="F:J#Sys.UI.DomEvent.offsetX"></field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3957 /// <field name="offsetY" type="Number" integer="true" locid="F:J#Sys.UI.DomEvent.offsetY"></field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3958 /// <field name="screenX" type="Number" integer="true" locid="F:J#Sys.UI.DomEvent.screenX"></field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3959 /// <field name="screenY" type="Number" integer="true" locid="F:J#Sys.UI.DomEvent.screenY"></field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3960 /// <field name="shiftKey" type="Boolean" locid="F:J#Sys.UI.DomEvent.shiftKey"></field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3961 /// <field name="target" locid="F:J#Sys.UI.DomEvent.target"></field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3962 /// <field name="type" type="String" locid="F:J#Sys.UI.DomEvent.type"></field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3963 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3964 {name: "eventObject"}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3965 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3966 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3967 var ev = eventObject;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3968 var etype = this.type = ev.type.toLowerCase();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3969 this.rawEvent = ev;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3970 this.altKey = ev.altKey;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3971 if (typeof(ev.button) !== 'undefined') {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3972 this.button = (typeof(ev.which) !== 'undefined') ? ev.button :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3973 (ev.button === 4) ? Sys.UI.MouseButton.middleButton :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3974 (ev.button === 2) ? Sys.UI.MouseButton.rightButton :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3975 Sys.UI.MouseButton.leftButton;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3976 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3977 if (etype === 'keypress') {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3978 this.charCode = ev.charCode || ev.keyCode;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3979 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3980 else if (ev.keyCode && (ev.keyCode === 46)) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3981 this.keyCode = 127;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3982 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3983 else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3984 this.keyCode = ev.keyCode;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3985 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3986 this.clientX = ev.clientX;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3987 this.clientY = ev.clientY;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3988 this.ctrlKey = ev.ctrlKey;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3989 this.target = ev.target ? ev.target : ev.srcElement;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3990 if (!etype.startsWith('key')) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3991 if ((typeof(ev.offsetX) !== 'undefined') && (typeof(ev.offsetY) !== 'undefined')) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3992 this.offsetX = ev.offsetX;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3993 this.offsetY = ev.offsetY;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3994 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3995 else if (this.target && (this.target.nodeType !== 3) && (typeof(ev.clientX) === 'number')) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3996 var loc = Sys.UI.DomElement.getLocation(this.target);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3997 var w = Sys.UI.DomElement._getWindow(this.target);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3998 this.offsetX = (w.pageXOffset || 0) + ev.clientX - loc.x;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3999 this.offsetY = (w.pageYOffset || 0) + ev.clientY - loc.y;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4000 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4001 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4002 this.screenX = ev.screenX;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4003 this.screenY = ev.screenY;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4004 this.shiftKey = ev.shiftKey;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4005 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4006 function Sys$UI$DomEvent$preventDefault() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4007 /// <summary locid="M:J#Sys.UI.DomEvent.preventDefault" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4008 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4009 if (this.rawEvent.preventDefault) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4010 this.rawEvent.preventDefault();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4011 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4012 else if (window.event) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4013 this.rawEvent.returnValue = false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4014 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4015 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4016 function Sys$UI$DomEvent$stopPropagation() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4017 /// <summary locid="M:J#Sys.UI.DomEvent.stopPropagation" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4018 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4019 if (this.rawEvent.stopPropagation) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4020 this.rawEvent.stopPropagation();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4021 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4022 else if (window.event) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4023 this.rawEvent.cancelBubble = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4024 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4025 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4026 Sys.UI.DomEvent.prototype = {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4027 preventDefault: Sys$UI$DomEvent$preventDefault,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4028 stopPropagation: Sys$UI$DomEvent$stopPropagation
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4029 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4030 Sys.UI.DomEvent.registerClass('Sys.UI.DomEvent');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4031 var $addHandler = Sys.UI.DomEvent.addHandler = function Sys$UI$DomEvent$addHandler(element, eventName, handler, autoRemove) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4032 /// <summary locid="M:J#Sys.UI.DomEvent.addHandler" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4033 /// <param name="element"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4034 /// <param name="eventName" type="String"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4035 /// <param name="handler" type="Function"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4036 /// <param name="autoRemove" type="Boolean" optional="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4037 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4038 {name: "element"},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4039 {name: "eventName", type: String},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4040 {name: "handler", type: Function},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4041 {name: "autoRemove", type: Boolean, optional: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4042 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4043 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4044 Sys.UI.DomEvent._ensureDomNode(element);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4045 if (eventName === "error") throw Error.invalidOperation(Sys.Res.addHandlerCantBeUsedForError);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4046 if (!element._events) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4047 element._events = {};
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4048 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4049 var eventCache = element._events[eventName];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4050 if (!eventCache) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4051 element._events[eventName] = eventCache = [];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4052 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4053 var browserHandler;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4054 if (element.addEventListener) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4055 browserHandler = function(e) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4056 return handler.call(element, new Sys.UI.DomEvent(e));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4057 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4058 element.addEventListener(eventName, browserHandler, false);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4059 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4060 else if (element.attachEvent) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4061 browserHandler = function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4062 var e = {};
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4063 try {e = Sys.UI.DomElement._getWindow(element).event} catch(ex) {}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4064 return handler.call(element, new Sys.UI.DomEvent(e));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4065 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4066 element.attachEvent('on' + eventName, browserHandler);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4067 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4068 eventCache[eventCache.length] = {handler: handler, browserHandler: browserHandler, autoRemove: autoRemove };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4069 if (autoRemove) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4070 var d = element.dispose;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4071 if (d !== Sys.UI.DomEvent._disposeHandlers) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4072 element.dispose = Sys.UI.DomEvent._disposeHandlers;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4073 if (typeof(d) !== "undefined") {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4074 element._chainDispose = d;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4075 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4076 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4077 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4078 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4079 var $addHandlers = Sys.UI.DomEvent.addHandlers = function Sys$UI$DomEvent$addHandlers(element, events, handlerOwner, autoRemove) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4080 /// <summary locid="M:J#Sys.UI.DomEvent.addHandlers" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4081 /// <param name="element"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4082 /// <param name="events" type="Object"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4083 /// <param name="handlerOwner" optional="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4084 /// <param name="autoRemove" type="Boolean" optional="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4085 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4086 {name: "element"},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4087 {name: "events", type: Object},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4088 {name: "handlerOwner", optional: true},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4089 {name: "autoRemove", type: Boolean, optional: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4090 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4091 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4092 Sys.UI.DomEvent._ensureDomNode(element);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4093 for (var name in events) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4094 var handler = events[name];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4095 if (typeof(handler) !== 'function') throw Error.invalidOperation(Sys.Res.cantAddNonFunctionhandler);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4096 if (handlerOwner) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4097 handler = Function.createDelegate(handlerOwner, handler);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4098 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4099 $addHandler(element, name, handler, autoRemove || false);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4100 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4101 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4102 var $clearHandlers = Sys.UI.DomEvent.clearHandlers = function Sys$UI$DomEvent$clearHandlers(element) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4103 /// <summary locid="M:J#Sys.UI.DomEvent.clearHandlers" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4104 /// <param name="element"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4105 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4106 {name: "element"}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4107 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4108 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4109 Sys.UI.DomEvent._ensureDomNode(element);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4110 Sys.UI.DomEvent._clearHandlers(element, false);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4111 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4112 Sys.UI.DomEvent._clearHandlers = function Sys$UI$DomEvent$_clearHandlers(element, autoRemoving) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4113 if (element._events) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4114 var cache = element._events;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4115 for (var name in cache) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4116 var handlers = cache[name];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4117 for (var i = handlers.length - 1; i >= 0; i--) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4118 var entry = handlers[i];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4119 if (!autoRemoving || entry.autoRemove) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4120 $removeHandler(element, name, entry.handler);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4121 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4122 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4123 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4124 element._events = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4125 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4126 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4127 Sys.UI.DomEvent._disposeHandlers = function Sys$UI$DomEvent$_disposeHandlers() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4128 Sys.UI.DomEvent._clearHandlers(this, true);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4129 var d = this._chainDispose, type = typeof(d);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4130 if (type !== "undefined") {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4131 this.dispose = d;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4132 this._chainDispose = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4133 if (type === "function") {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4134 this.dispose();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4135 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4136 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4137 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4138 var $removeHandler = Sys.UI.DomEvent.removeHandler = function Sys$UI$DomEvent$removeHandler(element, eventName, handler) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4139 /// <summary locid="M:J#Sys.UI.DomEvent.removeHandler" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4140 /// <param name="element"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4141 /// <param name="eventName" type="String"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4142 /// <param name="handler" type="Function"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4143 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4144 {name: "element"},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4145 {name: "eventName", type: String},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4146 {name: "handler", type: Function}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4147 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4148 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4149 Sys.UI.DomEvent._removeHandler(element, eventName, handler);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4150 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4151 Sys.UI.DomEvent._removeHandler = function Sys$UI$DomEvent$_removeHandler(element, eventName, handler) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4152 Sys.UI.DomEvent._ensureDomNode(element);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4153 var browserHandler = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4154 if ((typeof(element._events) !== 'object') || !element._events) throw Error.invalidOperation(Sys.Res.eventHandlerInvalid);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4155 var cache = element._events[eventName];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4156 if (!(cache instanceof Array)) throw Error.invalidOperation(Sys.Res.eventHandlerInvalid);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4157 for (var i = 0, l = cache.length; i < l; i++) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4158 if (cache[i].handler === handler) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4159 browserHandler = cache[i].browserHandler;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4160 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4161 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4162 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4163 if (typeof(browserHandler) !== 'function') throw Error.invalidOperation(Sys.Res.eventHandlerInvalid);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4164 if (element.removeEventListener) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4165 element.removeEventListener(eventName, browserHandler, false);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4166 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4167 else if (element.detachEvent) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4168 element.detachEvent('on' + eventName, browserHandler);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4169 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4170 cache.splice(i, 1);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4171 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4172 Sys.UI.DomEvent._ensureDomNode = function Sys$UI$DomEvent$_ensureDomNode(element) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4173 if (element.tagName && (element.tagName.toUpperCase() === "SCRIPT")) return;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4174
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4175 var doc = element.ownerDocument || element.document || element;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4176 if ((typeof(element.document) !== 'object') && (element != doc) && (typeof(element.nodeType) !== 'number')) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4177 throw Error.argument("element", Sys.Res.argumentDomNode);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4178 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4179 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4180
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4181 Sys.UI.DomElement = function Sys$UI$DomElement() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4182 /// <summary locid="M:J#Sys.UI.DomElement.#ctor" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4183 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4184 throw Error.notImplemented();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4185 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4186 Sys.UI.DomElement.registerClass('Sys.UI.DomElement');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4187 Sys.UI.DomElement.addCssClass = function Sys$UI$DomElement$addCssClass(element, className) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4188 /// <summary locid="M:J#Sys.UI.DomElement.addCssClass" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4189 /// <param name="element" domElement="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4190 /// <param name="className" type="String"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4191 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4192 {name: "element", domElement: true},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4193 {name: "className", type: String}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4194 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4195 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4196 if (!Sys.UI.DomElement.containsCssClass(element, className)) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4197 if (element.className === '') {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4198 element.className = className;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4199 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4200 else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4201 element.className += ' ' + className;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4202 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4203 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4204 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4205 Sys.UI.DomElement.containsCssClass = function Sys$UI$DomElement$containsCssClass(element, className) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4206 /// <summary locid="M:J#Sys.UI.DomElement.containsCssClass" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4207 /// <param name="element" domElement="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4208 /// <param name="className" type="String"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4209 /// <returns type="Boolean"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4210 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4211 {name: "element", domElement: true},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4212 {name: "className", type: String}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4213 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4214 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4215 return Array.contains(element.className.split(' '), className);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4216 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4217 Sys.UI.DomElement.getBounds = function Sys$UI$DomElement$getBounds(element) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4218 /// <summary locid="M:J#Sys.UI.DomElement.getBounds" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4219 /// <param name="element" domElement="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4220 /// <returns type="Sys.UI.Bounds"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4221 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4222 {name: "element", domElement: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4223 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4224 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4225 var offset = Sys.UI.DomElement.getLocation(element);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4226 return new Sys.UI.Bounds(offset.x, offset.y, element.offsetWidth || 0, element.offsetHeight || 0);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4227 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4228 var $get = Sys.UI.DomElement.getElementById = function Sys$UI$DomElement$getElementById(id, element) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4229 /// <summary locid="M:J#Sys.UI.DomElement.getElementById" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4230 /// <param name="id" type="String"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4231 /// <param name="element" domElement="true" optional="true" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4232 /// <returns domElement="true" mayBeNull="true"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4233 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4234 {name: "id", type: String},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4235 {name: "element", mayBeNull: true, domElement: true, optional: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4236 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4237 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4238 if (!element) return document.getElementById(id);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4239 if (element.getElementById) return element.getElementById(id);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4240 var nodeQueue = [];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4241 var childNodes = element.childNodes;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4242 for (var i = 0; i < childNodes.length; i++) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4243 var node = childNodes[i];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4244 if (node.nodeType == 1) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4245 nodeQueue[nodeQueue.length] = node;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4246 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4247 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4248 while (nodeQueue.length) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4249 node = nodeQueue.shift();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4250 if (node.id == id) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4251 return node;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4252 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4253 childNodes = node.childNodes;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4254 for (i = 0; i < childNodes.length; i++) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4255 node = childNodes[i];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4256 if (node.nodeType == 1) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4257 nodeQueue[nodeQueue.length] = node;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4258 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4259 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4260 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4261 return null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4262 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4263 if (document.documentElement.getBoundingClientRect) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4264 Sys.UI.DomElement.getLocation = function Sys$UI$DomElement$getLocation(element) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4265 /// <summary locid="M:J#Sys.UI.DomElement.getLocation" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4266 /// <param name="element" domElement="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4267 /// <returns type="Sys.UI.Point"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4268 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4269 {name: "element", domElement: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4270 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4271 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4272 if (element.self || element.nodeType === 9) return new Sys.UI.Point(0,0);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4273 var clientRect = element.getBoundingClientRect();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4274 if (!clientRect) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4275 return new Sys.UI.Point(0,0);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4276 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4277 var documentElement = element.ownerDocument.documentElement,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4278 offsetX = Math.floor(clientRect.left + 0.5) + documentElement.scrollLeft,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4279 offsetY = Math.floor(clientRect.top + 0.5) + documentElement.scrollTop;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4280 if (Sys.Browser.agent === Sys.Browser.InternetExplorer) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4281 try {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4282 var f = element.ownerDocument.parentWindow.frameElement || null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4283 if (f) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4284 var offset = (f.frameBorder === "0" || f.frameBorder === "no") ? 2 : 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4285 offsetX += offset;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4286 offsetY += offset;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4287 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4288 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4289 catch(ex) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4290 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4291 if (Sys.Browser.version <= 7) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4292
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4293 var multiplier, before, rect, d = document.createElement("div");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4294 d.style.cssText = "position:absolute !important;left:0px !important;right:0px !important;height:0px !important;width:1px !important;display:hidden !important";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4295 try {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4296 before = document.body.childNodes[0];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4297 document.body.insertBefore(d, before);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4298 rect = d.getBoundingClientRect();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4299 document.body.removeChild(d);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4300 multiplier = (rect.right - rect.left);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4301 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4302 catch (e) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4303 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4304 if (multiplier && (multiplier !== 1)) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4305 offsetX = Math.floor(offsetX / multiplier);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4306 offsetY = Math.floor(offsetY / multiplier);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4307 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4308 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4309 if ((document.documentMode || 0) < 8) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4310 offsetX -= 2;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4311 offsetY -= 2;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4312 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4313 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4314 return new Sys.UI.Point(offsetX, offsetY);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4315 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4316 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4317 else if (Sys.Browser.agent === Sys.Browser.Safari) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4318 Sys.UI.DomElement.getLocation = function Sys$UI$DomElement$getLocation(element) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4319 /// <summary locid="M:J#Sys.UI.DomElement.getLocation" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4320 /// <param name="element" domElement="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4321 /// <returns type="Sys.UI.Point"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4322 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4323 {name: "element", domElement: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4324 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4325 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4326 if ((element.window && (element.window === element)) || element.nodeType === 9) return new Sys.UI.Point(0,0);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4327 var offsetX = 0, offsetY = 0,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4328 parent,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4329 previous = null,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4330 previousStyle = null,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4331 currentStyle;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4332 for (parent = element; parent; previous = parent, previousStyle = currentStyle, parent = parent.offsetParent) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4333 currentStyle = Sys.UI.DomElement._getCurrentStyle(parent);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4334 var tagName = parent.tagName ? parent.tagName.toUpperCase() : null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4335 if ((parent.offsetLeft || parent.offsetTop) &&
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4336 ((tagName !== "BODY") || (!previousStyle || previousStyle.position !== "absolute"))) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4337 offsetX += parent.offsetLeft;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4338 offsetY += parent.offsetTop;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4339 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4340 if (previous && Sys.Browser.version >= 3) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4341 offsetX += parseInt(currentStyle.borderLeftWidth);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4342 offsetY += parseInt(currentStyle.borderTopWidth);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4343 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4344 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4345 currentStyle = Sys.UI.DomElement._getCurrentStyle(element);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4346 var elementPosition = currentStyle ? currentStyle.position : null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4347 if (!elementPosition || (elementPosition !== "absolute")) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4348 for (parent = element.parentNode; parent; parent = parent.parentNode) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4349 tagName = parent.tagName ? parent.tagName.toUpperCase() : null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4350 if ((tagName !== "BODY") && (tagName !== "HTML") && (parent.scrollLeft || parent.scrollTop)) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4351 offsetX -= (parent.scrollLeft || 0);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4352 offsetY -= (parent.scrollTop || 0);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4353 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4354 currentStyle = Sys.UI.DomElement._getCurrentStyle(parent);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4355 var parentPosition = currentStyle ? currentStyle.position : null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4356 if (parentPosition && (parentPosition === "absolute")) break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4357 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4358 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4359 return new Sys.UI.Point(offsetX, offsetY);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4360 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4361 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4362 else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4363 Sys.UI.DomElement.getLocation = function Sys$UI$DomElement$getLocation(element) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4364 /// <summary locid="M:J#Sys.UI.DomElement.getLocation" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4365 /// <param name="element" domElement="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4366 /// <returns type="Sys.UI.Point"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4367 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4368 {name: "element", domElement: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4369 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4370 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4371 if ((element.window && (element.window === element)) || element.nodeType === 9) return new Sys.UI.Point(0,0);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4372 var offsetX = 0, offsetY = 0,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4373 parent,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4374 previous = null,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4375 previousStyle = null,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4376 currentStyle = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4377 for (parent = element; parent; previous = parent, previousStyle = currentStyle, parent = parent.offsetParent) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4378 var tagName = parent.tagName ? parent.tagName.toUpperCase() : null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4379 currentStyle = Sys.UI.DomElement._getCurrentStyle(parent);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4380 if ((parent.offsetLeft || parent.offsetTop) &&
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4381 !((tagName === "BODY") &&
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4382 (!previousStyle || previousStyle.position !== "absolute"))) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4383 offsetX += parent.offsetLeft;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4384 offsetY += parent.offsetTop;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4385 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4386 if (previous !== null && currentStyle) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4387 if ((tagName !== "TABLE") && (tagName !== "TD") && (tagName !== "HTML")) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4388 offsetX += parseInt(currentStyle.borderLeftWidth) || 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4389 offsetY += parseInt(currentStyle.borderTopWidth) || 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4390 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4391 if (tagName === "TABLE" &&
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4392 (currentStyle.position === "relative" || currentStyle.position === "absolute")) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4393 offsetX += parseInt(currentStyle.marginLeft) || 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4394 offsetY += parseInt(currentStyle.marginTop) || 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4395 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4396 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4397 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4398 currentStyle = Sys.UI.DomElement._getCurrentStyle(element);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4399 var elementPosition = currentStyle ? currentStyle.position : null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4400 if (!elementPosition || (elementPosition !== "absolute")) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4401 for (parent = element.parentNode; parent; parent = parent.parentNode) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4402 tagName = parent.tagName ? parent.tagName.toUpperCase() : null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4403 if ((tagName !== "BODY") && (tagName !== "HTML") && (parent.scrollLeft || parent.scrollTop)) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4404 offsetX -= (parent.scrollLeft || 0);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4405 offsetY -= (parent.scrollTop || 0);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4406 currentStyle = Sys.UI.DomElement._getCurrentStyle(parent);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4407 if (currentStyle) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4408 offsetX += parseInt(currentStyle.borderLeftWidth) || 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4409 offsetY += parseInt(currentStyle.borderTopWidth) || 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4410 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4411 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4412 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4413 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4414 return new Sys.UI.Point(offsetX, offsetY);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4415 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4416 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4417 Sys.UI.DomElement.isDomElement = function Sys$UI$DomElement$isDomElement(obj) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4418 /// <summary locid="M:J#Sys.UI.DomElement.isDomElement" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4419 /// <param name="obj"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4420 /// <returns type="Boolean"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4421 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4422 {name: "obj"}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4423 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4424 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4425 return Sys._isDomElement(obj);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4426 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4427 Sys.UI.DomElement.removeCssClass = function Sys$UI$DomElement$removeCssClass(element, className) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4428 /// <summary locid="M:J#Sys.UI.DomElement.removeCssClass" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4429 /// <param name="element" domElement="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4430 /// <param name="className" type="String"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4431 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4432 {name: "element", domElement: true},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4433 {name: "className", type: String}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4434 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4435 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4436 var currentClassName = ' ' + element.className + ' ';
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4437 var index = currentClassName.indexOf(' ' + className + ' ');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4438 if (index >= 0) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4439 element.className = (currentClassName.substr(0, index) + ' ' +
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4440 currentClassName.substring(index + className.length + 1, currentClassName.length)).trim();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4441 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4442 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4443 Sys.UI.DomElement.resolveElement = function Sys$UI$DomElement$resolveElement(elementOrElementId, containerElement) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4444 /// <summary locid="M:J#Sys.UI.DomElement.resolveElement" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4445 /// <param name="elementOrElementId" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4446 /// <param name="containerElement" domElement="true" optional="true" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4447 /// <returns domElement="true"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4448 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4449 {name: "elementOrElementId", mayBeNull: true},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4450 {name: "containerElement", mayBeNull: true, domElement: true, optional: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4451 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4452 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4453 var el = elementOrElementId;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4454 if (!el) return null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4455 if (typeof(el) === "string") {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4456 el = Sys.UI.DomElement.getElementById(el, containerElement);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4457 if (!el) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4458 throw Error.argument("elementOrElementId", String.format(Sys.Res.elementNotFound, elementOrElementId));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4459 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4460 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4461 else if(!Sys.UI.DomElement.isDomElement(el)) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4462 throw Error.argument("elementOrElementId", Sys.Res.expectedElementOrId);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4463 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4464 return el;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4465 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4466 Sys.UI.DomElement.raiseBubbleEvent = function Sys$UI$DomElement$raiseBubbleEvent(source, args) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4467 /// <summary locid="M:J#Sys.UI.DomElement.raiseBubbleEvent" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4468 /// <param name="source" domElement="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4469 /// <param name="args" type="Sys.EventArgs"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4470 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4471 {name: "source", domElement: true},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4472 {name: "args", type: Sys.EventArgs}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4473 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4474 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4475 var target = source;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4476 while (target) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4477 var control = target.control;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4478 if (control && control.onBubbleEvent && control.raiseBubbleEvent) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4479 Sys.UI.DomElement._raiseBubbleEventFromControl(control, source, args);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4480 return;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4481 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4482 target = target.parentNode;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4483 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4484 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4485 Sys.UI.DomElement._raiseBubbleEventFromControl = function Sys$UI$DomElement$_raiseBubbleEventFromControl(control, source, args) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4486 if (!control.onBubbleEvent(source, args)) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4487 control._raiseBubbleEvent(source, args);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4488 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4489 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4490 Sys.UI.DomElement.setLocation = function Sys$UI$DomElement$setLocation(element, x, y) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4491 /// <summary locid="M:J#Sys.UI.DomElement.setLocation" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4492 /// <param name="element" domElement="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4493 /// <param name="x" type="Number" integer="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4494 /// <param name="y" type="Number" integer="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4495 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4496 {name: "element", domElement: true},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4497 {name: "x", type: Number, integer: true},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4498 {name: "y", type: Number, integer: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4499 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4500 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4501 var style = element.style;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4502 style.position = 'absolute';
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4503 style.left = x + "px";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4504 style.top = y + "px";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4505 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4506 Sys.UI.DomElement.toggleCssClass = function Sys$UI$DomElement$toggleCssClass(element, className) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4507 /// <summary locid="M:J#Sys.UI.DomElement.toggleCssClass" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4508 /// <param name="element" domElement="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4509 /// <param name="className" type="String"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4510 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4511 {name: "element", domElement: true},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4512 {name: "className", type: String}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4513 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4514 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4515 if (Sys.UI.DomElement.containsCssClass(element, className)) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4516 Sys.UI.DomElement.removeCssClass(element, className);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4517 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4518 else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4519 Sys.UI.DomElement.addCssClass(element, className);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4520 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4521 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4522 Sys.UI.DomElement.getVisibilityMode = function Sys$UI$DomElement$getVisibilityMode(element) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4523 /// <summary locid="M:J#Sys.UI.DomElement.getVisibilityMode" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4524 /// <param name="element" domElement="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4525 /// <returns type="Sys.UI.VisibilityMode"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4526 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4527 {name: "element", domElement: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4528 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4529 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4530 return (element._visibilityMode === Sys.UI.VisibilityMode.hide) ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4531 Sys.UI.VisibilityMode.hide :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4532 Sys.UI.VisibilityMode.collapse;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4533 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4534 Sys.UI.DomElement.setVisibilityMode = function Sys$UI$DomElement$setVisibilityMode(element, value) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4535 /// <summary locid="M:J#Sys.UI.DomElement.setVisibilityMode" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4536 /// <param name="element" domElement="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4537 /// <param name="value" type="Sys.UI.VisibilityMode"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4538 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4539 {name: "element", domElement: true},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4540 {name: "value", type: Sys.UI.VisibilityMode}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4541 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4542 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4543 Sys.UI.DomElement._ensureOldDisplayMode(element);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4544 if (element._visibilityMode !== value) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4545 element._visibilityMode = value;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4546 if (Sys.UI.DomElement.getVisible(element) === false) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4547 if (element._visibilityMode === Sys.UI.VisibilityMode.hide) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4548 element.style.display = element._oldDisplayMode;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4549 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4550 else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4551 element.style.display = 'none';
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4552 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4553 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4554 element._visibilityMode = value;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4555 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4556 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4557 Sys.UI.DomElement.getVisible = function Sys$UI$DomElement$getVisible(element) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4558 /// <summary locid="M:J#Sys.UI.DomElement.getVisible" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4559 /// <param name="element" domElement="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4560 /// <returns type="Boolean"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4561 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4562 {name: "element", domElement: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4563 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4564 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4565 var style = element.currentStyle || Sys.UI.DomElement._getCurrentStyle(element);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4566 if (!style) return true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4567 return (style.visibility !== 'hidden') && (style.display !== 'none');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4568 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4569 Sys.UI.DomElement.setVisible = function Sys$UI$DomElement$setVisible(element, value) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4570 /// <summary locid="M:J#Sys.UI.DomElement.setVisible" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4571 /// <param name="element" domElement="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4572 /// <param name="value" type="Boolean"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4573 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4574 {name: "element", domElement: true},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4575 {name: "value", type: Boolean}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4576 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4577 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4578 if (value !== Sys.UI.DomElement.getVisible(element)) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4579 Sys.UI.DomElement._ensureOldDisplayMode(element);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4580 element.style.visibility = value ? 'visible' : 'hidden';
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4581 if (value || (element._visibilityMode === Sys.UI.VisibilityMode.hide)) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4582 element.style.display = element._oldDisplayMode;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4583 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4584 else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4585 element.style.display = 'none';
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4586 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4587 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4588 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4589 Sys.UI.DomElement._ensureOldDisplayMode = function Sys$UI$DomElement$_ensureOldDisplayMode(element) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4590 if (!element._oldDisplayMode) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4591 var style = element.currentStyle || Sys.UI.DomElement._getCurrentStyle(element);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4592 element._oldDisplayMode = style ? style.display : null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4593 if (!element._oldDisplayMode || element._oldDisplayMode === 'none') {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4594 switch(element.tagName.toUpperCase()) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4595 case 'DIV': case 'P': case 'ADDRESS': case 'BLOCKQUOTE': case 'BODY': case 'COL':
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4596 case 'COLGROUP': case 'DD': case 'DL': case 'DT': case 'FIELDSET': case 'FORM':
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4597 case 'H1': case 'H2': case 'H3': case 'H4': case 'H5': case 'H6': case 'HR':
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4598 case 'IFRAME': case 'LEGEND': case 'OL': case 'PRE': case 'TABLE': case 'TD':
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4599 case 'TH': case 'TR': case 'UL':
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4600 element._oldDisplayMode = 'block';
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4601 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4602 case 'LI':
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4603 element._oldDisplayMode = 'list-item';
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4604 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4605 default:
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4606 element._oldDisplayMode = 'inline';
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4607 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4608 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4609 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4610 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4611 Sys.UI.DomElement._getWindow = function Sys$UI$DomElement$_getWindow(element) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4612 var doc = element.ownerDocument || element.document || element;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4613 return doc.defaultView || doc.parentWindow;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4614 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4615 Sys.UI.DomElement._getCurrentStyle = function Sys$UI$DomElement$_getCurrentStyle(element) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4616 if (element.nodeType === 3) return null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4617 var w = Sys.UI.DomElement._getWindow(element);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4618 if (element.documentElement) element = element.documentElement;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4619 var computedStyle = (w && (element !== w) && w.getComputedStyle) ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4620 w.getComputedStyle(element, null) :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4621 element.currentStyle || element.style;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4622 if (!computedStyle && (Sys.Browser.agent === Sys.Browser.Safari) && element.style) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4623 var oldDisplay = element.style.display;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4624 var oldPosition = element.style.position;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4625 element.style.position = 'absolute';
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4626 element.style.display = 'block';
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4627 var style = w.getComputedStyle(element, null);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4628 element.style.display = oldDisplay;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4629 element.style.position = oldPosition;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4630 computedStyle = {};
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4631 for (var n in style) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4632 computedStyle[n] = style[n];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4633 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4634 computedStyle.display = 'none';
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4635 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4636 return computedStyle;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4637 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4638
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4639 Sys.IContainer = function Sys$IContainer() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4640 throw Error.notImplemented();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4641 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4642 function Sys$IContainer$addComponent(component) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4643 /// <summary locid="M:J#Sys.IContainer.addComponent" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4644 /// <param name="component" type="Sys.Component"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4645 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4646 {name: "component", type: Sys.Component}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4647 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4648 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4649 throw Error.notImplemented();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4650 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4651 function Sys$IContainer$removeComponent(component) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4652 /// <summary locid="M:J#Sys.IContainer.removeComponent" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4653 /// <param name="component" type="Sys.Component"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4654 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4655 {name: "component", type: Sys.Component}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4656 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4657 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4658 throw Error.notImplemented();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4659 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4660 function Sys$IContainer$findComponent(id) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4661 /// <summary locid="M:J#Sys.IContainer.findComponent" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4662 /// <param name="id" type="String"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4663 /// <returns type="Sys.Component"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4664 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4665 {name: "id", type: String}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4666 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4667 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4668 throw Error.notImplemented();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4669 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4670 function Sys$IContainer$getComponents() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4671 /// <summary locid="M:J#Sys.IContainer.getComponents" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4672 /// <returns type="Array" elementType="Sys.Component"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4673 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4674 throw Error.notImplemented();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4675 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4676 Sys.IContainer.prototype = {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4677 addComponent: Sys$IContainer$addComponent,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4678 removeComponent: Sys$IContainer$removeComponent,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4679 findComponent: Sys$IContainer$findComponent,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4680 getComponents: Sys$IContainer$getComponents
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4681 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4682 Sys.IContainer.registerInterface("Sys.IContainer");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4683
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4684 Sys.ApplicationLoadEventArgs = function Sys$ApplicationLoadEventArgs(components, isPartialLoad) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4685 /// <summary locid="M:J#Sys.ApplicationLoadEventArgs.#ctor" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4686 /// <param name="components" type="Array" elementType="Sys.Component"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4687 /// <param name="isPartialLoad" type="Boolean"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4688 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4689 {name: "components", type: Array, elementType: Sys.Component},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4690 {name: "isPartialLoad", type: Boolean}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4691 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4692 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4693 Sys.ApplicationLoadEventArgs.initializeBase(this);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4694 this._components = components;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4695 this._isPartialLoad = isPartialLoad;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4696 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4697
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4698 function Sys$ApplicationLoadEventArgs$get_components() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4699 /// <value type="Array" elementType="Sys.Component" locid="P:J#Sys.ApplicationLoadEventArgs.components"></value>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4700 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4701 return this._components;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4702 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4703 function Sys$ApplicationLoadEventArgs$get_isPartialLoad() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4704 /// <value type="Boolean" locid="P:J#Sys.ApplicationLoadEventArgs.isPartialLoad"></value>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4705 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4706 return this._isPartialLoad;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4707 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4708 Sys.ApplicationLoadEventArgs.prototype = {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4709 get_components: Sys$ApplicationLoadEventArgs$get_components,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4710 get_isPartialLoad: Sys$ApplicationLoadEventArgs$get_isPartialLoad
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4711 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4712 Sys.ApplicationLoadEventArgs.registerClass('Sys.ApplicationLoadEventArgs', Sys.EventArgs);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4713
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4714 Sys._Application = function Sys$_Application() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4715 /// <summary locid="M:J#Sys.Application.#ctor" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4716 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4717 Sys._Application.initializeBase(this);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4718 this._disposableObjects = [];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4719 this._components = {};
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4720 this._createdComponents = [];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4721 this._secondPassComponents = [];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4722 this._unloadHandlerDelegate = Function.createDelegate(this, this._unloadHandler);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4723 Sys.UI.DomEvent.addHandler(window, "unload", this._unloadHandlerDelegate);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4724 this._domReady();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4725 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4726 function Sys$_Application$get_isCreatingComponents() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4727 /// <value type="Boolean" locid="P:J#Sys.Application.isCreatingComponents"></value>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4728 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4729 return this._creatingComponents;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4730 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4731 function Sys$_Application$get_isDisposing() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4732 /// <value type="Boolean" locid="P:J#Sys.Application.isDisposing"></value>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4733 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4734 return this._disposing;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4735 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4736 function Sys$_Application$add_init(handler) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4737 /// <summary locid="E:J#Sys.Application.init" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4738 var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4739 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4740 if (this._initialized) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4741 handler(this, Sys.EventArgs.Empty);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4742 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4743 else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4744 this.get_events().addHandler("init", handler);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4745 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4746 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4747 function Sys$_Application$remove_init(handler) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4748 var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4749 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4750 this.get_events().removeHandler("init", handler);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4751 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4752 function Sys$_Application$add_load(handler) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4753 /// <summary locid="E:J#Sys.Application.load" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4754 var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4755 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4756 this.get_events().addHandler("load", handler);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4757 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4758 function Sys$_Application$remove_load(handler) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4759 var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4760 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4761 this.get_events().removeHandler("load", handler);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4762 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4763 function Sys$_Application$add_unload(handler) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4764 /// <summary locid="E:J#Sys.Application.unload" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4765 var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4766 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4767 this.get_events().addHandler("unload", handler);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4768 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4769 function Sys$_Application$remove_unload(handler) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4770 var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4771 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4772 this.get_events().removeHandler("unload", handler);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4773 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4774 function Sys$_Application$addComponent(component) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4775 /// <summary locid="M:J#Sys.Application.addComponent" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4776 /// <param name="component" type="Sys.Component"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4777 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4778 {name: "component", type: Sys.Component}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4779 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4780 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4781 var id = component.get_id();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4782 if (!id) throw Error.invalidOperation(Sys.Res.cantAddWithoutId);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4783 if (typeof(this._components[id]) !== 'undefined') throw Error.invalidOperation(String.format(Sys.Res.appDuplicateComponent, id));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4784 this._components[id] = component;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4785 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4786 function Sys$_Application$beginCreateComponents() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4787 /// <summary locid="M:J#Sys.Application.beginCreateComponents" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4788 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4789 this._creatingComponents = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4790 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4791 function Sys$_Application$dispose() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4792 /// <summary locid="M:J#Sys.Application.dispose" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4793 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4794 if (!this._disposing) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4795 this._disposing = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4796 if (this._timerCookie) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4797 window.clearTimeout(this._timerCookie);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4798 delete this._timerCookie;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4799 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4800 if (this._endRequestHandler) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4801 Sys.WebForms.PageRequestManager.getInstance().remove_endRequest(this._endRequestHandler);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4802 delete this._endRequestHandler;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4803 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4804 if (this._beginRequestHandler) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4805 Sys.WebForms.PageRequestManager.getInstance().remove_beginRequest(this._beginRequestHandler);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4806 delete this._beginRequestHandler;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4807 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4808 if (window.pageUnload) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4809 window.pageUnload(this, Sys.EventArgs.Empty);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4810 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4811 var unloadHandler = this.get_events().getHandler("unload");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4812 if (unloadHandler) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4813 unloadHandler(this, Sys.EventArgs.Empty);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4814 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4815 var disposableObjects = Array.clone(this._disposableObjects);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4816 for (var i = 0, l = disposableObjects.length; i < l; i++) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4817 var object = disposableObjects[i];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4818 if (typeof(object) !== "undefined") {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4819 object.dispose();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4820 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4821 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4822 Array.clear(this._disposableObjects);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4823 Sys.UI.DomEvent.removeHandler(window, "unload", this._unloadHandlerDelegate);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4824 if (Sys._ScriptLoader) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4825 var sl = Sys._ScriptLoader.getInstance();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4826 if(sl) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4827 sl.dispose();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4828 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4829 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4830 Sys._Application.callBaseMethod(this, 'dispose');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4831 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4832 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4833 function Sys$_Application$disposeElement(element, childNodesOnly) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4834 /// <summary locid="M:J#Sys._Application.disposeElement" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4835 /// <param name="element"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4836 /// <param name="childNodesOnly" type="Boolean"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4837 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4838 {name: "element"},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4839 {name: "childNodesOnly", type: Boolean}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4840 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4841 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4842 if (element.nodeType === 1) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4843 var children = element.getElementsByTagName("*");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4844 for (var i = children.length - 1; i >= 0; i--) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4845 this._disposeElementInternal(children[i]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4846 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4847 if (!childNodesOnly) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4848 this._disposeElementInternal(element);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4849 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4850 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4851 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4852 function Sys$_Application$endCreateComponents() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4853 /// <summary locid="M:J#Sys.Application.endCreateComponents" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4854 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4855 var components = this._secondPassComponents;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4856 for (var i = 0, l = components.length; i < l; i++) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4857 var component = components[i].component;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4858 Sys$Component$_setReferences(component, components[i].references);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4859 component.endUpdate();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4860 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4861 this._secondPassComponents = [];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4862 this._creatingComponents = false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4863 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4864 function Sys$_Application$findComponent(id, parent) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4865 /// <summary locid="M:J#Sys.Application.findComponent" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4866 /// <param name="id" type="String"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4867 /// <param name="parent" optional="true" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4868 /// <returns type="Sys.Component" mayBeNull="true"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4869 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4870 {name: "id", type: String},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4871 {name: "parent", mayBeNull: true, optional: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4872 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4873 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4874 return (parent ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4875 ((Sys.IContainer.isInstanceOfType(parent)) ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4876 parent.findComponent(id) :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4877 parent[id] || null) :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4878 Sys.Application._components[id] || null);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4879 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4880 function Sys$_Application$getComponents() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4881 /// <summary locid="M:J#Sys.Application.getComponents" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4882 /// <returns type="Array" elementType="Sys.Component"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4883 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4884 var res = [];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4885 var components = this._components;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4886 for (var name in components) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4887 res[res.length] = components[name];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4888 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4889 return res;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4890 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4891 function Sys$_Application$initialize() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4892 /// <summary locid="M:J#Sys.Application.initialize" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4893 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4894 if(!this.get_isInitialized() && !this._disposing) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4895 Sys._Application.callBaseMethod(this, 'initialize');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4896 this._raiseInit();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4897 if (this.get_stateString) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4898 if (Sys.WebForms && Sys.WebForms.PageRequestManager) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4899 this._beginRequestHandler = Function.createDelegate(this, this._onPageRequestManagerBeginRequest);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4900 Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(this._beginRequestHandler);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4901 this._endRequestHandler = Function.createDelegate(this, this._onPageRequestManagerEndRequest);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4902 Sys.WebForms.PageRequestManager.getInstance().add_endRequest(this._endRequestHandler);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4903 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4904 var loadedEntry = this.get_stateString();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4905 if (loadedEntry !== this._currentEntry) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4906 this._navigate(loadedEntry);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4907 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4908 else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4909 this._ensureHistory();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4910 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4911 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4912 this.raiseLoad();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4913 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4914 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4915 function Sys$_Application$notifyScriptLoaded() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4916 /// <summary locid="M:J#Sys.Application.notifyScriptLoaded" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4917 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4918 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4919 function Sys$_Application$registerDisposableObject(object) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4920 /// <summary locid="M:J#Sys.Application.registerDisposableObject" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4921 /// <param name="object" type="Sys.IDisposable"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4922 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4923 {name: "object", type: Sys.IDisposable}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4924 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4925 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4926 if (!this._disposing) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4927 var objects = this._disposableObjects,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4928 i = objects.length;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4929 objects[i] = object;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4930 object.__msdisposeindex = i;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4931 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4932 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4933 function Sys$_Application$raiseLoad() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4934 /// <summary locid="M:J#Sys.Application.raiseLoad" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4935 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4936 var h = this.get_events().getHandler("load");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4937 var args = new Sys.ApplicationLoadEventArgs(Array.clone(this._createdComponents), !!this._loaded);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4938 this._loaded = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4939 if (h) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4940 h(this, args);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4941 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4942 if (window.pageLoad) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4943 window.pageLoad(this, args);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4944 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4945 this._createdComponents = [];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4946 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4947 function Sys$_Application$removeComponent(component) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4948 /// <summary locid="M:J#Sys.Application.removeComponent" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4949 /// <param name="component" type="Sys.Component"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4950 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4951 {name: "component", type: Sys.Component}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4952 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4953 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4954 var id = component.get_id();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4955 if (id) delete this._components[id];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4956 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4957 function Sys$_Application$unregisterDisposableObject(object) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4958 /// <summary locid="M:J#Sys.Application.unregisterDisposableObject" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4959 /// <param name="object" type="Sys.IDisposable"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4960 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4961 {name: "object", type: Sys.IDisposable}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4962 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4963 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4964 if (!this._disposing) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4965 var i = object.__msdisposeindex;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4966 if (typeof(i) === "number") {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4967 var disposableObjects = this._disposableObjects;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4968 delete disposableObjects[i];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4969 delete object.__msdisposeindex;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4970 if (++this._deleteCount > 1000) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4971 var newArray = [];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4972 for (var j = 0, l = disposableObjects.length; j < l; j++) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4973 object = disposableObjects[j];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4974 if (typeof(object) !== "undefined") {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4975 object.__msdisposeindex = newArray.length;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4976 newArray.push(object);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4977 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4978 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4979 this._disposableObjects = newArray;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4980 this._deleteCount = 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4981 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4982 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4983 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4984 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4985 function Sys$_Application$_addComponentToSecondPass(component, references) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4986 this._secondPassComponents[this._secondPassComponents.length] = {component: component, references: references};
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4987 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4988 function Sys$_Application$_disposeComponents(list) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4989 if (list) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4990 for (var i = list.length - 1; i >= 0; i--) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4991 var item = list[i];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4992 if (typeof(item.dispose) === "function") {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4993 item.dispose();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4994 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4995 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4996 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4997 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4998 function Sys$_Application$_disposeElementInternal(element) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4999 var d = element.dispose;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5000 if (d && typeof(d) === "function") {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5001 element.dispose();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5002 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5003 else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5004 var c = element.control;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5005 if (c && typeof(c.dispose) === "function") {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5006 c.dispose();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5007 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5008 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5009 var list = element._behaviors;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5010 if (list) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5011 this._disposeComponents(list);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5012 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5013 list = element._components;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5014 if (list) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5015 this._disposeComponents(list);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5016 element._components = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5017 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5018 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5019 function Sys$_Application$_domReady() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5020 var check, er, app = this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5021 function init() { app.initialize(); }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5022 var onload = function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5023 Sys.UI.DomEvent.removeHandler(window, "load", onload);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5024 init();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5025 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5026 Sys.UI.DomEvent.addHandler(window, "load", onload);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5027
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5028 if (document.addEventListener) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5029 try {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5030 document.addEventListener("DOMContentLoaded", check = function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5031 document.removeEventListener("DOMContentLoaded", check, false);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5032 init();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5033 }, false);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5034 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5035 catch (er) { }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5036 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5037 else if (document.attachEvent) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5038 if ((window == window.top) && document.documentElement.doScroll) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5039 var timeout, el = document.createElement("div");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5040 check = function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5041 try {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5042 el.doScroll("left");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5043 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5044 catch (er) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5045 timeout = window.setTimeout(check, 0);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5046 return;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5047 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5048 el = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5049 init();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5050 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5051 check();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5052 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5053 else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5054 document.attachEvent("onreadystatechange", check = function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5055 if (document.readyState === "complete") {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5056 document.detachEvent("onreadystatechange", check);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5057 init();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5058 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5059 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5060 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5061 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5062 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5063 function Sys$_Application$_raiseInit() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5064 var handler = this.get_events().getHandler("init");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5065 if (handler) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5066 this.beginCreateComponents();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5067 handler(this, Sys.EventArgs.Empty);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5068 this.endCreateComponents();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5069 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5070 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5071 function Sys$_Application$_unloadHandler(event) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5072 this.dispose();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5073 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5074 Sys._Application.prototype = {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5075 _creatingComponents: false,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5076 _disposing: false,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5077 _deleteCount: 0,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5078 get_isCreatingComponents: Sys$_Application$get_isCreatingComponents,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5079 get_isDisposing: Sys$_Application$get_isDisposing,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5080 add_init: Sys$_Application$add_init,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5081 remove_init: Sys$_Application$remove_init,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5082 add_load: Sys$_Application$add_load,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5083 remove_load: Sys$_Application$remove_load,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5084 add_unload: Sys$_Application$add_unload,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5085 remove_unload: Sys$_Application$remove_unload,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5086 addComponent: Sys$_Application$addComponent,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5087 beginCreateComponents: Sys$_Application$beginCreateComponents,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5088 dispose: Sys$_Application$dispose,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5089 disposeElement: Sys$_Application$disposeElement,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5090 endCreateComponents: Sys$_Application$endCreateComponents,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5091 findComponent: Sys$_Application$findComponent,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5092 getComponents: Sys$_Application$getComponents,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5093 initialize: Sys$_Application$initialize,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5094 notifyScriptLoaded: Sys$_Application$notifyScriptLoaded,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5095 registerDisposableObject: Sys$_Application$registerDisposableObject,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5096 raiseLoad: Sys$_Application$raiseLoad,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5097 removeComponent: Sys$_Application$removeComponent,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5098 unregisterDisposableObject: Sys$_Application$unregisterDisposableObject,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5099 _addComponentToSecondPass: Sys$_Application$_addComponentToSecondPass,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5100 _disposeComponents: Sys$_Application$_disposeComponents,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5101 _disposeElementInternal: Sys$_Application$_disposeElementInternal,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5102 _domReady: Sys$_Application$_domReady,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5103 _raiseInit: Sys$_Application$_raiseInit,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5104 _unloadHandler: Sys$_Application$_unloadHandler
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5105 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5106 Sys._Application.registerClass('Sys._Application', Sys.Component, Sys.IContainer);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5107 Sys.Application = new Sys._Application();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5108 var $find = Sys.Application.findComponent;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5109
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5110 Sys.UI.Behavior = function Sys$UI$Behavior(element) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5111 /// <summary locid="M:J#Sys.UI.Behavior.#ctor" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5112 /// <param name="element" domElement="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5113 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5114 {name: "element", domElement: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5115 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5116 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5117 Sys.UI.Behavior.initializeBase(this);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5118 this._element = element;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5119 var behaviors = element._behaviors;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5120 if (!behaviors) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5121 element._behaviors = [this];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5122 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5123 else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5124 behaviors[behaviors.length] = this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5125 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5126 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5127 function Sys$UI$Behavior$get_element() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5128 /// <value domElement="true" locid="P:J#Sys.UI.Behavior.element"></value>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5129 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5130 return this._element;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5131 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5132 function Sys$UI$Behavior$get_id() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5133 /// <value type="String" locid="P:J#Sys.UI.Behavior.id"></value>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5134 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5135 var baseId = Sys.UI.Behavior.callBaseMethod(this, 'get_id');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5136 if (baseId) return baseId;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5137 if (!this._element || !this._element.id) return '';
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5138 return this._element.id + '$' + this.get_name();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5139 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5140 function Sys$UI$Behavior$get_name() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5141 /// <value type="String" locid="P:J#Sys.UI.Behavior.name"></value>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5142 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5143 if (this._name) return this._name;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5144 var name = Object.getTypeName(this);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5145 var i = name.lastIndexOf('.');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5146 if (i !== -1) name = name.substr(i + 1);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5147 if (!this.get_isInitialized()) this._name = name;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5148 return name;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5149 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5150 function Sys$UI$Behavior$set_name(value) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5151 var e = Function._validateParams(arguments, [{name: "value", type: String}]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5152 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5153 if ((value === '') || (value.charAt(0) === ' ') || (value.charAt(value.length - 1) === ' '))
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5154 throw Error.argument('value', Sys.Res.invalidId);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5155 if (typeof(this._element[value]) !== 'undefined')
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5156 throw Error.invalidOperation(String.format(Sys.Res.behaviorDuplicateName, value));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5157 if (this.get_isInitialized()) throw Error.invalidOperation(Sys.Res.cantSetNameAfterInit);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5158 this._name = value;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5159 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5160 function Sys$UI$Behavior$initialize() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5161 Sys.UI.Behavior.callBaseMethod(this, 'initialize');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5162 var name = this.get_name();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5163 if (name) this._element[name] = this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5164 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5165 function Sys$UI$Behavior$dispose() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5166 Sys.UI.Behavior.callBaseMethod(this, 'dispose');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5167 var e = this._element;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5168 if (e) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5169 var name = this.get_name();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5170 if (name) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5171 e[name] = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5172 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5173 var behaviors = e._behaviors;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5174 Array.remove(behaviors, this);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5175 if (behaviors.length === 0) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5176 e._behaviors = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5177 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5178 delete this._element;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5179 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5180 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5181 Sys.UI.Behavior.prototype = {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5182 _name: null,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5183 get_element: Sys$UI$Behavior$get_element,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5184 get_id: Sys$UI$Behavior$get_id,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5185 get_name: Sys$UI$Behavior$get_name,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5186 set_name: Sys$UI$Behavior$set_name,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5187 initialize: Sys$UI$Behavior$initialize,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5188 dispose: Sys$UI$Behavior$dispose
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5189 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5190 Sys.UI.Behavior.registerClass('Sys.UI.Behavior', Sys.Component);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5191 Sys.UI.Behavior.getBehaviorByName = function Sys$UI$Behavior$getBehaviorByName(element, name) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5192 /// <summary locid="M:J#Sys.UI.Behavior.getBehaviorByName" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5193 /// <param name="element" domElement="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5194 /// <param name="name" type="String"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5195 /// <returns type="Sys.UI.Behavior" mayBeNull="true"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5196 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5197 {name: "element", domElement: true},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5198 {name: "name", type: String}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5199 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5200 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5201 var b = element[name];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5202 return (b && Sys.UI.Behavior.isInstanceOfType(b)) ? b : null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5203 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5204 Sys.UI.Behavior.getBehaviors = function Sys$UI$Behavior$getBehaviors(element) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5205 /// <summary locid="M:J#Sys.UI.Behavior.getBehaviors" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5206 /// <param name="element" domElement="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5207 /// <returns type="Array" elementType="Sys.UI.Behavior"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5208 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5209 {name: "element", domElement: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5210 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5211 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5212 if (!element._behaviors) return [];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5213 return Array.clone(element._behaviors);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5214 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5215 Sys.UI.Behavior.getBehaviorsByType = function Sys$UI$Behavior$getBehaviorsByType(element, type) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5216 /// <summary locid="M:J#Sys.UI.Behavior.getBehaviorsByType" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5217 /// <param name="element" domElement="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5218 /// <param name="type" type="Type"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5219 /// <returns type="Array" elementType="Sys.UI.Behavior"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5220 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5221 {name: "element", domElement: true},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5222 {name: "type", type: Type}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5223 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5224 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5225 var behaviors = element._behaviors;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5226 var results = [];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5227 if (behaviors) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5228 for (var i = 0, l = behaviors.length; i < l; i++) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5229 if (type.isInstanceOfType(behaviors[i])) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5230 results[results.length] = behaviors[i];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5231 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5232 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5233 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5234 return results;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5235 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5236
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5237 Sys.UI.VisibilityMode = function Sys$UI$VisibilityMode() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5238 /// <summary locid="M:J#Sys.UI.VisibilityMode.#ctor" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5239 /// <field name="hide" type="Number" integer="true" static="true" locid="F:J#Sys.UI.VisibilityMode.hide"></field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5240 /// <field name="collapse" type="Number" integer="true" static="true" locid="F:J#Sys.UI.VisibilityMode.collapse"></field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5241 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5242 throw Error.notImplemented();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5243 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5244 Sys.UI.VisibilityMode.prototype = {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5245 hide: 0,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5246 collapse: 1
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5247 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5248 Sys.UI.VisibilityMode.registerEnum("Sys.UI.VisibilityMode");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5249
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5250 Sys.UI.Control = function Sys$UI$Control(element) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5251 /// <summary locid="M:J#Sys.UI.Control.#ctor" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5252 /// <param name="element" domElement="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5253 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5254 {name: "element", domElement: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5255 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5256 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5257 if (typeof(element.control) !== 'undefined') throw Error.invalidOperation(Sys.Res.controlAlreadyDefined);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5258 Sys.UI.Control.initializeBase(this);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5259 this._element = element;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5260 element.control = this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5261 var role = this.get_role();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5262 if (role) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5263 element.setAttribute("role", role);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5264 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5265 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5266 function Sys$UI$Control$get_element() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5267 /// <value domElement="true" locid="P:J#Sys.UI.Control.element"></value>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5268 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5269 return this._element;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5270 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5271 function Sys$UI$Control$get_id() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5272 /// <value type="String" locid="P:J#Sys.UI.Control.id"></value>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5273 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5274 if (!this._element) return '';
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5275 return this._element.id;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5276 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5277 function Sys$UI$Control$set_id(value) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5278 var e = Function._validateParams(arguments, [{name: "value", type: String}]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5279 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5280 throw Error.invalidOperation(Sys.Res.cantSetId);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5281 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5282 function Sys$UI$Control$get_parent() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5283 /// <value type="Sys.UI.Control" locid="P:J#Sys.UI.Control.parent"></value>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5284 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5285 if (this._parent) return this._parent;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5286 if (!this._element) return null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5287
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5288 var parentElement = this._element.parentNode;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5289 while (parentElement) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5290 if (parentElement.control) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5291 return parentElement.control;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5292 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5293 parentElement = parentElement.parentNode;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5294 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5295 return null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5296 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5297 function Sys$UI$Control$set_parent(value) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5298 var e = Function._validateParams(arguments, [{name: "value", type: Sys.UI.Control}]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5299 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5300 if (!this._element) throw Error.invalidOperation(Sys.Res.cantBeCalledAfterDispose);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5301 var parents = [this];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5302 var current = value;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5303 while (current) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5304 if (Array.contains(parents, current)) throw Error.invalidOperation(Sys.Res.circularParentChain);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5305 parents[parents.length] = current;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5306 current = current.get_parent();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5307 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5308 this._parent = value;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5309 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5310 function Sys$UI$Control$get_role() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5311 /// <value type="String" locid="P:J#Sys.UI.Control.role"></value>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5312 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5313 return null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5314 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5315 function Sys$UI$Control$get_visibilityMode() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5316 /// <value type="Sys.UI.VisibilityMode" locid="P:J#Sys.UI.Control.visibilityMode"></value>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5317 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5318 if (!this._element) throw Error.invalidOperation(Sys.Res.cantBeCalledAfterDispose);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5319 return Sys.UI.DomElement.getVisibilityMode(this._element);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5320 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5321 function Sys$UI$Control$set_visibilityMode(value) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5322 var e = Function._validateParams(arguments, [{name: "value", type: Sys.UI.VisibilityMode}]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5323 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5324 if (!this._element) throw Error.invalidOperation(Sys.Res.cantBeCalledAfterDispose);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5325 Sys.UI.DomElement.setVisibilityMode(this._element, value);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5326 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5327 function Sys$UI$Control$get_visible() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5328 /// <value type="Boolean" locid="P:J#Sys.UI.Control.visible"></value>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5329 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5330 if (!this._element) throw Error.invalidOperation(Sys.Res.cantBeCalledAfterDispose);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5331 return Sys.UI.DomElement.getVisible(this._element);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5332 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5333 function Sys$UI$Control$set_visible(value) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5334 var e = Function._validateParams(arguments, [{name: "value", type: Boolean}]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5335 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5336 if (!this._element) throw Error.invalidOperation(Sys.Res.cantBeCalledAfterDispose);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5337 Sys.UI.DomElement.setVisible(this._element, value)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5338 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5339 function Sys$UI$Control$addCssClass(className) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5340 /// <summary locid="M:J#Sys.UI.Control.addCssClass" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5341 /// <param name="className" type="String"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5342 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5343 {name: "className", type: String}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5344 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5345 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5346 if (!this._element) throw Error.invalidOperation(Sys.Res.cantBeCalledAfterDispose);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5347 Sys.UI.DomElement.addCssClass(this._element, className);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5348 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5349 function Sys$UI$Control$dispose() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5350 Sys.UI.Control.callBaseMethod(this, 'dispose');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5351 if (this._element) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5352 this._element.control = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5353 delete this._element;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5354 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5355 if (this._parent) delete this._parent;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5356 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5357 function Sys$UI$Control$onBubbleEvent(source, args) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5358 /// <summary locid="M:J#Sys.UI.Control.onBubbleEvent" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5359 /// <param name="source"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5360 /// <param name="args" type="Sys.EventArgs"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5361 /// <returns type="Boolean"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5362 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5363 {name: "source"},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5364 {name: "args", type: Sys.EventArgs}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5365 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5366 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5367 return false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5368 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5369 function Sys$UI$Control$raiseBubbleEvent(source, args) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5370 /// <summary locid="M:J#Sys.UI.Control.raiseBubbleEvent" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5371 /// <param name="source"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5372 /// <param name="args" type="Sys.EventArgs"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5373 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5374 {name: "source"},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5375 {name: "args", type: Sys.EventArgs}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5376 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5377 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5378 this._raiseBubbleEvent(source, args);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5379 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5380 function Sys$UI$Control$_raiseBubbleEvent(source, args) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5381 var currentTarget = this.get_parent();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5382 while (currentTarget) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5383 if (currentTarget.onBubbleEvent(source, args)) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5384 return;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5385 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5386 currentTarget = currentTarget.get_parent();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5387 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5388 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5389 function Sys$UI$Control$removeCssClass(className) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5390 /// <summary locid="M:J#Sys.UI.Control.removeCssClass" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5391 /// <param name="className" type="String"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5392 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5393 {name: "className", type: String}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5394 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5395 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5396 if (!this._element) throw Error.invalidOperation(Sys.Res.cantBeCalledAfterDispose);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5397 Sys.UI.DomElement.removeCssClass(this._element, className);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5398 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5399 function Sys$UI$Control$toggleCssClass(className) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5400 /// <summary locid="M:J#Sys.UI.Control.toggleCssClass" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5401 /// <param name="className" type="String"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5402 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5403 {name: "className", type: String}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5404 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5405 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5406 if (!this._element) throw Error.invalidOperation(Sys.Res.cantBeCalledAfterDispose);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5407 Sys.UI.DomElement.toggleCssClass(this._element, className);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5408 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5409 Sys.UI.Control.prototype = {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5410 _parent: null,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5411 _visibilityMode: Sys.UI.VisibilityMode.hide,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5412 get_element: Sys$UI$Control$get_element,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5413 get_id: Sys$UI$Control$get_id,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5414 set_id: Sys$UI$Control$set_id,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5415 get_parent: Sys$UI$Control$get_parent,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5416 set_parent: Sys$UI$Control$set_parent,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5417 get_role: Sys$UI$Control$get_role,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5418 get_visibilityMode: Sys$UI$Control$get_visibilityMode,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5419 set_visibilityMode: Sys$UI$Control$set_visibilityMode,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5420 get_visible: Sys$UI$Control$get_visible,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5421 set_visible: Sys$UI$Control$set_visible,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5422 addCssClass: Sys$UI$Control$addCssClass,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5423 dispose: Sys$UI$Control$dispose,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5424 onBubbleEvent: Sys$UI$Control$onBubbleEvent,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5425 raiseBubbleEvent: Sys$UI$Control$raiseBubbleEvent,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5426 _raiseBubbleEvent: Sys$UI$Control$_raiseBubbleEvent,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5427 removeCssClass: Sys$UI$Control$removeCssClass,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5428 toggleCssClass: Sys$UI$Control$toggleCssClass
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5429 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5430 Sys.UI.Control.registerClass('Sys.UI.Control', Sys.Component);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5431 Sys.HistoryEventArgs = function Sys$HistoryEventArgs(state) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5432 /// <summary locid="M:J#Sys.HistoryEventArgs.#ctor" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5433 /// <param name="state" type="Object"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5434 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5435 {name: "state", type: Object}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5436 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5437 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5438 Sys.HistoryEventArgs.initializeBase(this);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5439 this._state = state;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5440 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5441 function Sys$HistoryEventArgs$get_state() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5442 /// <value type="Object" locid="P:J#Sys.HistoryEventArgs.state"></value>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5443 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5444 return this._state;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5445 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5446 Sys.HistoryEventArgs.prototype = {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5447 get_state: Sys$HistoryEventArgs$get_state
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5448 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5449 Sys.HistoryEventArgs.registerClass('Sys.HistoryEventArgs', Sys.EventArgs);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5450 Sys.Application._appLoadHandler = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5451 Sys.Application._beginRequestHandler = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5452 Sys.Application._clientId = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5453 Sys.Application._currentEntry = '';
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5454 Sys.Application._endRequestHandler = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5455 Sys.Application._history = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5456 Sys.Application._enableHistory = false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5457 Sys.Application._historyEnabledInScriptManager = false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5458 Sys.Application._historyFrame = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5459 Sys.Application._historyInitialized = false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5460 Sys.Application._historyPointIsNew = false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5461 Sys.Application._ignoreTimer = false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5462 Sys.Application._initialState = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5463 Sys.Application._state = {};
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5464 Sys.Application._timerCookie = 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5465 Sys.Application._timerHandler = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5466 Sys.Application._uniqueId = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5467 Sys._Application.prototype.get_stateString = function Sys$_Application$get_stateString() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5468 /// <summary locid="M:J#Sys._Application.get_stateString" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5469 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5470 var hash = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5471
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5472 if (Sys.Browser.agent === Sys.Browser.Firefox) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5473 var href = window.location.href;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5474 var hashIndex = href.indexOf('#');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5475 if (hashIndex !== -1) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5476 hash = href.substring(hashIndex + 1);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5477 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5478 else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5479 hash = "";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5480 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5481 return hash;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5482 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5483 else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5484 hash = window.location.hash;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5485 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5486
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5487 if ((hash.length > 0) && (hash.charAt(0) === '#')) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5488 hash = hash.substring(1);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5489 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5490 return hash;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5491 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5492 Sys._Application.prototype.get_enableHistory = function Sys$_Application$get_enableHistory() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5493 /// <summary locid="M:J#Sys._Application.get_enableHistory" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5494 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5495 return this._enableHistory;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5496 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5497 Sys._Application.prototype.set_enableHistory = function Sys$_Application$set_enableHistory(value) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5498 if (this._initialized && !this._initializing) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5499 throw Error.invalidOperation(Sys.Res.historyCannotEnableHistory);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5500 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5501 else if (this._historyEnabledInScriptManager && !value) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5502 throw Error.invalidOperation(Sys.Res.invalidHistorySettingCombination);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5503 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5504 this._enableHistory = value;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5505 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5506 Sys._Application.prototype.add_navigate = function Sys$_Application$add_navigate(handler) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5507 /// <summary locid="E:J#Sys.Application.navigate" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5508 /// <param name="handler" type="Function"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5509 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5510 {name: "handler", type: Function}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5511 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5512 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5513 this.get_events().addHandler("navigate", handler);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5514 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5515 Sys._Application.prototype.remove_navigate = function Sys$_Application$remove_navigate(handler) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5516 /// <summary locid="M:J#Sys._Application.remove_navigate" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5517 /// <param name="handler" type="Function"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5518 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5519 {name: "handler", type: Function}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5520 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5521 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5522 this.get_events().removeHandler("navigate", handler);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5523 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5524 Sys._Application.prototype.addHistoryPoint = function Sys$_Application$addHistoryPoint(state, title) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5525 /// <summary locid="M:J#Sys.Application.addHistoryPoint" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5526 /// <param name="state" type="Object"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5527 /// <param name="title" type="String" optional="true" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5528 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5529 {name: "state", type: Object},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5530 {name: "title", type: String, mayBeNull: true, optional: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5531 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5532 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5533 if (!this._enableHistory) throw Error.invalidOperation(Sys.Res.historyCannotAddHistoryPointWithHistoryDisabled);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5534 for (var n in state) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5535 var v = state[n];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5536 var t = typeof(v);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5537 if ((v !== null) && ((t === 'object') || (t === 'function') || (t === 'undefined'))) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5538 throw Error.argument('state', Sys.Res.stateMustBeStringDictionary);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5539 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5540 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5541 this._ensureHistory();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5542 var initialState = this._state;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5543 for (var key in state) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5544 var value = state[key];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5545 if (value === null) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5546 if (typeof(initialState[key]) !== 'undefined') {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5547 delete initialState[key];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5548 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5549 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5550 else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5551 initialState[key] = value;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5552 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5553 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5554 var entry = this._serializeState(initialState);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5555 this._historyPointIsNew = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5556 this._setState(entry, title);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5557 this._raiseNavigate();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5558 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5559 Sys._Application.prototype.setServerId = function Sys$_Application$setServerId(clientId, uniqueId) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5560 /// <summary locid="M:J#Sys.Application.setServerId" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5561 /// <param name="clientId" type="String"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5562 /// <param name="uniqueId" type="String"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5563 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5564 {name: "clientId", type: String},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5565 {name: "uniqueId", type: String}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5566 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5567 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5568 this._clientId = clientId;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5569 this._uniqueId = uniqueId;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5570 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5571 Sys._Application.prototype.setServerState = function Sys$_Application$setServerState(value) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5572 /// <summary locid="M:J#Sys.Application.setServerState" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5573 /// <param name="value" type="String"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5574 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5575 {name: "value", type: String}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5576 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5577 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5578 this._ensureHistory();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5579 this._state.__s = value;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5580 this._updateHiddenField(value);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5581 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5582 Sys._Application.prototype._deserializeState = function Sys$_Application$_deserializeState(entry) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5583 var result = {};
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5584 entry = entry || '';
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5585 var serverSeparator = entry.indexOf('&&');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5586 if ((serverSeparator !== -1) && (serverSeparator + 2 < entry.length)) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5587 result.__s = entry.substr(serverSeparator + 2);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5588 entry = entry.substr(0, serverSeparator);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5589 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5590 var tokens = entry.split('&');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5591 for (var i = 0, l = tokens.length; i < l; i++) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5592 var token = tokens[i];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5593 var equal = token.indexOf('=');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5594 if ((equal !== -1) && (equal + 1 < token.length)) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5595 var name = token.substr(0, equal);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5596 var value = token.substr(equal + 1);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5597 result[name] = decodeURIComponent(value);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5598 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5599 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5600 return result;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5601 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5602 Sys._Application.prototype._enableHistoryInScriptManager = function Sys$_Application$_enableHistoryInScriptManager() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5603 this._enableHistory = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5604 this._historyEnabledInScriptManager = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5605 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5606 Sys._Application.prototype._ensureHistory = function Sys$_Application$_ensureHistory() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5607 if (!this._historyInitialized && this._enableHistory) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5608 if ((Sys.Browser.agent === Sys.Browser.InternetExplorer) && (Sys.Browser.documentMode < 8)) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5609 this._historyFrame = document.getElementById('__historyFrame');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5610 if (!this._historyFrame) throw Error.invalidOperation(Sys.Res.historyMissingFrame);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5611 this._ignoreIFrame = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5612 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5613 this._timerHandler = Function.createDelegate(this, this._onIdle);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5614 this._timerCookie = window.setTimeout(this._timerHandler, 100);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5615
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5616 try {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5617 this._initialState = this._deserializeState(this.get_stateString());
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5618 } catch(e) {}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5619
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5620 this._historyInitialized = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5621 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5622 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5623 Sys._Application.prototype._navigate = function Sys$_Application$_navigate(entry) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5624 this._ensureHistory();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5625 var state = this._deserializeState(entry);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5626
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5627 if (this._uniqueId) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5628 var oldServerEntry = this._state.__s || '';
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5629 var newServerEntry = state.__s || '';
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5630 if (newServerEntry !== oldServerEntry) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5631 this._updateHiddenField(newServerEntry);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5632 __doPostBack(this._uniqueId, newServerEntry);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5633 this._state = state;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5634 return;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5635 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5636 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5637 this._setState(entry);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5638 this._state = state;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5639 this._raiseNavigate();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5640 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5641 Sys._Application.prototype._onIdle = function Sys$_Application$_onIdle() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5642 delete this._timerCookie;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5643
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5644 var entry = this.get_stateString();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5645 if (entry !== this._currentEntry) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5646 if (!this._ignoreTimer) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5647 this._historyPointIsNew = false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5648 this._navigate(entry);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5649 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5650 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5651 else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5652 this._ignoreTimer = false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5653 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5654 this._timerCookie = window.setTimeout(this._timerHandler, 100);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5655 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5656 Sys._Application.prototype._onIFrameLoad = function Sys$_Application$_onIFrameLoad(entry) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5657 this._ensureHistory();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5658 if (!this._ignoreIFrame) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5659 this._historyPointIsNew = false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5660 this._navigate(entry);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5661 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5662 this._ignoreIFrame = false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5663 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5664 Sys._Application.prototype._onPageRequestManagerBeginRequest = function Sys$_Application$_onPageRequestManagerBeginRequest(sender, args) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5665 this._ignoreTimer = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5666 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5667 Sys._Application.prototype._onPageRequestManagerEndRequest = function Sys$_Application$_onPageRequestManagerEndRequest(sender, args) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5668 var dataItem = args.get_dataItems()[this._clientId];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5669 var eventTarget = document.getElementById("__EVENTTARGET");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5670 if (eventTarget && eventTarget.value === this._uniqueId) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5671 eventTarget.value = '';
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5672 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5673 if (typeof(dataItem) !== 'undefined') {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5674 this.setServerState(dataItem);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5675 this._historyPointIsNew = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5676 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5677 else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5678 this._ignoreTimer = false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5679 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5680 var entry = this._serializeState(this._state);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5681 if (entry !== this._currentEntry) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5682 this._ignoreTimer = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5683 this._setState(entry);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5684 this._raiseNavigate();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5685 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5686 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5687 Sys._Application.prototype._raiseNavigate = function Sys$_Application$_raiseNavigate() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5688 var h = this.get_events().getHandler("navigate");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5689 var stateClone = {};
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5690 for (var key in this._state) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5691 if (key !== '__s') {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5692 stateClone[key] = this._state[key];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5693 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5694 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5695 var args = new Sys.HistoryEventArgs(stateClone);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5696 if (h) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5697 h(this, args);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5698 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5699 var err;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5700 try {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5701 if ((Sys.Browser.agent === Sys.Browser.Firefox) && window.location.hash &&
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5702 (!window.frameElement || window.top.location.hash)) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5703 window.history.go(0);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5704 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5705 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5706 catch(err) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5707 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5708 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5709 Sys._Application.prototype._serializeState = function Sys$_Application$_serializeState(state) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5710 var serialized = [];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5711 for (var key in state) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5712 var value = state[key];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5713 if (key === '__s') {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5714 var serverState = value;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5715 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5716 else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5717 if (key.indexOf('=') !== -1) throw Error.argument('state', Sys.Res.stateFieldNameInvalid);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5718 serialized[serialized.length] = key + '=' + encodeURIComponent(value);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5719 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5720 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5721 return serialized.join('&') + (serverState ? '&&' + serverState : '');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5722 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5723 Sys._Application.prototype._setState = function Sys$_Application$_setState(entry, title) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5724 if (this._enableHistory) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5725 entry = entry || '';
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5726 if (entry !== this._currentEntry) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5727 if (window.theForm) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5728 var action = window.theForm.action;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5729 var hashIndex = action.indexOf('#');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5730 window.theForm.action = ((hashIndex !== -1) ? action.substring(0, hashIndex) : action) + '#' + entry;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5731 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5732
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5733 if (this._historyFrame && this._historyPointIsNew) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5734 this._ignoreIFrame = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5735 var frameDoc = this._historyFrame.contentWindow.document;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5736 frameDoc.open("javascript:'<html></html>'");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5737 frameDoc.write("<html><head><title>" + (title || document.title) +
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5738 "</title><scri" + "pt type=\"text/javascript\">parent.Sys.Application._onIFrameLoad(" +
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5739 Sys.Serialization.JavaScriptSerializer.serialize(entry) +
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5740 ");</scri" + "pt></head><body></body></html>");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5741 frameDoc.close();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5742 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5743 this._ignoreTimer = false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5744 this._currentEntry = entry;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5745 if (this._historyFrame || this._historyPointIsNew) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5746 var currentHash = this.get_stateString();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5747 if (entry !== currentHash) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5748 var loc = document.location;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5749 if (loc.href.length - loc.hash.length + entry.length > 1024) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5750 throw Error.invalidOperation(Sys.Res.urlMustBeLessThan1024chars);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5751 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5752 window.location.hash = entry;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5753 this._currentEntry = this.get_stateString();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5754 if ((typeof(title) !== 'undefined') && (title !== null)) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5755 document.title = title;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5756 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5757 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5758 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5759 this._historyPointIsNew = false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5760 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5761 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5762 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5763 Sys._Application.prototype._updateHiddenField = function Sys$_Application$_updateHiddenField(value) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5764 if (this._clientId) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5765 var serverStateField = document.getElementById(this._clientId);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5766 if (serverStateField) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5767 serverStateField.value = value;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5768 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5769 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5770 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5771
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5772 if (!window.XMLHttpRequest) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5773 window.XMLHttpRequest = function window$XMLHttpRequest() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5774 var progIDs = [ 'Msxml2.XMLHTTP.3.0', 'Msxml2.XMLHTTP' ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5775 for (var i = 0, l = progIDs.length; i < l; i++) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5776 try {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5777 return new ActiveXObject(progIDs[i]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5778 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5779 catch (ex) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5780 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5781 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5782 return null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5783 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5784 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5785 Type.registerNamespace('Sys.Net');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5786
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5787 Sys.Net.WebRequestExecutor = function Sys$Net$WebRequestExecutor() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5788 /// <summary locid="M:J#Sys.Net.WebRequestExecutor.#ctor" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5789 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5790 this._webRequest = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5791 this._resultObject = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5792 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5793 function Sys$Net$WebRequestExecutor$get_webRequest() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5794 /// <value type="Sys.Net.WebRequest" locid="P:J#Sys.Net.WebRequestExecutor.webRequest"></value>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5795 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5796 return this._webRequest;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5797 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5798 function Sys$Net$WebRequestExecutor$_set_webRequest(value) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5799 if (this.get_started()) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5800 throw Error.invalidOperation(String.format(Sys.Res.cannotCallOnceStarted, 'set_webRequest'));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5801 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5802 this._webRequest = value;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5803 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5804 function Sys$Net$WebRequestExecutor$get_started() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5805 /// <value type="Boolean" locid="P:J#Sys.Net.WebRequestExecutor.started"></value>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5806 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5807 throw Error.notImplemented();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5808 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5809 function Sys$Net$WebRequestExecutor$get_responseAvailable() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5810 /// <value type="Boolean" locid="P:J#Sys.Net.WebRequestExecutor.responseAvailable"></value>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5811 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5812 throw Error.notImplemented();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5813 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5814 function Sys$Net$WebRequestExecutor$get_timedOut() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5815 /// <value type="Boolean" locid="P:J#Sys.Net.WebRequestExecutor.timedOut"></value>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5816 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5817 throw Error.notImplemented();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5818 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5819 function Sys$Net$WebRequestExecutor$get_aborted() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5820 /// <value type="Boolean" locid="P:J#Sys.Net.WebRequestExecutor.aborted"></value>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5821 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5822 throw Error.notImplemented();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5823 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5824 function Sys$Net$WebRequestExecutor$get_responseData() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5825 /// <value type="String" locid="P:J#Sys.Net.WebRequestExecutor.responseData"></value>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5826 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5827 throw Error.notImplemented();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5828 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5829 function Sys$Net$WebRequestExecutor$get_statusCode() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5830 /// <value type="Number" locid="P:J#Sys.Net.WebRequestExecutor.statusCode"></value>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5831 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5832 throw Error.notImplemented();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5833 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5834 function Sys$Net$WebRequestExecutor$get_statusText() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5835 /// <value type="String" locid="P:J#Sys.Net.WebRequestExecutor.statusText"></value>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5836 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5837 throw Error.notImplemented();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5838 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5839 function Sys$Net$WebRequestExecutor$get_xml() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5840 /// <value locid="P:J#Sys.Net.WebRequestExecutor.xml"></value>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5841 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5842 throw Error.notImplemented();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5843 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5844 function Sys$Net$WebRequestExecutor$get_object() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5845 /// <value locid="P:J#Sys.Net.WebRequestExecutor.object"></value>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5846 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5847 if (!this._resultObject) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5848 this._resultObject = Sys.Serialization.JavaScriptSerializer.deserialize(this.get_responseData());
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5849 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5850 return this._resultObject;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5851 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5852 function Sys$Net$WebRequestExecutor$executeRequest() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5853 /// <summary locid="M:J#Sys.Net.WebRequestExecutor.executeRequest" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5854 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5855 throw Error.notImplemented();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5856 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5857 function Sys$Net$WebRequestExecutor$abort() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5858 /// <summary locid="M:J#Sys.Net.WebRequestExecutor.abort" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5859 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5860 throw Error.notImplemented();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5861 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5862 function Sys$Net$WebRequestExecutor$getResponseHeader(header) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5863 /// <summary locid="M:J#Sys.Net.WebRequestExecutor.getResponseHeader" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5864 /// <param name="header" type="String"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5865 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5866 {name: "header", type: String}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5867 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5868 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5869 throw Error.notImplemented();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5870 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5871 function Sys$Net$WebRequestExecutor$getAllResponseHeaders() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5872 /// <summary locid="M:J#Sys.Net.WebRequestExecutor.getAllResponseHeaders" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5873 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5874 throw Error.notImplemented();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5875 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5876 Sys.Net.WebRequestExecutor.prototype = {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5877 get_webRequest: Sys$Net$WebRequestExecutor$get_webRequest,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5878 _set_webRequest: Sys$Net$WebRequestExecutor$_set_webRequest,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5879 get_started: Sys$Net$WebRequestExecutor$get_started,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5880 get_responseAvailable: Sys$Net$WebRequestExecutor$get_responseAvailable,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5881 get_timedOut: Sys$Net$WebRequestExecutor$get_timedOut,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5882 get_aborted: Sys$Net$WebRequestExecutor$get_aborted,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5883 get_responseData: Sys$Net$WebRequestExecutor$get_responseData,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5884 get_statusCode: Sys$Net$WebRequestExecutor$get_statusCode,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5885 get_statusText: Sys$Net$WebRequestExecutor$get_statusText,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5886 get_xml: Sys$Net$WebRequestExecutor$get_xml,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5887 get_object: Sys$Net$WebRequestExecutor$get_object,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5888 executeRequest: Sys$Net$WebRequestExecutor$executeRequest,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5889 abort: Sys$Net$WebRequestExecutor$abort,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5890 getResponseHeader: Sys$Net$WebRequestExecutor$getResponseHeader,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5891 getAllResponseHeaders: Sys$Net$WebRequestExecutor$getAllResponseHeaders
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5892 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5893 Sys.Net.WebRequestExecutor.registerClass('Sys.Net.WebRequestExecutor');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5894
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5895 Sys.Net.XMLDOM = function Sys$Net$XMLDOM(markup) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5896 /// <summary locid="M:J#Sys.Net.XMLDOM.#ctor" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5897 /// <param name="markup" type="String"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5898 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5899 {name: "markup", type: String}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5900 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5901 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5902 if (!window.DOMParser) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5903 var progIDs = [ 'Msxml2.DOMDocument.3.0', 'Msxml2.DOMDocument' ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5904 for (var i = 0, l = progIDs.length; i < l; i++) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5905 try {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5906 var xmlDOM = new ActiveXObject(progIDs[i]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5907 xmlDOM.async = false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5908 xmlDOM.loadXML(markup);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5909 xmlDOM.setProperty('SelectionLanguage', 'XPath');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5910 return xmlDOM;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5911 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5912 catch (ex) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5913 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5914 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5915 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5916 else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5917 try {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5918 var domParser = new window.DOMParser();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5919 return domParser.parseFromString(markup, 'text/xml');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5920 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5921 catch (ex) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5922 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5923 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5924 return null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5925 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5926 Sys.Net.XMLHttpExecutor = function Sys$Net$XMLHttpExecutor() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5927 /// <summary locid="M:J#Sys.Net.XMLHttpExecutor.#ctor" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5928 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5929 Sys.Net.XMLHttpExecutor.initializeBase(this);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5930 var _this = this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5931 this._xmlHttpRequest = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5932 this._webRequest = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5933 this._responseAvailable = false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5934 this._timedOut = false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5935 this._timer = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5936 this._aborted = false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5937 this._started = false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5938 this._onReadyStateChange = (function () {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5939
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5940 if (_this._xmlHttpRequest.readyState === 4 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5941 try {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5942 if (typeof(_this._xmlHttpRequest.status) === "undefined") {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5943 return;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5944 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5945 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5946 catch(ex) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5947 return;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5948 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5949
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5950 _this._clearTimer();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5951 _this._responseAvailable = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5952 _this._webRequest.completed(Sys.EventArgs.Empty);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5953 if (_this._xmlHttpRequest != null) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5954 _this._xmlHttpRequest.onreadystatechange = Function.emptyMethod;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5955 _this._xmlHttpRequest = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5956 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5957 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5958 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5959 this._clearTimer = (function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5960 if (_this._timer != null) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5961 window.clearTimeout(_this._timer);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5962 _this._timer = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5963 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5964 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5965 this._onTimeout = (function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5966 if (!_this._responseAvailable) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5967 _this._clearTimer();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5968 _this._timedOut = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5969 _this._xmlHttpRequest.onreadystatechange = Function.emptyMethod;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5970 _this._xmlHttpRequest.abort();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5971 _this._webRequest.completed(Sys.EventArgs.Empty);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5972 _this._xmlHttpRequest = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5973 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5974 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5975 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5976 function Sys$Net$XMLHttpExecutor$get_timedOut() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5977 /// <value type="Boolean" locid="P:J#Sys.Net.XMLHttpExecutor.timedOut"></value>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5978 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5979 return this._timedOut;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5980 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5981 function Sys$Net$XMLHttpExecutor$get_started() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5982 /// <value type="Boolean" locid="P:J#Sys.Net.XMLHttpExecutor.started"></value>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5983 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5984 return this._started;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5985 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5986 function Sys$Net$XMLHttpExecutor$get_responseAvailable() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5987 /// <value type="Boolean" locid="P:J#Sys.Net.XMLHttpExecutor.responseAvailable"></value>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5988 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5989 return this._responseAvailable;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5990 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5991 function Sys$Net$XMLHttpExecutor$get_aborted() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5992 /// <value type="Boolean" locid="P:J#Sys.Net.XMLHttpExecutor.aborted"></value>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5993 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5994 return this._aborted;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5995 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5996 function Sys$Net$XMLHttpExecutor$executeRequest() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5997 /// <summary locid="M:J#Sys.Net.XMLHttpExecutor.executeRequest" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5998 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5999 this._webRequest = this.get_webRequest();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6000 if (this._started) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6001 throw Error.invalidOperation(String.format(Sys.Res.cannotCallOnceStarted, 'executeRequest'));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6002 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6003 if (this._webRequest === null) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6004 throw Error.invalidOperation(Sys.Res.nullWebRequest);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6005 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6006 var body = this._webRequest.get_body();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6007 var headers = this._webRequest.get_headers();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6008 this._xmlHttpRequest = new XMLHttpRequest();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6009 this._xmlHttpRequest.onreadystatechange = this._onReadyStateChange;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6010 var verb = this._webRequest.get_httpVerb();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6011 this._xmlHttpRequest.open(verb, this._webRequest.getResolvedUrl(), true );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6012 this._xmlHttpRequest.setRequestHeader("X-Requested-With", "XMLHttpRequest");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6013 if (headers) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6014 for (var header in headers) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6015 var val = headers[header];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6016 if (typeof(val) !== "function")
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6017 this._xmlHttpRequest.setRequestHeader(header, val);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6018 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6019 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6020 if (verb.toLowerCase() === "post") {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6021 if ((headers === null) || !headers['Content-Type']) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6022 this._xmlHttpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6023 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6024 if (!body) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6025 body = "";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6026 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6027 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6028 var timeout = this._webRequest.get_timeout();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6029 if (timeout > 0) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6030 this._timer = window.setTimeout(Function.createDelegate(this, this._onTimeout), timeout);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6031 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6032 this._xmlHttpRequest.send(body);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6033 this._started = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6034 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6035 function Sys$Net$XMLHttpExecutor$getResponseHeader(header) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6036 /// <summary locid="M:J#Sys.Net.XMLHttpExecutor.getResponseHeader" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6037 /// <param name="header" type="String"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6038 /// <returns type="String"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6039 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6040 {name: "header", type: String}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6041 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6042 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6043 if (!this._responseAvailable) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6044 throw Error.invalidOperation(String.format(Sys.Res.cannotCallBeforeResponse, 'getResponseHeader'));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6045 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6046 if (!this._xmlHttpRequest) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6047 throw Error.invalidOperation(String.format(Sys.Res.cannotCallOutsideHandler, 'getResponseHeader'));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6048 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6049 var result;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6050 try {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6051 result = this._xmlHttpRequest.getResponseHeader(header);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6052 } catch (e) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6053 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6054 if (!result) result = "";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6055 return result;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6056 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6057 function Sys$Net$XMLHttpExecutor$getAllResponseHeaders() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6058 /// <summary locid="M:J#Sys.Net.XMLHttpExecutor.getAllResponseHeaders" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6059 /// <returns type="String"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6060 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6061 if (!this._responseAvailable) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6062 throw Error.invalidOperation(String.format(Sys.Res.cannotCallBeforeResponse, 'getAllResponseHeaders'));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6063 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6064 if (!this._xmlHttpRequest) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6065 throw Error.invalidOperation(String.format(Sys.Res.cannotCallOutsideHandler, 'getAllResponseHeaders'));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6066 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6067 return this._xmlHttpRequest.getAllResponseHeaders();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6068 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6069 function Sys$Net$XMLHttpExecutor$get_responseData() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6070 /// <value type="String" locid="P:J#Sys.Net.XMLHttpExecutor.responseData"></value>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6071 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6072 if (!this._responseAvailable) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6073 throw Error.invalidOperation(String.format(Sys.Res.cannotCallBeforeResponse, 'get_responseData'));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6074 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6075 if (!this._xmlHttpRequest) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6076 throw Error.invalidOperation(String.format(Sys.Res.cannotCallOutsideHandler, 'get_responseData'));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6077 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6078 return this._xmlHttpRequest.responseText;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6079 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6080 function Sys$Net$XMLHttpExecutor$get_statusCode() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6081 /// <value type="Number" locid="P:J#Sys.Net.XMLHttpExecutor.statusCode"></value>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6082 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6083 if (!this._responseAvailable) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6084 throw Error.invalidOperation(String.format(Sys.Res.cannotCallBeforeResponse, 'get_statusCode'));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6085 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6086 if (!this._xmlHttpRequest) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6087 throw Error.invalidOperation(String.format(Sys.Res.cannotCallOutsideHandler, 'get_statusCode'));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6088 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6089 var result = 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6090 try {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6091 result = this._xmlHttpRequest.status;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6092 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6093 catch(ex) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6094 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6095 return result;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6096 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6097 function Sys$Net$XMLHttpExecutor$get_statusText() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6098 /// <value type="String" locid="P:J#Sys.Net.XMLHttpExecutor.statusText"></value>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6099 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6100 if (!this._responseAvailable) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6101 throw Error.invalidOperation(String.format(Sys.Res.cannotCallBeforeResponse, 'get_statusText'));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6102 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6103 if (!this._xmlHttpRequest) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6104 throw Error.invalidOperation(String.format(Sys.Res.cannotCallOutsideHandler, 'get_statusText'));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6105 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6106 return this._xmlHttpRequest.statusText;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6107 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6108 function Sys$Net$XMLHttpExecutor$get_xml() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6109 /// <value locid="P:J#Sys.Net.XMLHttpExecutor.xml"></value>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6110 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6111 if (!this._responseAvailable) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6112 throw Error.invalidOperation(String.format(Sys.Res.cannotCallBeforeResponse, 'get_xml'));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6113 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6114 if (!this._xmlHttpRequest) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6115 throw Error.invalidOperation(String.format(Sys.Res.cannotCallOutsideHandler, 'get_xml'));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6116 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6117 var xml = this._xmlHttpRequest.responseXML;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6118 if (!xml || !xml.documentElement) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6119 xml = Sys.Net.XMLDOM(this._xmlHttpRequest.responseText);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6120 if (!xml || !xml.documentElement)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6121 return null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6122 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6123 else if (navigator.userAgent.indexOf('MSIE') !== -1) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6124 xml.setProperty('SelectionLanguage', 'XPath');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6125 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6126 if (xml.documentElement.namespaceURI === "http://www.mozilla.org/newlayout/xml/parsererror.xml" &&
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6127 xml.documentElement.tagName === "parsererror") {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6128 return null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6129 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6130
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6131 if (xml.documentElement.firstChild && xml.documentElement.firstChild.tagName === "parsererror") {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6132 return null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6133 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6134
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6135 return xml;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6136 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6137 function Sys$Net$XMLHttpExecutor$abort() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6138 /// <summary locid="M:J#Sys.Net.XMLHttpExecutor.abort" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6139 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6140 if (!this._started) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6141 throw Error.invalidOperation(Sys.Res.cannotAbortBeforeStart);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6142 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6143 if (this._aborted || this._responseAvailable || this._timedOut)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6144 return;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6145 this._aborted = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6146 this._clearTimer();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6147 if (this._xmlHttpRequest && !this._responseAvailable) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6148 this._xmlHttpRequest.onreadystatechange = Function.emptyMethod;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6149 this._xmlHttpRequest.abort();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6150
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6151 this._xmlHttpRequest = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6152 this._webRequest.completed(Sys.EventArgs.Empty);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6153 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6154 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6155 Sys.Net.XMLHttpExecutor.prototype = {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6156 get_timedOut: Sys$Net$XMLHttpExecutor$get_timedOut,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6157 get_started: Sys$Net$XMLHttpExecutor$get_started,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6158 get_responseAvailable: Sys$Net$XMLHttpExecutor$get_responseAvailable,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6159 get_aborted: Sys$Net$XMLHttpExecutor$get_aborted,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6160 executeRequest: Sys$Net$XMLHttpExecutor$executeRequest,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6161 getResponseHeader: Sys$Net$XMLHttpExecutor$getResponseHeader,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6162 getAllResponseHeaders: Sys$Net$XMLHttpExecutor$getAllResponseHeaders,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6163 get_responseData: Sys$Net$XMLHttpExecutor$get_responseData,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6164 get_statusCode: Sys$Net$XMLHttpExecutor$get_statusCode,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6165 get_statusText: Sys$Net$XMLHttpExecutor$get_statusText,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6166 get_xml: Sys$Net$XMLHttpExecutor$get_xml,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6167 abort: Sys$Net$XMLHttpExecutor$abort
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6168 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6169 Sys.Net.XMLHttpExecutor.registerClass('Sys.Net.XMLHttpExecutor', Sys.Net.WebRequestExecutor);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6170
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6171 Sys.Net._WebRequestManager = function Sys$Net$_WebRequestManager() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6172 /// <summary locid="P:J#Sys.Net.WebRequestManager.#ctor" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6173 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6174 this._defaultTimeout = 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6175 this._defaultExecutorType = "Sys.Net.XMLHttpExecutor";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6176 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6177 function Sys$Net$_WebRequestManager$add_invokingRequest(handler) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6178 /// <summary locid="E:J#Sys.Net.WebRequestManager.invokingRequest" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6179 var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6180 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6181 this._get_eventHandlerList().addHandler("invokingRequest", handler);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6182 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6183 function Sys$Net$_WebRequestManager$remove_invokingRequest(handler) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6184 var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6185 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6186 this._get_eventHandlerList().removeHandler("invokingRequest", handler);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6187 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6188 function Sys$Net$_WebRequestManager$add_completedRequest(handler) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6189 /// <summary locid="E:J#Sys.Net.WebRequestManager.completedRequest" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6190 var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6191 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6192 this._get_eventHandlerList().addHandler("completedRequest", handler);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6193 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6194 function Sys$Net$_WebRequestManager$remove_completedRequest(handler) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6195 var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6196 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6197 this._get_eventHandlerList().removeHandler("completedRequest", handler);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6198 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6199 function Sys$Net$_WebRequestManager$_get_eventHandlerList() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6200 if (!this._events) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6201 this._events = new Sys.EventHandlerList();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6202 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6203 return this._events;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6204 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6205 function Sys$Net$_WebRequestManager$get_defaultTimeout() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6206 /// <value type="Number" locid="P:J#Sys.Net.WebRequestManager.defaultTimeout"></value>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6207 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6208 return this._defaultTimeout;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6209 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6210 function Sys$Net$_WebRequestManager$set_defaultTimeout(value) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6211 var e = Function._validateParams(arguments, [{name: "value", type: Number}]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6212 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6213 if (value < 0) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6214 throw Error.argumentOutOfRange("value", value, Sys.Res.invalidTimeout);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6215 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6216 this._defaultTimeout = value;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6217 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6218 function Sys$Net$_WebRequestManager$get_defaultExecutorType() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6219 /// <value type="String" locid="P:J#Sys.Net.WebRequestManager.defaultExecutorType"></value>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6220 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6221 return this._defaultExecutorType;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6222 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6223 function Sys$Net$_WebRequestManager$set_defaultExecutorType(value) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6224 var e = Function._validateParams(arguments, [{name: "value", type: String}]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6225 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6226 this._defaultExecutorType = value;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6227 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6228 function Sys$Net$_WebRequestManager$executeRequest(webRequest) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6229 /// <summary locid="M:J#Sys.Net.WebRequestManager.executeRequest" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6230 /// <param name="webRequest" type="Sys.Net.WebRequest"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6231 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6232 {name: "webRequest", type: Sys.Net.WebRequest}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6233 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6234 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6235 var executor = webRequest.get_executor();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6236 if (!executor) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6237 var failed = false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6238 try {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6239 var executorType = eval(this._defaultExecutorType);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6240 executor = new executorType();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6241 } catch (e) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6242 failed = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6243 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6244 if (failed || !Sys.Net.WebRequestExecutor.isInstanceOfType(executor) || !executor) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6245 throw Error.argument("defaultExecutorType", String.format(Sys.Res.invalidExecutorType, this._defaultExecutorType));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6246 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6247 webRequest.set_executor(executor);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6248 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6249 if (executor.get_aborted()) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6250 return;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6251 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6252 var evArgs = new Sys.Net.NetworkRequestEventArgs(webRequest);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6253 var handler = this._get_eventHandlerList().getHandler("invokingRequest");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6254 if (handler) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6255 handler(this, evArgs);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6256 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6257 if (!evArgs.get_cancel()) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6258 executor.executeRequest();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6259 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6260 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6261 Sys.Net._WebRequestManager.prototype = {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6262 add_invokingRequest: Sys$Net$_WebRequestManager$add_invokingRequest,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6263 remove_invokingRequest: Sys$Net$_WebRequestManager$remove_invokingRequest,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6264 add_completedRequest: Sys$Net$_WebRequestManager$add_completedRequest,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6265 remove_completedRequest: Sys$Net$_WebRequestManager$remove_completedRequest,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6266 _get_eventHandlerList: Sys$Net$_WebRequestManager$_get_eventHandlerList,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6267 get_defaultTimeout: Sys$Net$_WebRequestManager$get_defaultTimeout,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6268 set_defaultTimeout: Sys$Net$_WebRequestManager$set_defaultTimeout,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6269 get_defaultExecutorType: Sys$Net$_WebRequestManager$get_defaultExecutorType,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6270 set_defaultExecutorType: Sys$Net$_WebRequestManager$set_defaultExecutorType,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6271 executeRequest: Sys$Net$_WebRequestManager$executeRequest
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6272 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6273 Sys.Net._WebRequestManager.registerClass('Sys.Net._WebRequestManager');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6274 Sys.Net.WebRequestManager = new Sys.Net._WebRequestManager();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6275
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6276 Sys.Net.NetworkRequestEventArgs = function Sys$Net$NetworkRequestEventArgs(webRequest) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6277 /// <summary locid="M:J#Sys.Net.NetworkRequestEventArgs.#ctor" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6278 /// <param name="webRequest" type="Sys.Net.WebRequest"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6279 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6280 {name: "webRequest", type: Sys.Net.WebRequest}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6281 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6282 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6283 Sys.Net.NetworkRequestEventArgs.initializeBase(this);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6284 this._webRequest = webRequest;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6285 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6286 function Sys$Net$NetworkRequestEventArgs$get_webRequest() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6287 /// <value type="Sys.Net.WebRequest" locid="P:J#Sys.Net.NetworkRequestEventArgs.webRequest"></value>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6288 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6289 return this._webRequest;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6290 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6291 Sys.Net.NetworkRequestEventArgs.prototype = {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6292 get_webRequest: Sys$Net$NetworkRequestEventArgs$get_webRequest
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6293 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6294 Sys.Net.NetworkRequestEventArgs.registerClass('Sys.Net.NetworkRequestEventArgs', Sys.CancelEventArgs);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6295
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6296 Sys.Net.WebRequest = function Sys$Net$WebRequest() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6297 /// <summary locid="M:J#Sys.Net.WebRequest.#ctor" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6298 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6299 this._url = "";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6300 this._headers = { };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6301 this._body = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6302 this._userContext = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6303 this._httpVerb = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6304 this._executor = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6305 this._invokeCalled = false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6306 this._timeout = 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6307 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6308 function Sys$Net$WebRequest$add_completed(handler) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6309 /// <summary locid="E:J#Sys.Net.WebRequest.completed" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6310 var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6311 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6312 this._get_eventHandlerList().addHandler("completed", handler);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6313 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6314 function Sys$Net$WebRequest$remove_completed(handler) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6315 var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6316 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6317 this._get_eventHandlerList().removeHandler("completed", handler);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6318 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6319 function Sys$Net$WebRequest$completed(eventArgs) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6320 /// <summary locid="M:J#Sys.Net.WebRequest.completed" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6321 /// <param name="eventArgs" type="Sys.EventArgs"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6322 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6323 {name: "eventArgs", type: Sys.EventArgs}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6324 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6325 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6326 var handler = Sys.Net.WebRequestManager._get_eventHandlerList().getHandler("completedRequest");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6327 if (handler) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6328 handler(this._executor, eventArgs);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6329 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6330 handler = this._get_eventHandlerList().getHandler("completed");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6331 if (handler) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6332 handler(this._executor, eventArgs);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6333 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6334 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6335 function Sys$Net$WebRequest$_get_eventHandlerList() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6336 if (!this._events) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6337 this._events = new Sys.EventHandlerList();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6338 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6339 return this._events;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6340 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6341 function Sys$Net$WebRequest$get_url() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6342 /// <value type="String" locid="P:J#Sys.Net.WebRequest.url"></value>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6343 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6344 return this._url;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6345 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6346 function Sys$Net$WebRequest$set_url(value) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6347 var e = Function._validateParams(arguments, [{name: "value", type: String}]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6348 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6349 this._url = value;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6350 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6351 function Sys$Net$WebRequest$get_headers() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6352 /// <value locid="P:J#Sys.Net.WebRequest.headers"></value>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6353 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6354 return this._headers;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6355 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6356 function Sys$Net$WebRequest$get_httpVerb() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6357 /// <value type="String" locid="P:J#Sys.Net.WebRequest.httpVerb"></value>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6358 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6359 if (this._httpVerb === null) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6360 if (this._body === null) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6361 return "GET";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6362 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6363 return "POST";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6364 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6365 return this._httpVerb;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6366 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6367 function Sys$Net$WebRequest$set_httpVerb(value) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6368 var e = Function._validateParams(arguments, [{name: "value", type: String}]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6369 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6370 if (value.length === 0) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6371 throw Error.argument('value', Sys.Res.invalidHttpVerb);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6372 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6373 this._httpVerb = value;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6374 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6375 function Sys$Net$WebRequest$get_body() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6376 /// <value mayBeNull="true" locid="P:J#Sys.Net.WebRequest.body"></value>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6377 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6378 return this._body;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6379 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6380 function Sys$Net$WebRequest$set_body(value) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6381 var e = Function._validateParams(arguments, [{name: "value", mayBeNull: true}]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6382 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6383 this._body = value;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6384 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6385 function Sys$Net$WebRequest$get_userContext() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6386 /// <value mayBeNull="true" locid="P:J#Sys.Net.WebRequest.userContext"></value>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6387 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6388 return this._userContext;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6389 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6390 function Sys$Net$WebRequest$set_userContext(value) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6391 var e = Function._validateParams(arguments, [{name: "value", mayBeNull: true}]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6392 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6393 this._userContext = value;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6394 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6395 function Sys$Net$WebRequest$get_executor() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6396 /// <value type="Sys.Net.WebRequestExecutor" locid="P:J#Sys.Net.WebRequest.executor"></value>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6397 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6398 return this._executor;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6399 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6400 function Sys$Net$WebRequest$set_executor(value) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6401 var e = Function._validateParams(arguments, [{name: "value", type: Sys.Net.WebRequestExecutor}]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6402 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6403 if (this._executor !== null && this._executor.get_started()) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6404 throw Error.invalidOperation(Sys.Res.setExecutorAfterActive);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6405 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6406 this._executor = value;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6407 this._executor._set_webRequest(this);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6408 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6409 function Sys$Net$WebRequest$get_timeout() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6410 /// <value type="Number" locid="P:J#Sys.Net.WebRequest.timeout"></value>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6411 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6412 if (this._timeout === 0) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6413 return Sys.Net.WebRequestManager.get_defaultTimeout();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6414 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6415 return this._timeout;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6416 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6417 function Sys$Net$WebRequest$set_timeout(value) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6418 var e = Function._validateParams(arguments, [{name: "value", type: Number}]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6419 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6420 if (value < 0) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6421 throw Error.argumentOutOfRange("value", value, Sys.Res.invalidTimeout);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6422 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6423 this._timeout = value;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6424 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6425 function Sys$Net$WebRequest$getResolvedUrl() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6426 /// <summary locid="M:J#Sys.Net.WebRequest.getResolvedUrl" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6427 /// <returns type="String"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6428 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6429 return Sys.Net.WebRequest._resolveUrl(this._url);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6430 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6431 function Sys$Net$WebRequest$invoke() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6432 /// <summary locid="M:J#Sys.Net.WebRequest.invoke" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6433 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6434 if (this._invokeCalled) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6435 throw Error.invalidOperation(Sys.Res.invokeCalledTwice);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6436 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6437 Sys.Net.WebRequestManager.executeRequest(this);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6438 this._invokeCalled = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6439 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6440 Sys.Net.WebRequest.prototype = {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6441 add_completed: Sys$Net$WebRequest$add_completed,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6442 remove_completed: Sys$Net$WebRequest$remove_completed,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6443 completed: Sys$Net$WebRequest$completed,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6444 _get_eventHandlerList: Sys$Net$WebRequest$_get_eventHandlerList,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6445 get_url: Sys$Net$WebRequest$get_url,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6446 set_url: Sys$Net$WebRequest$set_url,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6447 get_headers: Sys$Net$WebRequest$get_headers,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6448 get_httpVerb: Sys$Net$WebRequest$get_httpVerb,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6449 set_httpVerb: Sys$Net$WebRequest$set_httpVerb,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6450 get_body: Sys$Net$WebRequest$get_body,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6451 set_body: Sys$Net$WebRequest$set_body,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6452 get_userContext: Sys$Net$WebRequest$get_userContext,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6453 set_userContext: Sys$Net$WebRequest$set_userContext,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6454 get_executor: Sys$Net$WebRequest$get_executor,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6455 set_executor: Sys$Net$WebRequest$set_executor,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6456 get_timeout: Sys$Net$WebRequest$get_timeout,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6457 set_timeout: Sys$Net$WebRequest$set_timeout,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6458 getResolvedUrl: Sys$Net$WebRequest$getResolvedUrl,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6459 invoke: Sys$Net$WebRequest$invoke
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6460 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6461 Sys.Net.WebRequest._resolveUrl = function Sys$Net$WebRequest$_resolveUrl(url, baseUrl) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6462 if (url && url.indexOf('://') !== -1) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6463 return url;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6464 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6465 if (!baseUrl || baseUrl.length === 0) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6466 var baseElement = document.getElementsByTagName('base')[0];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6467 if (baseElement && baseElement.href && baseElement.href.length > 0) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6468 baseUrl = baseElement.href;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6469 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6470 else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6471 baseUrl = document.URL;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6472 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6473 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6474 var qsStart = baseUrl.indexOf('?');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6475 if (qsStart !== -1) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6476 baseUrl = baseUrl.substr(0, qsStart);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6477 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6478 qsStart = baseUrl.indexOf('#');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6479 if (qsStart !== -1) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6480 baseUrl = baseUrl.substr(0, qsStart);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6481 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6482 baseUrl = baseUrl.substr(0, baseUrl.lastIndexOf('/') + 1);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6483 if (!url || url.length === 0) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6484 return baseUrl;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6485 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6486 if (url.charAt(0) === '/') {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6487 var slashslash = baseUrl.indexOf('://');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6488 if (slashslash === -1) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6489 throw Error.argument("baseUrl", Sys.Res.badBaseUrl1);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6490 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6491 var nextSlash = baseUrl.indexOf('/', slashslash + 3);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6492 if (nextSlash === -1) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6493 throw Error.argument("baseUrl", Sys.Res.badBaseUrl2);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6494 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6495 return baseUrl.substr(0, nextSlash) + url;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6496 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6497 else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6498 var lastSlash = baseUrl.lastIndexOf('/');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6499 if (lastSlash === -1) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6500 throw Error.argument("baseUrl", Sys.Res.badBaseUrl3);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6501 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6502 return baseUrl.substr(0, lastSlash+1) + url;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6503 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6504 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6505 Sys.Net.WebRequest._createQueryString = function Sys$Net$WebRequest$_createQueryString(queryString, encodeMethod, addParams) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6506 encodeMethod = encodeMethod || encodeURIComponent;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6507 var i = 0, obj, val, arg, sb = new Sys.StringBuilder();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6508 if (queryString) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6509 for (arg in queryString) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6510 obj = queryString[arg];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6511 if (typeof(obj) === "function") continue;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6512 val = Sys.Serialization.JavaScriptSerializer.serialize(obj);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6513 if (i++) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6514 sb.append('&');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6515 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6516 sb.append(arg);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6517 sb.append('=');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6518 sb.append(encodeMethod(val));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6519 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6520 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6521 if (addParams) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6522 if (i) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6523 sb.append('&');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6524 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6525 sb.append(addParams);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6526 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6527 return sb.toString();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6528 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6529 Sys.Net.WebRequest._createUrl = function Sys$Net$WebRequest$_createUrl(url, queryString, addParams) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6530 if (!queryString && !addParams) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6531 return url;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6532 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6533 var qs = Sys.Net.WebRequest._createQueryString(queryString, null, addParams);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6534 return qs.length
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6535 ? url + ((url && url.indexOf('?') >= 0) ? "&" : "?") + qs
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6536 : url;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6537 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6538 Sys.Net.WebRequest.registerClass('Sys.Net.WebRequest');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6539
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6540 Sys._ScriptLoaderTask = function Sys$_ScriptLoaderTask(scriptElement, completedCallback) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6541 /// <summary locid="M:J#Sys._ScriptLoaderTask.#ctor" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6542 /// <param name="scriptElement" domElement="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6543 /// <param name="completedCallback" type="Function"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6544 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6545 {name: "scriptElement", domElement: true},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6546 {name: "completedCallback", type: Function}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6547 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6548 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6549 this._scriptElement = scriptElement;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6550 this._completedCallback = completedCallback;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6551 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6552 function Sys$_ScriptLoaderTask$get_scriptElement() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6553 /// <value domElement="true" locid="P:J#Sys._ScriptLoaderTask.scriptElement"></value>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6554 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6555 return this._scriptElement;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6556 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6557 function Sys$_ScriptLoaderTask$dispose() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6558 if(this._disposed) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6559 return;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6560 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6561 this._disposed = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6562 this._removeScriptElementHandlers();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6563 Sys._ScriptLoaderTask._clearScript(this._scriptElement);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6564 this._scriptElement = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6565 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6566 function Sys$_ScriptLoaderTask$execute() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6567 /// <summary locid="M:J#Sys._ScriptLoaderTask.execute" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6568 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6569 this._addScriptElementHandlers();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6570 var headElements = document.getElementsByTagName('head');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6571 if (headElements.length === 0) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6572 throw new Error.invalidOperation(Sys.Res.scriptLoadFailedNoHead);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6573 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6574 else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6575 headElements[0].appendChild(this._scriptElement);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6576 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6577 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6578 function Sys$_ScriptLoaderTask$_addScriptElementHandlers() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6579 this._scriptLoadDelegate = Function.createDelegate(this, this._scriptLoadHandler);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6580
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6581 if (Sys.Browser.agent !== Sys.Browser.InternetExplorer) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6582 this._scriptElement.readyState = 'loaded';
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6583 $addHandler(this._scriptElement, 'load', this._scriptLoadDelegate);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6584 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6585 else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6586 $addHandler(this._scriptElement, 'readystatechange', this._scriptLoadDelegate);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6587 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6588 if (this._scriptElement.addEventListener) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6589 this._scriptErrorDelegate = Function.createDelegate(this, this._scriptErrorHandler);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6590 this._scriptElement.addEventListener('error', this._scriptErrorDelegate, false);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6591 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6592 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6593 function Sys$_ScriptLoaderTask$_removeScriptElementHandlers() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6594 if(this._scriptLoadDelegate) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6595 var scriptElement = this.get_scriptElement();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6596 if (Sys.Browser.agent !== Sys.Browser.InternetExplorer) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6597 $removeHandler(scriptElement, 'load', this._scriptLoadDelegate);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6598 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6599 else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6600 $removeHandler(scriptElement, 'readystatechange', this._scriptLoadDelegate);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6601 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6602 if (this._scriptErrorDelegate) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6603 this._scriptElement.removeEventListener('error', this._scriptErrorDelegate, false);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6604 this._scriptErrorDelegate = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6605 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6606 this._scriptLoadDelegate = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6607 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6608 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6609 function Sys$_ScriptLoaderTask$_scriptErrorHandler() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6610 if(this._disposed) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6611 return;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6612 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6613
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6614 this._completedCallback(this.get_scriptElement(), false);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6615 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6616 function Sys$_ScriptLoaderTask$_scriptLoadHandler() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6617 if(this._disposed) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6618 return;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6619 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6620 var scriptElement = this.get_scriptElement();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6621 if ((scriptElement.readyState !== 'loaded') &&
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6622 (scriptElement.readyState !== 'complete')) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6623 return;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6624 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6625
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6626 this._completedCallback(scriptElement, true);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6627 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6628 Sys._ScriptLoaderTask.prototype = {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6629 get_scriptElement: Sys$_ScriptLoaderTask$get_scriptElement,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6630 dispose: Sys$_ScriptLoaderTask$dispose,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6631 execute: Sys$_ScriptLoaderTask$execute,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6632 _addScriptElementHandlers: Sys$_ScriptLoaderTask$_addScriptElementHandlers,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6633 _removeScriptElementHandlers: Sys$_ScriptLoaderTask$_removeScriptElementHandlers,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6634 _scriptErrorHandler: Sys$_ScriptLoaderTask$_scriptErrorHandler,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6635 _scriptLoadHandler: Sys$_ScriptLoaderTask$_scriptLoadHandler
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6636 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6637 Sys._ScriptLoaderTask.registerClass("Sys._ScriptLoaderTask", null, Sys.IDisposable);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6638 Sys._ScriptLoaderTask._clearScript = function Sys$_ScriptLoaderTask$_clearScript(scriptElement) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6639 if (!Sys.Debug.isDebug) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6640 scriptElement.parentNode.removeChild(scriptElement);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6641 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6642 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6643 Type.registerNamespace('Sys.Net');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6644
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6645 Sys.Net.WebServiceProxy = function Sys$Net$WebServiceProxy() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6646 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6647 function Sys$Net$WebServiceProxy$get_timeout() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6648 /// <value type="Number" locid="P:J#Sys.Net.WebServiceProxy.timeout"></value>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6649 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6650 return this._timeout || 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6651 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6652 function Sys$Net$WebServiceProxy$set_timeout(value) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6653 var e = Function._validateParams(arguments, [{name: "value", type: Number}]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6654 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6655 if (value < 0) { throw Error.argumentOutOfRange('value', value, Sys.Res.invalidTimeout); }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6656 this._timeout = value;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6657 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6658 function Sys$Net$WebServiceProxy$get_defaultUserContext() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6659 /// <value mayBeNull="true" locid="P:J#Sys.Net.WebServiceProxy.defaultUserContext"></value>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6660 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6661 return (typeof(this._userContext) === "undefined") ? null : this._userContext;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6662 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6663 function Sys$Net$WebServiceProxy$set_defaultUserContext(value) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6664 var e = Function._validateParams(arguments, [{name: "value", mayBeNull: true}]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6665 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6666 this._userContext = value;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6667 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6668 function Sys$Net$WebServiceProxy$get_defaultSucceededCallback() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6669 /// <value type="Function" mayBeNull="true" locid="P:J#Sys.Net.WebServiceProxy.defaultSucceededCallback"></value>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6670 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6671 return this._succeeded || null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6672 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6673 function Sys$Net$WebServiceProxy$set_defaultSucceededCallback(value) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6674 var e = Function._validateParams(arguments, [{name: "value", type: Function, mayBeNull: true}]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6675 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6676 this._succeeded = value;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6677 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6678 function Sys$Net$WebServiceProxy$get_defaultFailedCallback() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6679 /// <value type="Function" mayBeNull="true" locid="P:J#Sys.Net.WebServiceProxy.defaultFailedCallback"></value>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6680 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6681 return this._failed || null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6682 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6683 function Sys$Net$WebServiceProxy$set_defaultFailedCallback(value) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6684 var e = Function._validateParams(arguments, [{name: "value", type: Function, mayBeNull: true}]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6685 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6686 this._failed = value;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6687 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6688 function Sys$Net$WebServiceProxy$get_enableJsonp() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6689 /// <value type="Boolean" locid="P:J#Sys.Net.WebServiceProxy.enableJsonp"></value>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6690 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6691 return !!this._jsonp;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6692 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6693 function Sys$Net$WebServiceProxy$set_enableJsonp(value) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6694 var e = Function._validateParams(arguments, [{name: "value", type: Boolean}]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6695 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6696 this._jsonp = value;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6697 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6698 function Sys$Net$WebServiceProxy$get_path() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6699 /// <value type="String" locid="P:J#Sys.Net.WebServiceProxy.path"></value>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6700 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6701 return this._path || null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6702 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6703 function Sys$Net$WebServiceProxy$set_path(value) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6704 var e = Function._validateParams(arguments, [{name: "value", type: String}]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6705 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6706 this._path = value;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6707 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6708 function Sys$Net$WebServiceProxy$get_jsonpCallbackParameter() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6709 /// <value type="String" locid="P:J#Sys.Net.WebServiceProxy.jsonpCallbackParameter"></value>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6710 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6711 return this._callbackParameter || "callback";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6712 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6713 function Sys$Net$WebServiceProxy$set_jsonpCallbackParameter(value) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6714 var e = Function._validateParams(arguments, [{name: "value", type: String}]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6715 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6716 this._callbackParameter = value;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6717 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6718 function Sys$Net$WebServiceProxy$_invoke(servicePath, methodName, useGet, params, onSuccess, onFailure, userContext) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6719 /// <summary locid="M:J#Sys.Net.WebServiceProxy._invoke" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6720 /// <param name="servicePath" type="String"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6721 /// <param name="methodName" type="String"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6722 /// <param name="useGet" type="Boolean"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6723 /// <param name="params"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6724 /// <param name="onSuccess" type="Function" mayBeNull="true" optional="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6725 /// <param name="onFailure" type="Function" mayBeNull="true" optional="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6726 /// <param name="userContext" mayBeNull="true" optional="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6727 /// <returns type="Sys.Net.WebRequest" mayBeNull="true"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6728 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6729 {name: "servicePath", type: String},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6730 {name: "methodName", type: String},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6731 {name: "useGet", type: Boolean},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6732 {name: "params"},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6733 {name: "onSuccess", type: Function, mayBeNull: true, optional: true},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6734 {name: "onFailure", type: Function, mayBeNull: true, optional: true},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6735 {name: "userContext", mayBeNull: true, optional: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6736 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6737 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6738 onSuccess = onSuccess || this.get_defaultSucceededCallback();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6739 onFailure = onFailure || this.get_defaultFailedCallback();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6740 if (userContext === null || typeof userContext === 'undefined') userContext = this.get_defaultUserContext();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6741 return Sys.Net.WebServiceProxy.invoke(servicePath, methodName, useGet, params, onSuccess, onFailure, userContext, this.get_timeout(), this.get_enableJsonp(), this.get_jsonpCallbackParameter());
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6742 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6743 Sys.Net.WebServiceProxy.prototype = {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6744 get_timeout: Sys$Net$WebServiceProxy$get_timeout,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6745 set_timeout: Sys$Net$WebServiceProxy$set_timeout,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6746 get_defaultUserContext: Sys$Net$WebServiceProxy$get_defaultUserContext,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6747 set_defaultUserContext: Sys$Net$WebServiceProxy$set_defaultUserContext,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6748 get_defaultSucceededCallback: Sys$Net$WebServiceProxy$get_defaultSucceededCallback,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6749 set_defaultSucceededCallback: Sys$Net$WebServiceProxy$set_defaultSucceededCallback,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6750 get_defaultFailedCallback: Sys$Net$WebServiceProxy$get_defaultFailedCallback,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6751 set_defaultFailedCallback: Sys$Net$WebServiceProxy$set_defaultFailedCallback,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6752 get_enableJsonp: Sys$Net$WebServiceProxy$get_enableJsonp,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6753 set_enableJsonp: Sys$Net$WebServiceProxy$set_enableJsonp,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6754 get_path: Sys$Net$WebServiceProxy$get_path,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6755 set_path: Sys$Net$WebServiceProxy$set_path,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6756 get_jsonpCallbackParameter: Sys$Net$WebServiceProxy$get_jsonpCallbackParameter,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6757 set_jsonpCallbackParameter: Sys$Net$WebServiceProxy$set_jsonpCallbackParameter,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6758 _invoke: Sys$Net$WebServiceProxy$_invoke
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6759 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6760 Sys.Net.WebServiceProxy.registerClass('Sys.Net.WebServiceProxy');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6761 Sys.Net.WebServiceProxy.invoke = function Sys$Net$WebServiceProxy$invoke(servicePath, methodName, useGet, params, onSuccess, onFailure, userContext, timeout, enableJsonp, jsonpCallbackParameter) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6762 /// <summary locid="M:J#Sys.Net.WebServiceProxy.invoke" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6763 /// <param name="servicePath" type="String"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6764 /// <param name="methodName" type="String" mayBeNull="true" optional="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6765 /// <param name="useGet" type="Boolean" optional="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6766 /// <param name="params" mayBeNull="true" optional="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6767 /// <param name="onSuccess" type="Function" mayBeNull="true" optional="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6768 /// <param name="onFailure" type="Function" mayBeNull="true" optional="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6769 /// <param name="userContext" mayBeNull="true" optional="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6770 /// <param name="timeout" type="Number" optional="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6771 /// <param name="enableJsonp" type="Boolean" optional="true" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6772 /// <param name="jsonpCallbackParameter" type="String" optional="true" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6773 /// <returns type="Sys.Net.WebRequest" mayBeNull="true"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6774 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6775 {name: "servicePath", type: String},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6776 {name: "methodName", type: String, mayBeNull: true, optional: true},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6777 {name: "useGet", type: Boolean, optional: true},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6778 {name: "params", mayBeNull: true, optional: true},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6779 {name: "onSuccess", type: Function, mayBeNull: true, optional: true},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6780 {name: "onFailure", type: Function, mayBeNull: true, optional: true},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6781 {name: "userContext", mayBeNull: true, optional: true},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6782 {name: "timeout", type: Number, optional: true},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6783 {name: "enableJsonp", type: Boolean, mayBeNull: true, optional: true},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6784 {name: "jsonpCallbackParameter", type: String, mayBeNull: true, optional: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6785 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6786 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6787 var schemeHost = (enableJsonp !== false) ? Sys.Net.WebServiceProxy._xdomain.exec(servicePath) : null,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6788 tempCallback, jsonp = schemeHost && (schemeHost.length === 3) &&
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6789 ((schemeHost[1] !== location.protocol) || (schemeHost[2] !== location.host));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6790 useGet = jsonp || useGet;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6791 if (jsonp) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6792 jsonpCallbackParameter = jsonpCallbackParameter || "callback";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6793 tempCallback = "_jsonp" + Sys._jsonp++;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6794 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6795 if (!params) params = {};
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6796 var urlParams = params;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6797 if (!useGet || !urlParams) urlParams = {};
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6798 var script, error, timeoutcookie = null, loader, body = null,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6799 url = Sys.Net.WebRequest._createUrl(methodName
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6800 ? (servicePath+"/"+encodeURIComponent(methodName))
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6801 : servicePath, urlParams, jsonp ? (jsonpCallbackParameter + "=Sys." + tempCallback) : null);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6802 if (jsonp) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6803 script = document.createElement("script");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6804 script.src = url;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6805 loader = new Sys._ScriptLoaderTask(script, function(script, loaded) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6806 if (!loaded || tempCallback) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6807 jsonpComplete({ Message: String.format(Sys.Res.webServiceFailedNoMsg, methodName) }, -1);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6808 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6809 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6810 function jsonpComplete(data, statusCode) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6811 if (timeoutcookie !== null) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6812 window.clearTimeout(timeoutcookie);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6813 timeoutcookie = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6814 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6815 loader.dispose();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6816 delete Sys[tempCallback];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6817 tempCallback = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6818 if ((typeof(statusCode) !== "undefined") && (statusCode !== 200)) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6819 if (onFailure) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6820 error = new Sys.Net.WebServiceError(false,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6821 data.Message || String.format(Sys.Res.webServiceFailedNoMsg, methodName),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6822 data.StackTrace || null,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6823 data.ExceptionType || null,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6824 data);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6825 error._statusCode = statusCode;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6826 onFailure(error, userContext, methodName);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6827 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6828 else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6829 if (data.StackTrace && data.Message) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6830 error = data.StackTrace + "-- " + data.Message;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6831 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6832 else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6833 error = data.StackTrace || data.Message;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6834 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6835 error = String.format(error ? Sys.Res.webServiceFailed : Sys.Res.webServiceFailedNoMsg, methodName, error);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6836 throw Sys.Net.WebServiceProxy._createFailedError(methodName, String.format(Sys.Res.webServiceFailed, methodName, error));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6837 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6838 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6839 else if (onSuccess) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6840 onSuccess(data, userContext, methodName);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6841 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6842 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6843 Sys[tempCallback] = jsonpComplete;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6844 loader.execute();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6845 return null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6846 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6847 var request = new Sys.Net.WebRequest();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6848 request.set_url(url);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6849 request.get_headers()['Content-Type'] = 'application/json; charset=utf-8';
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6850 if (!useGet) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6851 body = Sys.Serialization.JavaScriptSerializer.serialize(params);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6852 if (body === "{}") body = "";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6853 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6854 request.set_body(body);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6855 request.add_completed(onComplete);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6856 if (timeout && timeout > 0) request.set_timeout(timeout);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6857 request.invoke();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6858
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6859 function onComplete(response, eventArgs) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6860 if (response.get_responseAvailable()) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6861 var statusCode = response.get_statusCode();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6862 var result = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6863
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6864 try {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6865 var contentType = response.getResponseHeader("Content-Type");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6866 if (contentType.startsWith("application/json")) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6867 result = response.get_object();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6868 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6869 else if (contentType.startsWith("text/xml")) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6870 result = response.get_xml();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6871 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6872 else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6873 result = response.get_responseData();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6874 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6875 } catch (ex) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6876 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6877 var error = response.getResponseHeader("jsonerror");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6878 var errorObj = (error === "true");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6879 if (errorObj) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6880 if (result) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6881 result = new Sys.Net.WebServiceError(false, result.Message, result.StackTrace, result.ExceptionType, result);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6882 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6883 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6884 else if (contentType.startsWith("application/json")) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6885 result = (!result || (typeof(result.d) === "undefined")) ? result : result.d;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6886 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6887 if (((statusCode < 200) || (statusCode >= 300)) || errorObj) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6888 if (onFailure) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6889 if (!result || !errorObj) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6890 result = new Sys.Net.WebServiceError(false , String.format(Sys.Res.webServiceFailedNoMsg, methodName));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6891 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6892 result._statusCode = statusCode;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6893 onFailure(result, userContext, methodName);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6894 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6895 else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6896 if (result && errorObj) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6897 error = result.get_exceptionType() + "-- " + result.get_message();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6898 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6899 else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6900 error = response.get_responseData();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6901 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6902 throw Sys.Net.WebServiceProxy._createFailedError(methodName, String.format(Sys.Res.webServiceFailed, methodName, error));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6903 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6904 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6905 else if (onSuccess) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6906 onSuccess(result, userContext, methodName);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6907 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6908 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6909 else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6910 var msg;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6911 if (response.get_timedOut()) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6912 msg = String.format(Sys.Res.webServiceTimedOut, methodName);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6913 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6914 else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6915 msg = String.format(Sys.Res.webServiceFailedNoMsg, methodName)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6916 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6917 if (onFailure) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6918 onFailure(new Sys.Net.WebServiceError(response.get_timedOut(), msg, "", ""), userContext, methodName);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6919 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6920 else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6921 throw Sys.Net.WebServiceProxy._createFailedError(methodName, msg);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6922 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6923 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6924 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6925 return request;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6926 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6927 Sys.Net.WebServiceProxy._createFailedError = function Sys$Net$WebServiceProxy$_createFailedError(methodName, errorMessage) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6928 var displayMessage = "Sys.Net.WebServiceFailedException: " + errorMessage;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6929 var e = Error.create(displayMessage, { 'name': 'Sys.Net.WebServiceFailedException', 'methodName': methodName });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6930 e.popStackFrame();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6931 return e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6932 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6933 Sys.Net.WebServiceProxy._defaultFailedCallback = function Sys$Net$WebServiceProxy$_defaultFailedCallback(err, methodName) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6934 var error = err.get_exceptionType() + "-- " + err.get_message();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6935 throw Sys.Net.WebServiceProxy._createFailedError(methodName, String.format(Sys.Res.webServiceFailed, methodName, error));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6936 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6937 Sys.Net.WebServiceProxy._generateTypedConstructor = function Sys$Net$WebServiceProxy$_generateTypedConstructor(type) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6938 return function(properties) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6939 if (properties) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6940 for (var name in properties) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6941 this[name] = properties[name];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6942 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6943 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6944 this.__type = type;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6945 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6946 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6947 Sys._jsonp = 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6948 Sys.Net.WebServiceProxy._xdomain = /^\s*([a-zA-Z0-9\+\-\.]+\:)\/\/([^?#\/]+)/;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6949
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6950 Sys.Net.WebServiceError = function Sys$Net$WebServiceError(timedOut, message, stackTrace, exceptionType, errorObject) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6951 /// <summary locid="M:J#Sys.Net.WebServiceError.#ctor" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6952 /// <param name="timedOut" type="Boolean"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6953 /// <param name="message" type="String" mayBeNull="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6954 /// <param name="stackTrace" type="String" mayBeNull="true" optional="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6955 /// <param name="exceptionType" type="String" mayBeNull="true" optional="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6956 /// <param name="errorObject" type="Object" mayBeNull="true" optional="true"></param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6957 var e = Function._validateParams(arguments, [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6958 {name: "timedOut", type: Boolean},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6959 {name: "message", type: String, mayBeNull: true},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6960 {name: "stackTrace", type: String, mayBeNull: true, optional: true},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6961 {name: "exceptionType", type: String, mayBeNull: true, optional: true},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6962 {name: "errorObject", type: Object, mayBeNull: true, optional: true}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6963 ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6964 if (e) throw e;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6965 this._timedOut = timedOut;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6966 this._message = message;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6967 this._stackTrace = stackTrace;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6968 this._exceptionType = exceptionType;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6969 this._errorObject = errorObject;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6970 this._statusCode = -1;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6971 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6972 function Sys$Net$WebServiceError$get_timedOut() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6973 /// <value type="Boolean" locid="P:J#Sys.Net.WebServiceError.timedOut"></value>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6974 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6975 return this._timedOut;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6976 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6977 function Sys$Net$WebServiceError$get_statusCode() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6978 /// <value type="Number" locid="P:J#Sys.Net.WebServiceError.statusCode"></value>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6979 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6980 return this._statusCode;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6981 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6982 function Sys$Net$WebServiceError$get_message() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6983 /// <value type="String" locid="P:J#Sys.Net.WebServiceError.message"></value>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6984 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6985 return this._message;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6986 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6987 function Sys$Net$WebServiceError$get_stackTrace() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6988 /// <value type="String" locid="P:J#Sys.Net.WebServiceError.stackTrace"></value>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6989 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6990 return this._stackTrace || "";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6991 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6992 function Sys$Net$WebServiceError$get_exceptionType() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6993 /// <value type="String" locid="P:J#Sys.Net.WebServiceError.exceptionType"></value>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6994 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6995 return this._exceptionType || "";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6996 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6997 function Sys$Net$WebServiceError$get_errorObject() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6998 /// <value type="Object" locid="P:J#Sys.Net.WebServiceError.errorObject"></value>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6999 if (arguments.length !== 0) throw Error.parameterCount();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7000 return this._errorObject || null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7001 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7002 Sys.Net.WebServiceError.prototype = {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7003 get_timedOut: Sys$Net$WebServiceError$get_timedOut,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7004 get_statusCode: Sys$Net$WebServiceError$get_statusCode,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7005 get_message: Sys$Net$WebServiceError$get_message,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7006 get_stackTrace: Sys$Net$WebServiceError$get_stackTrace,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7007 get_exceptionType: Sys$Net$WebServiceError$get_exceptionType,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7008 get_errorObject: Sys$Net$WebServiceError$get_errorObject
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7009 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7010 Sys.Net.WebServiceError.registerClass('Sys.Net.WebServiceError');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7011
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7012
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7013 Type.registerNamespace('Sys');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7014
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7015 Sys.Res={
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7016 'urlMustBeLessThan1024chars':'The history state must be small enough to not make the url larger than 1024 characters.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7017 'argumentTypeName':'Value is not the name of an existing type.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7018 'cantBeCalledAfterDispose':'Can\'t be called after dispose.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7019 'componentCantSetIdAfterAddedToApp':'The id property of a component can\'t be set after it\'s been added to the Application object.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7020 'behaviorDuplicateName':'A behavior with name \'{0}\' already exists or it is the name of an existing property on the target element.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7021 'notATypeName':'Value is not a valid type name.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7022 'elementNotFound':'An element with id \'{0}\' could not be found.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7023 'stateMustBeStringDictionary':'The state object can only have null and string fields.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7024 'boolTrueOrFalse':'Value must be \'true\' or \'false\'.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7025 'scriptLoadFailedNoHead':'ScriptLoader requires pages to contain a <head> element.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7026 'stringFormatInvalid':'The format string is invalid.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7027 'referenceNotFound':'Component \'{0}\' was not found.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7028 'enumReservedName':'\'{0}\' is a reserved name that can\'t be used as an enum value name.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7029 'circularParentChain':'The chain of control parents can\'t have circular references.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7030 'namespaceContainsNonObject':'Object {0} already exists and is not an object.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7031 'undefinedEvent':'\'{0}\' is not an event.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7032 'propertyUndefined':'\'{0}\' is not a property or an existing field.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7033 'observableConflict':'Object already contains a member with the name \'{0}\'.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7034 'historyCannotEnableHistory':'Cannot set enableHistory after initialization.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7035 'eventHandlerInvalid':'Handler was not added through the Sys.UI.DomEvent.addHandler method.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7036 'scriptLoadFailedDebug':'The script \'{0}\' failed to load. Check for:\r\n Inaccessible path.\r\n Script errors. (IE) Enable \'Display a notification about every script error\' under advanced settings.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7037 'propertyNotWritable':'\'{0}\' is not a writable property.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7038 'enumInvalidValueName':'\'{0}\' is not a valid name for an enum value.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7039 'controlAlreadyDefined':'A control is already associated with the element.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7040 'addHandlerCantBeUsedForError':'Can\'t add a handler for the error event using this method. Please set the window.onerror property instead.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7041 'cantAddNonFunctionhandler':'Can\'t add a handler that is not a function.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7042 'invalidNameSpace':'Value is not a valid namespace identifier.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7043 'notAnInterface':'Value is not a valid interface.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7044 'eventHandlerNotFunction':'Handler must be a function.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7045 'propertyNotAnArray':'\'{0}\' is not an Array property.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7046 'namespaceContainsClass':'Object {0} already exists as a class, enum, or interface.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7047 'typeRegisteredTwice':'Type {0} has already been registered. The type may be defined multiple times or the script file that defines it may have already been loaded. A possible cause is a change of settings during a partial update.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7048 'cantSetNameAfterInit':'The name property can\'t be set on this object after initialization.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7049 'historyMissingFrame':'For the history feature to work in IE, the page must have an iFrame element with id \'__historyFrame\' pointed to a page that gets its title from the \'title\' query string parameter and calls Sys.Application._onIFrameLoad() on the parent window. This can be done by setting EnableHistory to true on ScriptManager.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7050 'appDuplicateComponent':'Two components with the same id \'{0}\' can\'t be added to the application.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7051 'historyCannotAddHistoryPointWithHistoryDisabled':'A history point can only be added if enableHistory is set to true.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7052 'baseNotAClass':'Value is not a class.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7053 'expectedElementOrId':'Value must be a DOM element or DOM element Id.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7054 'methodNotFound':'No method found with name \'{0}\'.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7055 'arrayParseBadFormat':'Value must be a valid string representation for an array. It must start with a \'[\' and end with a \']\'.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7056 'stateFieldNameInvalid':'State field names must not contain any \'=\' characters.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7057 'cantSetId':'The id property can\'t be set on this object.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7058 'stringFormatBraceMismatch':'The format string contains an unmatched opening or closing brace.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7059 'enumValueNotInteger':'An enumeration definition can only contain integer values.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7060 'propertyNullOrUndefined':'Cannot set the properties of \'{0}\' because it returned a null value.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7061 'argumentDomNode':'Value must be a DOM element or a text node.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7062 'componentCantSetIdTwice':'The id property of a component can\'t be set more than once.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7063 'createComponentOnDom':'Value must be null for Components that are not Controls or Behaviors.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7064 'createNotComponent':'{0} does not derive from Sys.Component.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7065 'createNoDom':'Value must not be null for Controls and Behaviors.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7066 'cantAddWithoutId':'Can\'t add a component that doesn\'t have an id.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7067 'notObservable':'Instances of type \'{0}\' cannot be observed.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7068 'badTypeName':'Value is not the name of the type being registered or the name is a reserved word.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7069 'argumentInteger':'Value must be an integer.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7070 'invokeCalledTwice':'Cannot call invoke more than once.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7071 'webServiceFailed':'The server method \'{0}\' failed with the following error: {1}',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7072 'argumentType':'Object cannot be converted to the required type.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7073 'argumentNull':'Value cannot be null.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7074 'scriptAlreadyLoaded':'The script \'{0}\' has been referenced multiple times. If referencing Microsoft AJAX scripts explicitly, set the MicrosoftAjaxMode property of the ScriptManager to Explicit.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7075 'scriptDependencyNotFound':'The script \'{0}\' failed to load because it is dependent on script \'{1}\'.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7076 'formatBadFormatSpecifier':'Format specifier was invalid.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7077 'requiredScriptReferenceNotIncluded':'\'{0}\' requires that you have included a script reference to \'{1}\'.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7078 'webServiceFailedNoMsg':'The server method \'{0}\' failed.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7079 'argumentDomElement':'Value must be a DOM element.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7080 'invalidExecutorType':'Could not create a valid Sys.Net.WebRequestExecutor from: {0}.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7081 'cannotCallBeforeResponse':'Cannot call {0} when responseAvailable is false.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7082 'actualValue':'Actual value was {0}.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7083 'enumInvalidValue':'\'{0}\' is not a valid value for enum {1}.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7084 'scriptLoadFailed':'The script \'{0}\' could not be loaded.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7085 'parameterCount':'Parameter count mismatch.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7086 'cannotDeserializeEmptyString':'Cannot deserialize empty string.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7087 'formatInvalidString':'Input string was not in a correct format.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7088 'invalidTimeout':'Value must be greater than or equal to zero.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7089 'cannotAbortBeforeStart':'Cannot abort when executor has not started.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7090 'argument':'Value does not fall within the expected range.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7091 'cannotDeserializeInvalidJson':'Cannot deserialize. The data does not correspond to valid JSON.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7092 'invalidHttpVerb':'httpVerb cannot be set to an empty or null string.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7093 'nullWebRequest':'Cannot call executeRequest with a null webRequest.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7094 'eventHandlerInvalid':'Handler was not added through the Sys.UI.DomEvent.addHandler method.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7095 'cannotSerializeNonFiniteNumbers':'Cannot serialize non finite numbers.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7096 'argumentUndefined':'Value cannot be undefined.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7097 'webServiceInvalidReturnType':'The server method \'{0}\' returned an invalid type. Expected type: {1}',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7098 'servicePathNotSet':'The path to the web service has not been set.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7099 'argumentTypeWithTypes':'Object of type \'{0}\' cannot be converted to type \'{1}\'.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7100 'cannotCallOnceStarted':'Cannot call {0} once started.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7101 'badBaseUrl1':'Base URL does not contain ://.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7102 'badBaseUrl2':'Base URL does not contain another /.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7103 'badBaseUrl3':'Cannot find last / in base URL.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7104 'setExecutorAfterActive':'Cannot set executor after it has become active.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7105 'paramName':'Parameter name: {0}',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7106 'nullReferenceInPath':'Null reference while evaluating data path: \'{0}\'.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7107 'cannotCallOutsideHandler':'Cannot call {0} outside of a completed event handler.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7108 'cannotSerializeObjectWithCycle':'Cannot serialize object with cyclic reference within child properties.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7109 'format':'One of the identified items was in an invalid format.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7110 'assertFailedCaller':'Assertion Failed: {0}\r\nat {1}',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7111 'argumentOutOfRange':'Specified argument was out of the range of valid values.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7112 'webServiceTimedOut':'The server method \'{0}\' timed out.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7113 'notImplemented':'The method or operation is not implemented.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7114 'assertFailed':'Assertion Failed: {0}',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7115 'invalidOperation':'Operation is not valid due to the current state of the object.',
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7116 'breakIntoDebugger':'{0}\r\n\r\nBreak into debugger?'
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7117 };