How to use COMMON method in Best

Best JavaScript code snippet using best

ActsSubscriber_test_ordered.js

Source:ActsSubscriber_test_ordered.js Github

copy

Full Screen

1/*2 * Copyright (c) 2021 Huawei Device Co., Ltd.3 * Licensed under the Apache License, Version 2.0 (the "License");4 * you may not use this file except in compliance with the License.5 * You may obtain a copy of the License at6 *7 * http://www.apache.org/licenses/LICENSE-2.08 *9 * Unless required by applicable law or agreed to in writing, software10 * distributed under the License is distributed on an "AS IS" BASIS,11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.12 * See the License for the specific language governing permissions and13 * limitations under the License.14 */15import Subscriber from '@ohos.commonevent'16import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'1718describe('ActsSubscriberTestOrder', function () {19 console.info("===========ActsSubscriberTestOrder start====================>");20 var num = 0, num2 = 0;21 var order = false;22 var commonEventSubscriber0100;23 var commonEventSubscriber0101;24 var commonEventSubscriber0200;25 var commonEventSubscriber0201;26 var commonEventSubscriber0300;27 var commonEventSubscriber0301;28 var commonEventSubscriber0400;29 var commonEventSubscriber0401;30 var commonEventSubscriber0500;31 var commonEventSubscriber0501;3233 function publishCallback(err) {34 console.info("===============>publishCallback");35 }3637 function unsubscribeCallback(err) {38 console.info("===============>unsubscribeCallback");39 }4041 /*42 * @tc.number : ActsSubscriberTestOrder_010043 * @tc.name : verify subscribe and publish : Check subscribe same event and publish common ordered event44 * @tc.desc : Check the subscriber can receive event "publish_event0100" type of the interface (by Promise)45 */46 it('ActsSubscriberTestOrder_0100', 0, async function (done) {47 console.info("===============ActsSubscriberTestOrder_0100===============>");4849 var commonEventSubscribeInfo1 = {50 events: ["publish_event0100"],51 priority: 1052 };5354 var commonEventSubscribeInfo2 = {55 events: ["publish_event0100"],56 priority: 957 };5859 var commonEventPublishData = {60 bundleName: "publish_event0100_bundleName",61 code: 1,62 data: "publish_event1001_init",63 isOrdered: true,64 }6566 async function subscriberCallBack0100(err, data) {67 console.info("===============>subscriberCallBack0100========event: " + data.event);68 console.info("===============>subscriberCallBack0100========bundleName: " + data.bundleName);69 console.info("===============>subscriberCallBack0100=========code: " + data.code);70 console.info("===============>subscriberCallBack0100=========data: " + data.data);71 expect(data.event).assertEqual("publish_event0100");72 expect(data.code).assertEqual(1);73 expect(data.data).assertEqual("publish_event1001_init");74 expect(data.bundleName).assertEqual("publish_event0100_bundleName");7576 commonEventSubscriber0100.setCode(2).then(()=>{77 console.info("===============>subscriberCallBack0100 setCode promise");78 })7980 commonEventSubscriber0100.setData("publish_event1001_change").then(()=>{81 console.info("===============>subscriberCallBack0100 setData promise");82 })8384 commonEventSubscriber0100.setCodeAndData(2, "publish_event1001_change").then(()=>{85 console.info("===============>subscriberCallBack0100 setCodeAndData promise");86 })8788 commonEventSubscriber0100.getAbortCommonEvent().then(function(data) {89 console.info(90 "===============>subscriberCallBack0100 getAbortCommonEvent promise abort: " + data);91 })9293 commonEventSubscriber0100.clearAbortCommonEvent().then(()=>{94 console.info("===============>subscriberCallBack0100 clearAbortCommonEvent promise");95 })9697 commonEventSubscriber0100.getAbortCommonEvent().then(function(data) {98 console.info(99 "===============>subscriberCallBack0100 getAbortCommonEvent promise abort: " + data);100 })101102 commonEventSubscriber0100.finishCommonEvent().then(()=>{103 console.info("===============>subscriberCallBack0100 finishCommonEvent promise");104 })105 }106107 async function subscriberCallBack0101(err, data) {108 console.info("===============>subscriberCallBack0101========code: " + err.code);109 console.info("===============>subscriberCallBack0101========event: " + data.event);110 console.info("===============>subscriberCallBack0101========bundleName: " + data.bundleName);111 console.info("===============>subscriberCallBack0101=========code: " + data.code);112 console.info("===============>subscriberCallBack0101=========data: " + data.data);113 expect(data.event).assertEqual("publish_event0100");114 console.info("===============>subscriberCallBack0101=========1 code "+ data.code);115 expect(data.code).assertEqual(2);116 commonEventSubscriber0101.getCode().then(function(data) {117 console.info("===============>subscriberCallBack0101 getCode promise code: "+ data);118 })119 expect(data.data).assertEqual("publish_event1001_change");120 commonEventSubscriber0100.getData().then(function(data) {121 console.info("===============>subscriberCallBack0101 getData promise data: "+ data);122 })123 expect(data.bundleName).assertEqual("publish_event0100_bundleName");124 commonEventSubscriber0101.finishCommonEvent().then(()=>{125 console.info("===============>subscriberCallBack0101 finishCommonEvent promise");126 })127 done();128 }129130 Subscriber.createSubscriber(131 commonEventSubscribeInfo1132 ).then(function (data) {133 console.info("===============ActsSubscriberTestOrder_0100==========createSubscriber promise1");134 commonEventSubscriber0100 = data;135 data.getSubscribeInfo().then(function (data) {136 console.info("===============ActsSubscriberTestOrder_0100=========getSubscribeInfo promise1");137 Subscriber.subscribe(commonEventSubscriber0100, subscriberCallBack0100);138 });139 })140141 Subscriber.createSubscriber(142 commonEventSubscribeInfo2143 ).then(function (data) {144 console.info("===============ActsSubscriberTestOrder_0100==========createSubscriber promise2");145 commonEventSubscriber0101 = data;146 data.getSubscribeInfo().then(function (data) {147 console.info("===============ActsSubscriberTestOrder_0100=========getSubscribeInfo promise2");148 Subscriber.subscribe(commonEventSubscriber0101, subscriberCallBack0101);149 Subscriber.publish("publish_event0100", commonEventPublishData, publishCallback);150 });151 })152 setTimeout(function (){153 console.debug("===================ActsSubscriberTestOrder_0100 end==================");154 }, 200000);155 })156157 /*158 * @tc.number : ActsSubscriberTestOrder_0200159 * @tc.name : verify subscribe and publish : Check subscribe different event160 * and twice publish common ordered event and check unsubscribe event161 * @tc.desc : Check the subscriber can receive event "publish_event0200" type of the interface (by Promise)162 */163 it ('ActsSubscriberTestOrder_0200', 0, async function (done) {164 console.info("===============ActsSubscriberTestOrder_0200===============>");165166 var commonEventSubscribeInfo1 = {167 events: ["publish_event0200",168 "publish_event0201"],169 priority: 10170 };171172 var commonEventSubscribeInfo2 = {173 events: ["publish_event0201"],174 priority: 9175 };176177 var commonEventPublishData1 = {178 bundleName: "publish_event0200_bundleName",179 code: 1,180 data: "publish_event0200_init",181 isOrdered: false,182 }183184 var commonEventPublishData2 = {185 bundleName: "publish_event0201_bundleName",186 code: 1,187 data: "publish_event0201_init",188 isOrdered: true,189 }190191 async function subscriberCallBack0200(err, data) {192 console.info("===============>subscriberCallBack0200========event: " + data.event);193 console.info("===============>subscriberCallBack0200========bundleName: " + data.bundleName);194 console.info("===============>subscriberCallBack0200=========code: " + data.code);195 console.info("===============>subscriberCallBack0200=========data: " + data.data);196 console.info("===============>subscriberCallBack0200=========num2: " + num2);197 if (num2 == 0) {198 num2++;199 expect(data.event).assertEqual("publish_event0200");200 console.info("===============>subscriberCallBack0200=====num2:0====code: " + data.code);201 expect(data.code).assertEqual(1);202 expect(data.data).assertEqual("publish_event0200_init");203 expect(data.bundleName).assertEqual("publish_event0200_bundleName");204 }else {205 num2 = 0;206 expect(data.event).assertEqual("publish_event0201");207 console.info("===============>subscriberCallBack0200=====num2:1====code: " + data.code);208 expect(data.code).assertEqual(1);209 expect(data.data).assertEqual("publish_event0201_init");210 expect(data.bundleName).assertEqual("publish_event0201_bundleName");211 commonEventSubscriber0200.finishCommonEvent().then(()=>{212 console.info("===============>subscriberCallBack0200:num:1:finishCommonEvent promise");213 })214 }215 }216217 async function subscriberCallBack0201(err, data) {218 console.info("===============>subscriberCallBack0201========event: " + data.event);219 console.info("===============>subscriberCallBack0201========bundleName: " + data.bundleName);220 console.info("===============>subscriberCallBack0201=========code=: " + data.code);221 console.info("===============>subscriberCallBack0201=========data: " + data.data);222223 expect(data.event).assertEqual("publish_event0201");224 console.info("===============>subscriberCallBack0201=========code: " + data.code);225 expect(data.code).assertEqual(1);226 expect(data.data).assertEqual("publish_event0201_init");227 expect(data.bundleName).assertEqual("publish_event0201_bundleName");228 commonEventSubscriber0201.finishCommonEvent().then(()=>{229 console.info("===============>subscriberCallBack0201:finishCommonEvent promise");230 })231 done();232 }233234 Subscriber.createSubscriber(235 commonEventSubscribeInfo1,236 ).then(function (data) {237 console.info("===============ActsSubscriberTestOrder_0200==========createSubscriber promise1");238 commonEventSubscriber0200 = data;239 data.getSubscribeInfo().then(function (data) {240 console.info("===============ActsSubscriberTestOrder_0200=========getSubscribeInfo promise1");241 Subscriber.subscribe(commonEventSubscriber0200, subscriberCallBack0200);242 });243 })244245 Subscriber.createSubscriber(246 commonEventSubscribeInfo2,247 ).then(function (data) {248 console.info("===============ActsSubscriberTestOrder_0200==========createSubscriber promise2");249 commonEventSubscriber0201 = data;250 data.getSubscribeInfo().then(function (data) {251 console.info("===============ActsSubscriberTestOrder_0200=========getSubscribeInfo promise2");252 Subscriber.subscribe(commonEventSubscriber0201, subscriberCallBack0201);253 Subscriber.unsubscribe(commonEventSubscriber0200, unsubscribeCallback);254 Subscriber.publish("publish_event0200", commonEventPublishData1, publishCallback);255 Subscriber.publish("publish_event0201", commonEventPublishData2, publishCallback);256257 });258 })259 setTimeout(function (){260 console.debug("===================ActsSubscriberTestOrder_0200 end==================");261 }, 200000);262 })263264 /*265 * @tc.number : ActsSubscriberTestOrder_0300266 * @tc.name : verify subscribe and publish : Check subscribe different events267 * and some publish common ordered events268 * @tc.desc : Check the subscriber can receive event "publish_event0301" type of the interface (by Promise)269 */270 it ('ActsSubscriberTestOrder_0300', 0, async function (done) {271 console.info("===============ActsSubscriberTestOrder_0300===============>");272273 var commonEventSubscribeInfo1 = {274 events: ["publish_event0301"],275 priority: 9276 };277278 var commonEventSubscribeInfo2 = {279 events: ["publish_event0301"],280 priority: 10281 };282283 var commonEventPublishData2 = {284 bundleName: "publish_event0301_bundleName",285 code: 1,286 data: "publish_event0301_init",287 isOrdered: true,288 }289290 async function subscriberCallBack0300(err, data) {291 console.info("===============>subscriberCallBack0300========event: " + data.event);292 console.info("===============>subscriberCallBack0300========bundleName: " + data.bundleName);293 console.info("===============>subscriberCallBack0300=========code: " + data.code);294 console.info("===============>subscriberCallBack0300=========dat: " + data.data);295 console.info("===============>subscriberCallBack0300=========order: " + order);296297 expect(data.event).assertEqual("publish_event0301");298 expect(data.code).assertEqual(1);299 expect(data.data).assertEqual("publish_event0301_init");300 expect(data.bundleName).assertEqual("publish_event0301_bundleName");301 expect(order).assertEqual(true);302303 if (order == true) {304 order = false;305 }306307 commonEventSubscriber0300.isOrderedCommonEvent().then(function(data) {308 console.info("========>subscriberCallBack0300 isOrderedCommonEvent promise " + data);309 expect(data).assertEqual(true);310 })311 commonEventSubscriber0300.finishCommonEvent().then(()=>{312 console.info("===============>subscriberCallBack0300 finishCommonEvent promise");313 })314 done();315 }316317 async function subscriberCallBack0301(err, data) {318 console.info("===============>subscriberCallBack0301========event: " + data.event);319 console.info("===============>subscriberCallBack0301========bundleName: " + data.bundleName);320 console.info("===============>subscriberCallBack0301=========code: " + data.code);321 console.info("===============>subscriberCallBack0301=========data: " + data.data);322 console.info("===============>subscriberCallBack0301=========order: " + order);323324 expect(data.event).assertEqual("publish_event0301");325 expect(data.code).assertEqual(1);326 expect(data.data).assertEqual("publish_event0301_init");327 expect(data.bundleName).assertEqual("publish_event0301_bundleName");328329 if (order == false) {330 order = true;331 }332333 commonEventSubscriber0301.isOrderedCommonEvent().then(function(data) {334 console.info("===============>subscriberCallBack0301 isOrderedCommonEvent promise" + data);335 expect(data).assertEqual(true);336 })337 commonEventSubscriber0301.finishCommonEvent().then(()=>{338 console.info("===============>subscriberCallBack0301 finishCommonEvent promise");339 })340 }341342 Subscriber.createSubscriber(343 commonEventSubscribeInfo1,344 ).then(function (data) {345 console.info("===============ActsSubscriberTestOrder_0300==========createSubscriber promise1");346 commonEventSubscriber0300 = data;347 data.getSubscribeInfo().then(function (data) {348 console.info("===============ActsSubscriberTestOrder_0300=========getSubscribeInfo promise1");349 Subscriber.subscribe(commonEventSubscriber0300, subscriberCallBack0300);350 });351 })352353 Subscriber.createSubscriber(354 commonEventSubscribeInfo2,355 ).then(function (data) {356 console.info("===============ActsSubscriberTestOrder_0300==========createSubscriber promise2");357 commonEventSubscriber0301 = data;358 data.getSubscribeInfo().then(function (data) {359 console.info("===============ActsSubscriberTestOrder_0300=========getSubscribeInfo promise2");360 Subscriber.subscribe(commonEventSubscriber0301, subscriberCallBack0301);361 var numindex = 0;362 for (; numindex < 3; ++numindex) {363 Subscriber.publish("publish_event0301", commonEventPublishData2, publishCallback);364 }365 });366 })367368 setTimeout(function (){369 console.debug("===================ActsSubscriberTestOrder_0300 end==================");370 }, 200000);371 })372373 /*374 * @tc.number : ActsSubscriberTestOrder_0400375 * @tc.name : verify subscribe and publish : Check subscribe same events376 * and publish common ordered events and check abort event377 * @tc.desc : Check the subscriber can receive event "publish_event0400" type of the interface (by promise)378 */379 it ('ActsSubscriberTestOrder_0400', 0, async function (done) {380 console.info("===============ActsSubscriberTestOrder_0400===============>");381382 var commonEventSubscribeInfo1 = {383 events: ["publish_event0400"],384 priority: 10385 };386387 var commonEventSubscribeInfo2 = {388 events: ["publish_event0400"],389 priority: 9390 };391392 var commonEventPublishData = {393 bundleName: "publish_event0400_bundleName",394 code: 1,395 data: "publish_event0400_init",396 isOrdered: true,397 }398399 async function subscriberCallBack0400(err, data) {400 console.info("===============>subscriberCallBack0400========event: " + data.event);401 console.info("===============>subscriberCallBack0400========bundleName: " + data.bundleName);402 console.info("===============>subscriberCallBack0400=========code: " + data.code);403 console.info("===============>subscriberCallBack0400=========data: " + data.data);404 expect(data.event).assertEqual("publish_event0400");405 expect(data.code).assertEqual(1);406 expect(data.data).assertEqual("publish_event0400_init");407 expect(data.bundleName).assertEqual("publish_event0400_bundleName");408 commonEventSubscriber0400.getAbortCommonEvent().then(function(data) {409 console.info("===============>subscriberCallBack0400 getAbortCommonEvent promise abort2: " + data);410 });411 commonEventSubscriber0400.abortCommonEvent().then(() => {412 console.info("===============>subscriberCallBack0400 abortCommonEvent promise");413 });414 commonEventSubscriber0400.getAbortCommonEvent().then(function(data) {415 console.info(416 "===============>subscriberCallBack0400 getAbortCommonEvent promise abort2: " + data);417 });418 commonEventSubscriber0400.finishCommonEvent().then(()=> {419 console.info("===============>subscriberCallBack0400 finishCommonEvent promise");420 });421 done();422 }423424 async function subscriberCallBack0401(err, data) {425 console.info("===============>subscriberCallBack0401========event: " + data.event);426 expect().assertFail();427 }428429 Subscriber.createSubscriber(430 commonEventSubscribeInfo1431 ).then(function (data) {432 console.info("===============ActsSubscriberTestOrder_0400==========createSubscriber promise1");433 commonEventSubscriber0400 = data;434 data.getSubscribeInfo().then(function (data) {435 console.info("===============ActsSubscriberTestOrder_0400=========getSubscribeInfo promise1");436 expect(data.events[0]).assertEqual("publish_event0400");437 Subscriber.subscribe(commonEventSubscriber0400, subscriberCallBack0400);438 })439 })440441 Subscriber.createSubscriber(442 commonEventSubscribeInfo2443 ).then(function (data) {444 console.info("===============ActsSubscriberTestOrder_0400==========createSubscriber promise2");445 commonEventSubscriber0401 = data;446 data.getSubscribeInfo().then(function (data) {447 console.info("===============ActsSubscriberTestOrder_0400=========getSubscribeInfo promise2");448 expect(data.events[0]).assertEqual("publish_event0400");449 Subscriber.subscribe(commonEventSubscriber0401, subscriberCallBack0401);450 Subscriber.publish("publish_event0400", commonEventPublishData, publishCallback);451 })452 })453454 setTimeout(function (){455 console.debug("===================ActsSubscriberTestOrder_0400 end==================");456 }, 200000);457 })458459 /*460 * @tc.number : ActsSubscriberTestOrder_0500461 * @tc.name : verify subscribe and publish : Check subscriber same events462 * and publish common ordered events and check subscriberInfo priority463 * @tc.desc : Check the subscriber can receive event "publish_event0500" type of the interface (by promise)464 */465 it ('ActsSubscriberTestOrder_0500', 0, async function (done) {466 console.info("===============ActsSubscriberTestOrder_0500===============>");467468 var commonEventSubscribeInfo1 = {469 events: ["publish_event0500"],470 priority: 1001471 };472473 var commonEventSubscribeInfo2 = {474 events: ["publish_event0500"],475 priority: -101476 };477478 var commonEventPublishData = {479 bundleName: "publish_event0500_bundleName",480 code: 10,481 data: "publish_event0500_init",482 isOrdered: true,483 }484485 async function subscriberCallBack0500(err, data) {486 console.info("===============>subscriberCallBack0500========event: " + data.event);487 console.info("===============>subscriberCallBack0500========bundleName: " + data.bundleName);488 console.info("===============>subscriberCallBack0500=========code: " + data.code);489 console.info("===============>subscriberCallBack0500=========data: " + data.data);490 expect(data.event).assertEqual("publish_event0500");491 expect(data.code).assertEqual(10);492 expect(data.data).assertEqual("publish_event0500_init");493 expect(data.bundleName).assertEqual("publish_event0500_bundleName");494 commonEventSubscriber0500.finishCommonEvent().then(() => {495 console.info("===============>subscriberCallBack0500 finishCommonEvent promise");496 });497 }498499 async function subscriberCallBack0501(err, data) {500 console.info("===============>subscriberCallBack0501========event: " + data.event);501 console.info("===============>subscriberCallBack0501========bundleName: " + data.bundleName);502 console.info("===============>subscriberCallBack0501=========code: " + data.code);503 console.info("===============>subscriberCallBack0501========data: " + data.data);504 expect(data.event).assertEqual("publish_event0500");505 expect(data.code).assertEqual(10);506 expect(data.data).assertEqual("publish_event0500_init");507 expect(data.bundleName).assertEqual("publish_event0500_bundleName");508 commonEventSubscriber0501.finishCommonEvent().then(() => {509 console.info("===============>subscriberCallBack0501 finishCommonEvent promise");510 });511 done();512 }513514 Subscriber.createSubscriber(515 commonEventSubscribeInfo1516 ).then(function (data) {517 console.info("===============ActsSubscriberTestOrder_0500==========createSubscriber promise1");518 commonEventSubscriber0500 = data;519 data.getSubscribeInfo().then(function (data) {520 console.info("===============ActsSubscriberTestOrder_0500==========getSubscribeInfo promise1");521 expect(data.events[0]).assertEqual("publish_event0500");522 Subscriber.subscribe(commonEventSubscriber0500, subscriberCallBack0500);523 })524 })525526 Subscriber.createSubscriber(527 commonEventSubscribeInfo2528 ).then(function (data) {529 console.info("===============ActsSubscriberTestOrder_0500==========createSubscriber promise2");530 commonEventSubscriber0501 = data;531 data.getSubscribeInfo().then(function (data) {532 console.info("===============ActsSubscriberTestOrder_0500==========getSubscribeInfo promise2");533 expect(data.events[0]).assertEqual("publish_event0500");534 Subscriber.subscribe(commonEventSubscriber0501, subscriberCallBack0501);535 Subscriber.publish("publish_event0500", commonEventPublishData, publishCallback);536 })537 })538539 setTimeout(function (){540 console.debug("===================ActsSubscriberTestOrder_0500 end==================");541 }, 200000);542 }) ...

Full Screen

Full Screen

ColorParameters.js

Source:ColorParameters.js Github

copy

Full Screen

1Clazz.declarePackage ("JSV.common");2Clazz.load (["JSV.common.Parameters"], "JSV.common.ColorParameters", ["java.util.Hashtable", "$.StringTokenizer", "JU.CU", "$.Lst", "JSV.common.ScriptToken"], function () {3c$ = Clazz.decorateAsClass (function () {4this.titleFontName = null;5this.displayFontName = null;6this.elementColors = null;7this.plotColors = null;8this.isDefault = false;9Clazz.instantialize (this, arguments);10}, JSV.common, "ColorParameters", JSV.common.Parameters);11Clazz.makeConstructor (c$, 12function () {13Clazz.superConstructor (this, JSV.common.ColorParameters, []);14JSV.common.ColorParameters.BLACK = this.getColor3 (0, 0, 0);15JSV.common.ColorParameters.RED = this.getColor3 (255, 0, 0);16JSV.common.ColorParameters.LIGHT_GRAY = this.getColor3 (200, 200, 200);17JSV.common.ColorParameters.DARK_GRAY = this.getColor3 (80, 80, 80);18JSV.common.ColorParameters.BLUE = this.getColor3 (0, 0, 255);19JSV.common.ColorParameters.WHITE = this.getColor3 (255, 255, 255);20this.elementColors = new java.util.Hashtable ();21this.setColor (JSV.common.ScriptToken.TITLECOLOR, JSV.common.ColorParameters.BLACK);22this.setColor (JSV.common.ScriptToken.UNITSCOLOR, JSV.common.ColorParameters.RED);23this.setColor (JSV.common.ScriptToken.SCALECOLOR, JSV.common.ColorParameters.BLACK);24this.setColor (JSV.common.ScriptToken.COORDINATESCOLOR, JSV.common.ColorParameters.RED);25this.setColor (JSV.common.ScriptToken.GRIDCOLOR, JSV.common.ColorParameters.LIGHT_GRAY);26this.setColor (JSV.common.ScriptToken.PLOTCOLOR, JSV.common.ColorParameters.BLUE);27this.setColor (JSV.common.ScriptToken.PLOTAREACOLOR, JSV.common.ColorParameters.WHITE);28this.setColor (JSV.common.ScriptToken.BACKGROUNDCOLOR, this.getColor3 (192, 192, 192));29this.setColor (JSV.common.ScriptToken.INTEGRALPLOTCOLOR, JSV.common.ColorParameters.RED);30this.setColor (JSV.common.ScriptToken.PEAKTABCOLOR, JSV.common.ColorParameters.RED);31this.setColor (JSV.common.ScriptToken.HIGHLIGHTCOLOR, JSV.common.ColorParameters.DARK_GRAY);32for (var i = 0; i < 8; i++) JSV.common.ColorParameters.defaultPlotColors[i] = this.getColorFromString (JSV.common.ColorParameters.defaultPlotColorNames[i]);33this.plotColors = new Array (8);34System.arraycopy (JSV.common.ColorParameters.defaultPlotColors, 0, this.plotColors, 0, 8);35});36Clazz.defineMethod (c$, "setFor", 37function (jsvp, ds, includeMeasures) {38if (ds == null) ds = this;39if (includeMeasures) jsvp.getPanelData ().setBooleans (ds, null);40var pd = jsvp.getPanelData ();41if (pd.getCurrentPlotColor (1) != null) pd.setPlotColors (this.plotColors);42pd.setColorOrFont (ds, null);43}, "JSV.api.JSVPanel,JSV.common.ColorParameters,~B");44Clazz.defineMethod (c$, "set", 45function (pd, st, value) {46var param = null;47switch (st) {48default:49this.setP (pd, st, value);50return;51case JSV.common.ScriptToken.PLOTCOLORS:52if (pd == null) this.getPlotColors (value);53 else pd.setPlotColors (this.getPlotColors (value));54return;55case JSV.common.ScriptToken.BACKGROUNDCOLOR:56case JSV.common.ScriptToken.COORDINATESCOLOR:57case JSV.common.ScriptToken.GRIDCOLOR:58case JSV.common.ScriptToken.HIGHLIGHTCOLOR:59case JSV.common.ScriptToken.INTEGRALPLOTCOLOR:60case JSV.common.ScriptToken.PEAKTABCOLOR:61case JSV.common.ScriptToken.PLOTAREACOLOR:62case JSV.common.ScriptToken.PLOTCOLOR:63case JSV.common.ScriptToken.SCALECOLOR:64case JSV.common.ScriptToken.TITLECOLOR:65case JSV.common.ScriptToken.UNITSCOLOR:66param = this.setColorFromString (st, value);67break;68case JSV.common.ScriptToken.TITLEFONTNAME:69case JSV.common.ScriptToken.DISPLAYFONTNAME:70param = this.getFontName (st, value);71break;72}73if (pd == null) return;74if (param != null) pd.setColorOrFont (this, st);75}, "JSV.common.PanelData,JSV.common.ScriptToken,~S");76Clazz.defineMethod (c$, "getElementColor", 77function (st) {78return this.elementColors.get (st);79}, "JSV.common.ScriptToken");80Clazz.defineMethod (c$, "setColor", 81function (st, color) {82if (color != null) this.elementColors.put (st, color);83return color;84}, "JSV.common.ScriptToken,javajs.api.GenericColor");85Clazz.defineMethod (c$, "copy", 86function () {87return this.copy (this.name);88});89Clazz.defineMethod (c$, "setElementColors", 90function (p) {91this.displayFontName = p.displayFontName;92for (var entry, $entry = p.elementColors.entrySet ().iterator (); $entry.hasNext () && ((entry = $entry.next ()) || true);) this.setColor (entry.getKey (), entry.getValue ());93return this;94}, "JSV.common.ColorParameters");95Clazz.defineMethod (c$, "getColorFromString", 96function (name) {97return this.getColor1 (JU.CU.getArgbFromString (name));98}, "~S");99Clazz.defineMethod (c$, "getPlotColors", 100function (plotColorsStr) {101if (plotColorsStr == null) {102this.plotColors[0] = this.getElementColor (JSV.common.ScriptToken.PLOTCOLOR);103return this.plotColors;104}var st = new java.util.StringTokenizer (plotColorsStr, ",;.- ");105var colors = new JU.Lst ();106try {107while (st.hasMoreTokens ()) colors.addLast (this.getColorFromString (st.nextToken ()));108} catch (e) {109if (Clazz.exceptionOf (e, Exception)) {110return null;111} else {112throw e;113}114}115return colors.toArray ( new Array (colors.size ()));116}, "~S");117Clazz.defineMethod (c$, "setColorFromString", 118function (st, value) {119return this.setColor (st, this.getColorFromString (value));120}, "JSV.common.ScriptToken,~S");121Clazz.defineMethod (c$, "getFontName", 122function (st, value) {123var isValid = this.isValidFontName (value);124switch (st) {125case JSV.common.ScriptToken.TITLEFONTNAME:126return (isValid ? this.titleFontName = value : this.titleFontName);127case JSV.common.ScriptToken.DISPLAYFONTNAME:128return (isValid ? this.displayFontName = value : this.displayFontName);129}130return null;131}, "JSV.common.ScriptToken,~S");132Clazz.defineStatics (c$,133"BLACK", null,134"RED", null,135"LIGHT_GRAY", null,136"DARK_GRAY", null,137"BLUE", null,138"WHITE", null);139c$.defaultPlotColors = c$.prototype.defaultPlotColors = new Array (8);140c$.defaultPlotColorNames = c$.prototype.defaultPlotColorNames = Clazz.newArray (-1, ["black", "darkGreen", "darkred", "orange", "magenta", "cyan", "maroon", "darkGray"]);...

Full Screen

Full Screen

Parameters.js

Source:Parameters.js Github

copy

Full Screen

1Clazz.declarePackage ("JSV.common");2Clazz.load (null, "JSV.common.Parameters", ["java.lang.Boolean", "java.util.Hashtable", "JSV.common.ScriptToken"], function () {3c$ = Clazz.decorateAsClass (function () {4this.name = null;5this.integralMinY = 0.1;6this.integralRange = 50.0;7this.integralOffset = 30.0;8this.integralDrawAll = false;9this.viewOffset = 0;10this.peakListThreshold = NaN;11this.peakListInterpolation = "parabolic";12this.precision = 2;13this.htBooleans = null;14Clazz.instantialize (this, arguments);15}, JSV.common, "Parameters");16Clazz.makeConstructor (c$, 17function () {18this.htBooleans = new java.util.Hashtable ();19this.setBoolean (JSV.common.ScriptToken.TITLEON, true);20this.setBoolean (JSV.common.ScriptToken.ENABLEZOOM, true);21this.setBoolean (JSV.common.ScriptToken.DISPLAY2D, true);22this.setBoolean (JSV.common.ScriptToken.COORDINATESON, true);23this.setBoolean (JSV.common.ScriptToken.PEAKTABSON, true);24this.setBoolean (JSV.common.ScriptToken.POINTSONLY, false);25this.setBoolean (JSV.common.ScriptToken.GRIDON, true);26this.setBoolean (JSV.common.ScriptToken.XSCALEON, true);27this.setBoolean (JSV.common.ScriptToken.YSCALEON, true);28this.setBoolean (JSV.common.ScriptToken.XUNITSON, true);29this.setBoolean (JSV.common.ScriptToken.YUNITSON, true);30});31Clazz.defineMethod (c$, "setName", 32function (name) {33this.name = name;34return this;35}, "~S");36Clazz.defineMethod (c$, "getBooleans", 37function () {38return this.htBooleans;39});40Clazz.defineMethod (c$, "setBoolean", 41function (st, val) {42this.htBooleans.put (st, Boolean.$valueOf (val));43return val;44}, "JSV.common.ScriptToken,~B");45Clazz.defineMethod (c$, "getBoolean", 46function (t) {47return Boolean.TRUE === this.htBooleans.get (t);48}, "JSV.common.ScriptToken");49c$.isTrue = Clazz.defineMethod (c$, "isTrue", 50function (value) {51return (value.length == 0 || Boolean.parseBoolean (value));52}, "~S");53c$.getTFToggle = Clazz.defineMethod (c$, "getTFToggle", 54function (value) {55return (value.equalsIgnoreCase ("TOGGLE") ? null : JSV.common.Parameters.isTrue (value) ? Boolean.TRUE : Boolean.FALSE);56}, "~S");57Clazz.defineMethod (c$, "setP", 58function (pd, st, value) {59switch (st) {60default:61return;62case JSV.common.ScriptToken.COORDINATESON:63case JSV.common.ScriptToken.DISPLAY1D:64case JSV.common.ScriptToken.DISPLAY2D:65case JSV.common.ScriptToken.ENABLEZOOM:66case JSV.common.ScriptToken.GRIDON:67case JSV.common.ScriptToken.POINTSONLY:68case JSV.common.ScriptToken.PEAKTABSON:69case JSV.common.ScriptToken.REVERSEPLOT:70case JSV.common.ScriptToken.TITLEON:71case JSV.common.ScriptToken.TITLEBOLDON:72case JSV.common.ScriptToken.XSCALEON:73case JSV.common.ScriptToken.XUNITSON:74case JSV.common.ScriptToken.YSCALEON:75case JSV.common.ScriptToken.YUNITSON:76var tfToggle = JSV.common.Parameters.getTFToggle (value);77if (tfToggle != null) {78this.setBoolean (st, tfToggle.booleanValue ());79break;80}if (pd == null) return;81var b = !pd.getBoolean (st);82switch (st) {83default:84break;85case JSV.common.ScriptToken.XSCALEON:86this.setBoolean (JSV.common.ScriptToken.XUNITSON, b);87pd.setBoolean (JSV.common.ScriptToken.XUNITSON, b);88break;89case JSV.common.ScriptToken.YSCALEON:90this.setBoolean (JSV.common.ScriptToken.YUNITSON, b);91pd.setBoolean (JSV.common.ScriptToken.YUNITSON, b);92break;93}94this.setBoolean (st, b);95break;96}97if (pd == null) return;98pd.setBooleans (this, st);99}, "JSV.common.PanelData,JSV.common.ScriptToken,~S");100c$.isMatch = Clazz.defineMethod (c$, "isMatch", 101function (match, key) {102return match == null || key.equalsIgnoreCase (match);103}, "~S,~S");104c$.putInfo = Clazz.defineMethod (c$, "putInfo", 105function (match, info, key, value) {106if (value != null && JSV.common.Parameters.isMatch (match, key)) info.put (match == null ? key : match, value);107}, "~S,java.util.Map,~S,~O");...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var test = require('./testmodule');2test.hello();3test.goodbye();4var test = require('./testmodule').hello;5test();6exports.hello = function(){7 console.log('Hello');8}9exports.goodbye = function(){10 console.log('Goodbye');11}12module.exports = function(){13 console.log('Hello');14}

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Best automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful